return SQL_ERROR;
}
-
memset(&st, 0, sizeof(SIMPLE_TIME));
/* Initialize current date */
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];
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);
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));
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);
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
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);
+
}
}
/* 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
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;
}
}
- // 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;
/* 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,
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,
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,
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;
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;
case PG_TYPE_INT2: return 5;
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4: return 10;
case PG_TYPE_FLOAT4:
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;
case PG_TYPE_INT2: return 2;
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4: return 4;
case PG_TYPE_FLOAT4:
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT8:
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_MONEY:
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:
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT8:
case PG_TYPE_INT2:
case PG_TYPE_OID:
+ case PG_TYPE_XID:
case PG_TYPE_INT4:
case PG_TYPE_FLOAT4:
case PG_TYPE_FLOAT8:
#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 */
#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"
#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;
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;
//
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
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"
/*
-# 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
#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"
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;
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);
// Show the uninstall under Add/Remove Programs in Control Panel
RegDBSetItem(REGDB_UNINSTALL_NAME, PRODUCT_NAME);
- szFileSet = "podbc32";
+ szFileSet = "psqlodbc";
TARGETDIR = svMainDirectory; // winsys
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");