From ab1ead6b9761531787c78e0c80daf98b421ac06f Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Mon, 15 Apr 2002 02:46:00 +0000 Subject: [PATCH] 1) Fix a bug about reporting varchar info thanks to Aceto. 2) Introcuced 3 drivers. 3) The version is now 7.02.0001. --- src/interfaces/odbc/pgtypes.c | 37 +++++++++++++++++++---------- src/interfaces/odbc/psqlodbc.h | 4 ++-- src/interfaces/odbc/psqlodbc.rc | 8 +++---- src/interfaces/odbc/psqlodbc.reg | 1 - src/interfaces/odbc/psqlodbc30.reg | 5 ++-- src/interfaces/odbc/psqlodbc30w.reg | 4 ++-- 6 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/interfaces/odbc/pgtypes.c b/src/interfaces/odbc/pgtypes.c index 691fd92c53..3bc42a97a5 100644 --- a/src/interfaces/odbc/pgtypes.c +++ b/src/interfaces/odbc/pgtypes.c @@ -520,7 +520,7 @@ pgtype_to_name(StatementClass *stmt, Int4 type) static Int2 getNumericDecimalDigits(StatementClass *stmt, Int4 type, int col) { - Int4 atttypmod = -1; + Int4 atttypmod = -1, default_decimal_digits = 6; QResultClass *result; ColumnInfoClass *flds; @@ -545,30 +545,35 @@ getNumericDecimalDigits(StatementClass *stmt, Int4 type, int col) return flds->adtsize[col]; } if (atttypmod < 0) - return PG_NUMERIC_MAX_SCALE; + return default_decimal_digits; } else atttypmod = QR_get_atttypmod(result, col); if (atttypmod > -1) return (atttypmod & 0xffff); else - return (QR_get_display_size(result, col) ? - QR_get_display_size(result, col) : - PG_NUMERIC_MAX_SCALE); + { + Int4 dsp_size = QR_get_display_size(result, col); + if (dsp_size <= 0) + return default_decimal_digits; + if (dsp_size < 5) + dsp_size = 5; + return dsp_size; + } } static Int4 getNumericColumnSize(StatementClass *stmt, Int4 type, int col) { - Int4 atttypmod = -1; + Int4 atttypmod = -1, max_column_size = PG_NUMERIC_MAX_PRECISION + PG_NUMERIC_MAX_SCALE, default_column_size = 28; QResultClass *result; ColumnInfoClass *flds; mylog("getNumericColumnSize: type=%d, col=%d\n", type, col); if (col < 0) - return PG_NUMERIC_MAX_PRECISION; + return max_column_size; result = SC_get_Curres(stmt); @@ -583,19 +588,25 @@ getNumericColumnSize(StatementClass *stmt, Int4 type, int col) { atttypmod = flds->atttypmod[col]; if (atttypmod < 0 && flds->adtsize[col] > 0) - return flds->adtsize[col]; + return 2 * flds->adtsize[col]; } if (atttypmod < 0) - return PG_NUMERIC_MAX_PRECISION; + return default_column_size; } else atttypmod = QR_get_atttypmod(result, col); if (atttypmod > -1) return (atttypmod >> 16) & 0xffff; else - return (QR_get_display_size(result, col) > 0 ? - QR_get_display_size(result, col) : - PG_NUMERIC_MAX_PRECISION); + { + Int4 dsp_size = QR_get_display_size(result, col); + if (dsp_size <= 0) + return default_column_size; + dsp_size *= 2; + if (dsp_size < 10) + dsp_size = 10; + return dsp_size; + } } @@ -665,7 +676,7 @@ getCharColumnSize(StatementClass *stmt, Int4 type, int col, int handle_unknown_s p = QR_get_display_size(result, col); /* longest */ attlen = QR_get_atttypmod(result, col); /* Size is unknown -- handle according to parameter */ - if (attlen > p) /* maybe the length is known */ + if (attlen >= p && attlen > 0) /* maybe the length is known */ return attlen; /* The type is really unknown */ diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h index 3cc09113f6..3a2d8c9cb0 100644 --- a/src/interfaces/odbc/psqlodbc.h +++ b/src/interfaces/odbc/psqlodbc.h @@ -5,7 +5,7 @@ * * Comments: See "notice.txt" for copyright and license information. * - * $Id: psqlodbc.h,v 1.64 2002/04/10 08:18:53 inoue Exp $ + * $Id: psqlodbc.h,v 1.65 2002/04/15 02:46:00 inoue Exp $ * */ @@ -87,7 +87,7 @@ typedef UInt4 Oid; #define DBMS_NAME "PostgreSQL" #endif /* ODBCVER */ -#define POSTGRESDRIVERVERSION "07.01.0011" +#define POSTGRESDRIVERVERSION "07.02.0001" #ifdef WIN32 #if (ODBCVER >= 0x0300) diff --git a/src/interfaces/odbc/psqlodbc.rc b/src/interfaces/odbc/psqlodbc.rc index 7c99c038e2..050b45d941 100644 --- a/src/interfaces/odbc/psqlodbc.rc +++ b/src/interfaces/odbc/psqlodbc.rc @@ -366,8 +366,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 7,1,0,11 - PRODUCTVERSION 7,1,0,11 + FILEVERSION 7,2,0,01 + PRODUCTVERSION 7,2,0,01 FILEFLAGSMASK 0x3L #ifdef _DEBUG FILEFLAGS 0x1L @@ -389,14 +389,14 @@ BEGIN VALUE "CompanyName", "Insight Distribution Systems\0" #endif VALUE "FileDescription", "PostgreSQL Driver\0" - VALUE "FileVersion", " 07.01.0011\0" + VALUE "FileVersion", " 07.02.0001\0" VALUE "InternalName", "psqlodbc\0" VALUE "LegalCopyright", "\0" VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation. Microsoft® is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0" VALUE "OriginalFilename", "psqlodbc.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "Microsoft Open Database Connectivity\0" - VALUE "ProductVersion", " 07.01.0011\0" + VALUE "ProductVersion", " 07.02.0001\0" VALUE "SpecialBuild", "\0" END END diff --git a/src/interfaces/odbc/psqlodbc.reg b/src/interfaces/odbc/psqlodbc.reg index ac4322f942..71155f50a1 100644 --- a/src/interfaces/odbc/psqlodbc.reg +++ b/src/interfaces/odbc/psqlodbc.reg @@ -14,4 +14,3 @@ REGEDIT4 "Setup"="PSQLODBC.DLL" "SQLLevel"="1" "UsageCount"=dword:00000001 - diff --git a/src/interfaces/odbc/psqlodbc30.reg b/src/interfaces/odbc/psqlodbc30.reg index 8746f361e9..79a63effff 100644 --- a/src/interfaces/odbc/psqlodbc30.reg +++ b/src/interfaces/odbc/psqlodbc30.reg @@ -3,9 +3,9 @@ REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI] [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers] -"PostgreSQL30"="Installed" +"PostgreSQL+ (Beta)"="Installed" -[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL30] +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL+ (Beta)] "APILevel"="1" "ConnectFunctions"="YYN" "Driver"="PSQLODBC30.DLL" @@ -14,4 +14,3 @@ REGEDIT4 "Setup"="PSQLODBC30.DLL" "SQLLevel"="1" "UsageCount"=dword:00000001 - diff --git a/src/interfaces/odbc/psqlodbc30w.reg b/src/interfaces/odbc/psqlodbc30w.reg index 81fd93e15c..ffeac51418 100644 --- a/src/interfaces/odbc/psqlodbc30w.reg +++ b/src/interfaces/odbc/psqlodbc30w.reg @@ -3,9 +3,9 @@ REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI] [HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers] -"PostgreSQL30W"="Installed" +"PostgreSQL+ Unicode (Beta)"="Installed" -[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL30W] +[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL+ Unicode (Beta)] "APILevel"="1" "ConnectFunctions"="YYN" "Driver"="PSQLODBC30W.DLL" -- 2.40.0