aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/odbc/convert.c3
-rw-r--r--src/interfaces/odbc/dlg_specific.c35
-rw-r--r--src/interfaces/odbc/dlg_specific.h1
-rw-r--r--src/interfaces/odbc/drvconn.c3
-rw-r--r--src/interfaces/odbc/info.c34
-rw-r--r--src/interfaces/odbc/pgtypes.c33
-rw-r--r--src/interfaces/odbc/pgtypes.h2
-rw-r--r--src/interfaces/odbc/psqlodbc.h7
-rw-r--r--src/interfaces/odbc/psqlodbc.rc8
-rw-r--r--src/interfaces/odbc/setup.rul64
10 files changed, 116 insertions, 74 deletions
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c
index 73e92e16c04..7fd1940b00f 100644
--- a/src/interfaces/odbc/convert.c
+++ b/src/interfaces/odbc/convert.c
@@ -579,7 +579,6 @@ int lobj_fd, retval;
return SQL_ERROR;
}
-
memset(&st, 0, sizeof(SIMPLE_TIME));
/* Initialize current date */
@@ -1141,7 +1140,7 @@ char *p;
for (i = 0; i < max; i++) {
if (si[i] == '\r' && i+1 < strlen(si) && si[i+1] == '\n')
continue;
- if (si[i] == '\'')
+ else if (si[i] == '\'' || si[i] == '\\')
p[out++] = '\\';
p[out++] = si[i];
diff --git a/src/interfaces/odbc/dlg_specific.c b/src/interfaces/odbc/dlg_specific.c
index ac83a2345f7..6e23bef3dfa 100644
--- a/src/interfaces/odbc/dlg_specific.c
+++ b/src/interfaces/odbc/dlg_specific.c
@@ -248,7 +248,7 @@ char buf[128];
CheckDlgButton(hdlg, DS_PG62, 1);
else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
CheckDlgButton(hdlg, DS_PG63, 1);
- else
+ else /* latest */
CheckDlgButton(hdlg, DS_PG64, 1);
@@ -286,8 +286,8 @@ char buf[128];
strcpy(ci->protocol, PG62);
else if ( IsDlgButtonChecked(hdlg, DS_PG63))
strcpy(ci->protocol, PG63);
- else
- ci->protocol[0] = '\0';
+ else /* latest */
+ strcpy(ci->protocol, PG64);
sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
@@ -405,6 +405,9 @@ getDSNdefaults(ConnInfo *ci)
if (ci->readonly[0] == '\0')
sprintf(ci->readonly, "%d", globals.readonly);
+ if (ci->protocol[0] == '\0')
+ strcpy(ci->protocol, globals.protocol);
+
if (ci->fake_oid_index[0] == '\0')
sprintf(ci->fake_oid_index, "%d", DEFAULT_FAKEOIDINDEX);
@@ -695,13 +698,6 @@ char temp[256];
else if ( ! override)
globals.cancel_as_freestmt = DEFAULT_CANCELASFREESTMT;
- // Readonly is stored in the driver section AND per datasource
- SQLGetPrivateProfileString(section, INI_READONLY, "",
- temp, sizeof(temp), filename);
- if ( temp[0] )
- globals.readonly = atoi(temp);
- else if ( ! override)
- globals.readonly = DEFAULT_READONLY;
// UseDeclareFetch is stored in the driver section only
@@ -772,6 +768,25 @@ char temp[256];
SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "",
globals.conn_settings, sizeof(globals.conn_settings), filename);
+ // Default state for future DSN's Readonly attribute
+ SQLGetPrivateProfileString(section, INI_READONLY, "",
+ temp, sizeof(temp), filename);
+ if ( temp[0] )
+ globals.readonly = atoi(temp);
+ else
+ globals.readonly = DEFAULT_READONLY;
+
+ /* Default state for future DSN's protocol attribute
+ This isn't a real driver option YET. This is more
+ intended for customization from the install.
+ */
+ SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@",
+ temp, sizeof(temp), filename);
+ if ( strcmp(temp, "@@@" ))
+ strcpy(globals.protocol, temp);
+ else
+ strcpy(globals.protocol, DEFAULT_PROTOCOL);
+
}
}
diff --git a/src/interfaces/odbc/dlg_specific.h b/src/interfaces/odbc/dlg_specific.h
index 02a77889967..7fff962a9fd 100644
--- a/src/interfaces/odbc/dlg_specific.h
+++ b/src/interfaces/odbc/dlg_specific.h
@@ -91,6 +91,7 @@
/* Connection Defaults */
#define DEFAULT_PORT "5432"
#define DEFAULT_READONLY 1
+#define DEFAULT_PROTOCOL "6.4" // the latest protocol is the default
#define DEFAULT_USEDECLAREFETCH 0
#define DEFAULT_TEXTASLONGVARCHAR 1
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0
diff --git a/src/interfaces/odbc/drvconn.c b/src/interfaces/odbc/drvconn.c
index cfb514c7fc5..c9a98cc037e 100644
--- a/src/interfaces/odbc/drvconn.c
+++ b/src/interfaces/odbc/drvconn.c
@@ -79,8 +79,9 @@ static char *func = "SQLDriverConnect";
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci;
#ifdef WIN32
-RETCODE dialog_result, result;
+RETCODE dialog_result;
#endif
+RETCODE result;
char connStrIn[MAX_CONNECT_STRING];
char connStrOut[MAX_CONNECT_STRING];
int retval;
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 888a46fbeda..9a001264e62 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -710,40 +710,6 @@ Int2 sqlType;
}
}
- // cycle through the types
-// for(i=0, type = pgtypes_defined[0]; type; type = pgtypes_defined[++i]) {
-
-// if(fSqlType == SQL_ALL_TYPES || fSqlType == pgtype_to_sqltype(stmt, type)) {
-
-// row = (TupleNode *)malloc(sizeof(TupleNode) + (15 - 1)*sizeof(TupleField));
-
- /* These values can't be NULL */
-/*
- set_tuplefield_string(&row->tuple[0], pgtype_to_name(stmt, type));
- set_tuplefield_int2(&row->tuple[1], pgtype_to_sqltype(stmt, type));
- set_tuplefield_int2(&row->tuple[6], pgtype_nullable(stmt, type));
- set_tuplefield_int2(&row->tuple[7], pgtype_case_sensitive(stmt, type));
- set_tuplefield_int2(&row->tuple[8], pgtype_searchable(stmt, type));
- set_tuplefield_int2(&row->tuple[10], pgtype_money(stmt, type));
-*/
- /* Localized data-source dependent data type name (always NULL) */
-// set_tuplefield_null(&row->tuple[12]);
-
- /* These values can be NULL */
-/*
- set_nullfield_int4(&row->tuple[2], pgtype_precision(stmt, type, PG_STATIC, PG_STATIC));
- set_nullfield_string(&row->tuple[3], pgtype_literal_prefix(stmt, type));
- set_nullfield_string(&row->tuple[4], pgtype_literal_suffix(stmt, type));
- set_nullfield_string(&row->tuple[5], pgtype_create_params(stmt, type));
- set_nullfield_int2(&row->tuple[9], pgtype_unsigned(stmt, type));
- set_nullfield_int2(&row->tuple[11], pgtype_auto_increment(stmt, type));
- set_nullfield_int2(&row->tuple[13], pgtype_scale(stmt, type));
- set_nullfield_int2(&row->tuple[14], pgtype_scale(stmt, type));
-
- QR_add_tuple(stmt->result, row);
-*/
-// }
-// }
stmt->status = STMT_FINISHED;
stmt->currTuple = -1;
diff --git a/src/interfaces/odbc/pgtypes.c b/src/interfaces/odbc/pgtypes.c
index 169f9346ca8..b3a9d94b1a6 100644
--- a/src/interfaces/odbc/pgtypes.c
+++ b/src/interfaces/odbc/pgtypes.c
@@ -44,10 +44,13 @@ Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unkno
/* these are the types we support. all of the pgtype_ functions should */
/* return values for each one of these. */
+/* Even types not directly supported are handled as character types
+ so all types should work (points, etc.) */
-/* NOTE: Even types not directly supported are handled as character types
- so all types should work (points, etc.) */
-
+/* ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo. Instead, all
+ the SQL TYPES are reported and mapped to a corresponding Postgres Type
+*/
+/*
Int4 pgtypes_defined[] = {
PG_TYPE_CHAR,
PG_TYPE_CHAR2,
@@ -60,7 +63,7 @@ Int4 pgtypes_defined[] = {
PG_TYPE_DATE,
PG_TYPE_TIME,
PG_TYPE_DATETIME,
- PG_TYPE_ABSTIME, /* a timestamp, sort of */
+ PG_TYPE_ABSTIME,
PG_TYPE_TIMESTAMP,
PG_TYPE_TEXT,
PG_TYPE_INT2,
@@ -73,11 +76,13 @@ Int4 pgtypes_defined[] = {
PG_TYPE_BYTEA,
PG_TYPE_LO,
0 };
+*/
+
-/* These are the SQL Types reported in SQLGetTypeInfo. */
+/* These are NOW the SQL Types reported in SQLGetTypeInfo. */
Int2 sqlTypes [] = {
SQL_BIGINT,
- /* SQL_BINARY, */
+ /* SQL_BINARY, -- Commented out because VarBinary is more correct. */
SQL_BIT,
SQL_CHAR,
SQL_DATE,
@@ -201,8 +206,11 @@ Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type)
case PG_TYPE_LO: return SQL_LONGVARBINARY;
case PG_TYPE_INT2: return SQL_SMALLINT;
+
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4: return SQL_INTEGER;
+
case PG_TYPE_FLOAT4: return SQL_REAL;
case PG_TYPE_FLOAT8: return SQL_FLOAT;
case PG_TYPE_DATE: return SQL_DATE;
@@ -230,6 +238,7 @@ Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type)
switch(type) {
case PG_TYPE_INT2: return SQL_C_SSHORT;
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4: return SQL_C_SLONG;
case PG_TYPE_FLOAT4: return SQL_C_FLOAT;
case PG_TYPE_FLOAT8: return SQL_C_DOUBLE;
@@ -375,6 +384,7 @@ Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unkno
case PG_TYPE_INT2: return 5;
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4: return 10;
case PG_TYPE_FLOAT4:
@@ -408,7 +418,8 @@ Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_un
switch(type) {
case PG_TYPE_INT2: return 6;
- case PG_TYPE_OID: return 10;
+ case PG_TYPE_OID:
+ case PG_TYPE_XID: return 10;
case PG_TYPE_INT4: return 11;
@@ -434,6 +445,7 @@ Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_
case PG_TYPE_INT2: return 2;
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4: return 4;
case PG_TYPE_FLOAT4:
@@ -461,6 +473,7 @@ Int2 pgtype_scale(StatementClass *stmt, Int4 type)
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT8:
@@ -502,6 +515,7 @@ Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type)
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_MONEY:
@@ -566,7 +580,8 @@ Int2 pgtype_searchable(StatementClass *stmt, Int4 type)
Int2 pgtype_unsigned(StatementClass *stmt, Int4 type)
{
switch(type) {
- case PG_TYPE_OID: return TRUE;
+ case PG_TYPE_OID:
+ case PG_TYPE_XID: return TRUE;
case PG_TYPE_INT2:
case PG_TYPE_INT4:
@@ -584,6 +599,7 @@ char *pgtype_literal_prefix(StatementClass *stmt, Int4 type)
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT8:
@@ -599,6 +615,7 @@ char *pgtype_literal_suffix(StatementClass *stmt, Int4 type)
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT8:
diff --git a/src/interfaces/odbc/pgtypes.h b/src/interfaces/odbc/pgtypes.h
index b1da5aa2538..3d97dec8c40 100644
--- a/src/interfaces/odbc/pgtypes.h
+++ b/src/interfaces/odbc/pgtypes.h
@@ -60,7 +60,7 @@
#define PG_TYPE_DATETIME 1184
#define PG_TYPE_TIMESTAMP 1296
-extern Int4 pgtypes_defined[];
+/* extern Int4 pgtypes_defined[]; */
extern Int2 sqlTypes[];
/* Defines for pgtype_precision */
diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h
index 7ca86920d9c..8fcae8020b7 100644
--- a/src/interfaces/odbc/psqlodbc.h
+++ b/src/interfaces/odbc/psqlodbc.h
@@ -39,8 +39,8 @@ typedef UInt4 Oid;
#define DRIVERNAME "PostgreSQL ODBC"
#define DBMS_NAME "PostgreSQL"
-#define DBMS_VERSION "06.40.0002 PostgreSQL 6.4"
-#define POSTGRESDRIVERVERSION "06.40.0002"
+#define DBMS_VERSION "06.40.0003 PostgreSQL 6.4"
+#define POSTGRESDRIVERVERSION "06.40.0003"
#ifdef WIN32
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
@@ -83,6 +83,7 @@ typedef UInt4 Oid;
#define PG62 "6.2" /* "Protocol" key setting to force Postgres 6.2 */
#define PG63 "6.3" /* "Protocol" key setting to force postgres 6.3 */
+#define PG64 "6.4"
typedef struct ConnectionClass_ ConnectionClass;
typedef struct StatementClass_ StatementClass;
@@ -121,6 +122,8 @@ typedef struct GlobalValues_
char cancel_as_freestmt;
char extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
char conn_settings[LARGE_REGISTRY_LEN];
+ char protocol[SMALL_REGISTRY_LEN];
+
FILE* mylogFP;
FILE* qlogFP;
} GLOBAL_VALUES;
diff --git a/src/interfaces/odbc/psqlodbc.rc b/src/interfaces/odbc/psqlodbc.rc
index b6874da6faa..fc22f3f371e 100644
--- a/src/interfaces/odbc/psqlodbc.rc
+++ b/src/interfaces/odbc/psqlodbc.rc
@@ -204,8 +204,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,40,0,2
- PRODUCTVERSION 6,40,0,2
+ FILEVERSION 6,40,0,3
+ PRODUCTVERSION 6,40,0,3
FILEFLAGSMASK 0x3L
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -223,12 +223,12 @@ BEGIN
VALUE "Comments", "PostgreSQL ODBC driver for Windows 95\0"
VALUE "CompanyName", "Insight Distribution Systems\0"
VALUE "FileDescription", "PostgreSQL Driver\0"
- VALUE "FileVersion", " 6.40.0002\0"
+ VALUE "FileVersion", " 6.40.0003\0"
VALUE "InternalName", "psqlodbc\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 "ProductName", "Microsoft Open Database Connectivity\0"
- VALUE "ProductVersion", " 6.40.0002\0"
+ VALUE "ProductVersion", " 6.40.0003\0"
END
END
BLOCK "VarFileInfo"
diff --git a/src/interfaces/odbc/setup.rul b/src/interfaces/odbc/setup.rul
index fe1e5cd3c32..a4f52a03f7e 100644
--- a/src/interfaces/odbc/setup.rul
+++ b/src/interfaces/odbc/setup.rul
@@ -1,9 +1,8 @@
/*
-# Insight Distribution Systems - System V - Oct 1997
-#ident "@(#)setup.rul 1.3 :/sccs/sql/odbc/s.setup.rul 11/13/97 12:18:11"
+# Insight Distribution Systems - System V - Apr 1998
+#ident "@(#)setup.rul 1.13 :/sccs/sql/odbc/s.setup.rul 1/6/99 14:47:48"
*/
-
/*----------------------------------------------------------------------------*\
*
* PostgreSQL ODBC Driver Installation Script for InstallShield
@@ -13,13 +12,15 @@
#define APP_NAME "PostgreSQL ODBC Driver"
#define DRIVER_NAME "PostgreSQL"
-#define DRIVER_FILE "PODBC32.DLL"
+#define DRIVER_FILE "PSQLODBC.DLL"
+#define OLD_DRIVER_FILE "PODBC32.DLL"
+#define OLD_DRIVER_FILE_RENAMED "podbc32_sav.dll"
#define COMPANY_NAME "Insight"
#define PRODUCT_NAME "PostgreSQL ODBC Driver"
-#define PRODUCT_VERSION "6.2"
-#define PRODUCT_KEY "PODBC32.DLL"
-#define UNINSTALL_KEY "PODBC32v6.2"
+#define PRODUCT_VERSION "6.3"
+#define PRODUCT_KEY "PSQLODBC.DLL"
+#define UNINSTALL_KEY "PSQLODBCv6.3"
#define ODBC_DM_KEY "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\SharedDLLs"
#define ODBC_COMP_KEY "\\SOFTWARE\\ODBC\\ODBCINST.INI"
@@ -36,10 +37,10 @@ declare
STRING svMainDirectory [_MAX_STRING], svGrp, svUninstLogFile, svPath;
STRING svValue, szName, szKey, szMessage;
STRING szMsg, szTmp, szTmp2, szFileSet, szProgram;
- NUMBER nResult, nvType, nvSize, nStartup, ComponentUsageCount;
+ NUMBER nResult, pos, nvType, nvSize, nStartup, ComponentUsageCount;
NUMBER nvDoNot, nvVersion, nvInstall, nCore, nDM;
- STRING dm, core, szFileName;
+ STRING dm, core, szFileName, svFileName;
NUMBER options, nvInfo, nvResult;
LONG lResult;
STRING svCompVersion, svFileVersion, svCompDate, svCompTime, svFileDate, svFileTime;
@@ -100,9 +101,10 @@ OptionsDlg:
Version:
CompressInfo("driver.z", DRIVER_FILE, COMP_INFO_VERSIONMS|COMP_INFO_VERSIONLS, nvInfo, svCompVersion);
- szFileName = WINSYSDIR ^ "PODBC32.DLL";
+ szFileName = WINSYSDIR ^ DRIVER_FILE;
nResult = VerGetFileVersion(szFileName, svFileVersion);
- // MessageBox("System file PODBC32.dll version is " + svFileVersion, INFORMATION);
+
+ // MessageBox("System file PSQLODBC.dll version is " + svFileVersion, INFORMATION);
lResult = VerCompare(svCompVersion, svFileVersion, VERSION);
@@ -186,7 +188,7 @@ FileSetup:
// Show the uninstall under Add/Remove Programs in Control Panel
RegDBSetItem(REGDB_UNINSTALL_NAME, PRODUCT_NAME);
- szFileSet = "podbc32";
+ szFileSet = "psqlodbc";
TARGETDIR = svMainDirectory; // winsys
@@ -375,6 +377,44 @@ UpdateRegistry:
exit;
endif;
+ pos = StrFind(CMDLINE, "UseDeclareFetch=");
+ if (pos >= 0) then
+ StrSub(svValue, CMDLINE, pos + 16, 1);
+ nResult = RegDBSetKeyValueEx(szKey, "UseDeclareFetch", REGDB_STRING, svValue, -1);
+ if (nResult < 0) then
+ MessageBeep(0);
+ MessageBox("Unable to create 'UseDeclareFetch' key value.", SEVERE);
+ exit;
+ endif;
+ endif;
+
+ pos = StrFind(CMDLINE, "Protocol=");
+ if (pos >= 0) then
+ StrSub(svValue, CMDLINE, pos + 9, 3);
+ nResult = RegDBSetKeyValueEx(szKey, "Protocol", REGDB_STRING, svValue, -1);
+ if (nResult < 0) then
+ MessageBeep(0);
+ MessageBox("Unable to create 'Protocol' key value.", SEVERE);
+ exit;
+ endif;
+ endif;
+
+RenameOld:
+ if (FindFile(WINSYSDIR, OLD_DRIVER_FILE, svFileName) = 0) then
+ szMessage = "Renaming old driver to " + OLD_DRIVER_FILE_RENAMED + " ...";
+ SetStatusWindow(98, szMessage);
+ Delay(1);
+
+ Disable(LOGGING);
+
+ SRCDIR= WINSYSDIR;
+ TARGETDIR = WINSYSDIR;
+
+ RenameFile(OLD_DRIVER_FILE, OLD_DRIVER_FILE_RENAMED);
+
+ Enable(LOGGING);
+ endif;
+
Done:
Delay(1);
SetStatusWindow(100, "Installation complete");