Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a1164a2

Browse files
author
Byron Nikolaidis
committed
Update 06-40-0003
1 parent dfa23f5 commit a1164a2

File tree

10 files changed

+116
-74
lines changed

10 files changed

+116
-74
lines changed

src/interfaces/odbc/convert.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ int lobj_fd, retval;
579579
return SQL_ERROR;
580580
}
581581

582-
583582
memset(&st, 0, sizeof(SIMPLE_TIME));
584583

585584
/* Initialize current date */
@@ -1141,7 +1140,7 @@ char *p;
11411140
for (i = 0; i < max; i++) {
11421141
if (si[i] == '\r' && i+1 < strlen(si) && si[i+1] == '\n')
11431142
continue;
1144-
if (si[i] == '\'')
1143+
else if (si[i] == '\'' || si[i] == '\\')
11451144
p[out++] = '\\';
11461145

11471146
p[out++] = si[i];

src/interfaces/odbc/dlg_specific.c

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ char buf[128];
248248
CheckDlgButton(hdlg, DS_PG62, 1);
249249
else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
250250
CheckDlgButton(hdlg, DS_PG63, 1);
251-
else
251+
else /* latest */
252252
CheckDlgButton(hdlg, DS_PG64, 1);
253253

254254

@@ -286,8 +286,8 @@ char buf[128];
286286
strcpy(ci->protocol, PG62);
287287
else if ( IsDlgButtonChecked(hdlg, DS_PG63))
288288
strcpy(ci->protocol, PG63);
289-
else
290-
ci->protocol[0] = '\0';
289+
else /* latest */
290+
strcpy(ci->protocol, PG64);
291291

292292
sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
293293

@@ -405,6 +405,9 @@ getDSNdefaults(ConnInfo *ci)
405405
if (ci->readonly[0] == '\0')
406406
sprintf(ci->readonly, "%d", globals.readonly);
407407

408+
if (ci->protocol[0] == '\0')
409+
strcpy(ci->protocol, globals.protocol);
410+
408411
if (ci->fake_oid_index[0] == '\0')
409412
sprintf(ci->fake_oid_index, "%d", DEFAULT_FAKEOIDINDEX);
410413

@@ -695,13 +698,6 @@ char temp[256];
695698
else if ( ! override)
696699
globals.cancel_as_freestmt = DEFAULT_CANCELASFREESTMT;
697700

698-
// Readonly is stored in the driver section AND per datasource
699-
SQLGetPrivateProfileString(section, INI_READONLY, "",
700-
temp, sizeof(temp), filename);
701-
if ( temp[0] )
702-
globals.readonly = atoi(temp);
703-
else if ( ! override)
704-
globals.readonly = DEFAULT_READONLY;
705701

706702

707703
// UseDeclareFetch is stored in the driver section only
@@ -772,6 +768,25 @@ char temp[256];
772768
SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "",
773769
globals.conn_settings, sizeof(globals.conn_settings), filename);
774770

771+
// Default state for future DSN's Readonly attribute
772+
SQLGetPrivateProfileString(section, INI_READONLY, "",
773+
temp, sizeof(temp), filename);
774+
if ( temp[0] )
775+
globals.readonly = atoi(temp);
776+
else
777+
globals.readonly = DEFAULT_READONLY;
778+
779+
/* Default state for future DSN's protocol attribute
780+
This isn't a real driver option YET. This is more
781+
intended for customization from the install.
782+
*/
783+
SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@",
784+
temp, sizeof(temp), filename);
785+
if ( strcmp(temp, "@@@" ))
786+
strcpy(globals.protocol, temp);
787+
else
788+
strcpy(globals.protocol, DEFAULT_PROTOCOL);
789+
775790
}
776791
}
777792

src/interfaces/odbc/dlg_specific.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
/* Connection Defaults */
9292
#define DEFAULT_PORT "5432"
9393
#define DEFAULT_READONLY 1
94+
#define DEFAULT_PROTOCOL "6.4" // the latest protocol is the default
9495
#define DEFAULT_USEDECLAREFETCH 0
9596
#define DEFAULT_TEXTASLONGVARCHAR 1
9697
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0

src/interfaces/odbc/drvconn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ static char *func = "SQLDriverConnect";
7979
ConnectionClass *conn = (ConnectionClass *) hdbc;
8080
ConnInfo *ci;
8181
#ifdef WIN32
82-
RETCODE dialog_result, result;
82+
RETCODE dialog_result;
8383
#endif
84+
RETCODE result;
8485
char connStrIn[MAX_CONNECT_STRING];
8586
char connStrOut[MAX_CONNECT_STRING];
8687
int retval;

src/interfaces/odbc/info.c

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -710,40 +710,6 @@ Int2 sqlType;
710710
}
711711
}
712712

713-
// cycle through the types
714-
// for(i=0, type = pgtypes_defined[0]; type; type = pgtypes_defined[++i]) {
715-
716-
// if(fSqlType == SQL_ALL_TYPES || fSqlType == pgtype_to_sqltype(stmt, type)) {
717-
718-
// row = (TupleNode *)malloc(sizeof(TupleNode) + (15 - 1)*sizeof(TupleField));
719-
720-
/* These values can't be NULL */
721-
/*
722-
set_tuplefield_string(&row->tuple[0], pgtype_to_name(stmt, type));
723-
set_tuplefield_int2(&row->tuple[1], pgtype_to_sqltype(stmt, type));
724-
set_tuplefield_int2(&row->tuple[6], pgtype_nullable(stmt, type));
725-
set_tuplefield_int2(&row->tuple[7], pgtype_case_sensitive(stmt, type));
726-
set_tuplefield_int2(&row->tuple[8], pgtype_searchable(stmt, type));
727-
set_tuplefield_int2(&row->tuple[10], pgtype_money(stmt, type));
728-
*/
729-
/* Localized data-source dependent data type name (always NULL) */
730-
// set_tuplefield_null(&row->tuple[12]);
731-
732-
/* These values can be NULL */
733-
/*
734-
set_nullfield_int4(&row->tuple[2], pgtype_precision(stmt, type, PG_STATIC, PG_STATIC));
735-
set_nullfield_string(&row->tuple[3], pgtype_literal_prefix(stmt, type));
736-
set_nullfield_string(&row->tuple[4], pgtype_literal_suffix(stmt, type));
737-
set_nullfield_string(&row->tuple[5], pgtype_create_params(stmt, type));
738-
set_nullfield_int2(&row->tuple[9], pgtype_unsigned(stmt, type));
739-
set_nullfield_int2(&row->tuple[11], pgtype_auto_increment(stmt, type));
740-
set_nullfield_int2(&row->tuple[13], pgtype_scale(stmt, type));
741-
set_nullfield_int2(&row->tuple[14], pgtype_scale(stmt, type));
742-
743-
QR_add_tuple(stmt->result, row);
744-
*/
745-
// }
746-
// }
747713

748714
stmt->status = STMT_FINISHED;
749715
stmt->currTuple = -1;

src/interfaces/odbc/pgtypes.c

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,13 @@ Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unkno
4444

4545
/* these are the types we support. all of the pgtype_ functions should */
4646
/* return values for each one of these. */
47+
/* Even types not directly supported are handled as character types
48+
so all types should work (points, etc.) */
4749

48-
/* NOTE: Even types not directly supported are handled as character types
49-
so all types should work (points, etc.) */
50-
50+
/* ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo. Instead, all
51+
the SQL TYPES are reported and mapped to a corresponding Postgres Type
52+
*/
53+
/*
5154
Int4 pgtypes_defined[] = {
5255
PG_TYPE_CHAR,
5356
PG_TYPE_CHAR2,
@@ -60,7 +63,7 @@ Int4 pgtypes_defined[] = {
6063
PG_TYPE_DATE,
6164
PG_TYPE_TIME,
6265
PG_TYPE_DATETIME,
63-
PG_TYPE_ABSTIME, /* a timestamp, sort of */
66+
PG_TYPE_ABSTIME,
6467
PG_TYPE_TIMESTAMP,
6568
PG_TYPE_TEXT,
6669
PG_TYPE_INT2,
@@ -73,11 +76,13 @@ Int4 pgtypes_defined[] = {
7376
PG_TYPE_BYTEA,
7477
PG_TYPE_LO,
7578
0 };
79+
*/
80+
7681

77-
/* These are the SQL Types reported in SQLGetTypeInfo. */
82+
/* These are NOW the SQL Types reported in SQLGetTypeInfo. */
7883
Int2 sqlTypes [] = {
7984
SQL_BIGINT,
80-
/* SQL_BINARY, */
85+
/* SQL_BINARY, -- Commented out because VarBinary is more correct. */
8186
SQL_BIT,
8287
SQL_CHAR,
8388
SQL_DATE,
@@ -201,8 +206,11 @@ Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type)
201206
case PG_TYPE_LO: return SQL_LONGVARBINARY;
202207

203208
case PG_TYPE_INT2: return SQL_SMALLINT;
209+
204210
case PG_TYPE_OID:
211+
case PG_TYPE_XID:
205212
case PG_TYPE_INT4: return SQL_INTEGER;
213+
206214
case PG_TYPE_FLOAT4: return SQL_REAL;
207215
case PG_TYPE_FLOAT8: return SQL_FLOAT;
208216
case PG_TYPE_DATE: return SQL_DATE;
@@ -230,6 +238,7 @@ Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type)
230238
switch(type) {
231239
case PG_TYPE_INT2: return SQL_C_SSHORT;
232240
case PG_TYPE_OID:
241+
case PG_TYPE_XID:
233242
case PG_TYPE_INT4: return SQL_C_SLONG;
234243
case PG_TYPE_FLOAT4: return SQL_C_FLOAT;
235244
case PG_TYPE_FLOAT8: return SQL_C_DOUBLE;
@@ -375,6 +384,7 @@ Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unkno
375384
case PG_TYPE_INT2: return 5;
376385

377386
case PG_TYPE_OID:
387+
case PG_TYPE_XID:
378388
case PG_TYPE_INT4: return 10;
379389

380390
case PG_TYPE_FLOAT4:
@@ -408,7 +418,8 @@ Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_un
408418
switch(type) {
409419
case PG_TYPE_INT2: return 6;
410420

411-
case PG_TYPE_OID: return 10;
421+
case PG_TYPE_OID:
422+
case PG_TYPE_XID: return 10;
412423

413424
case PG_TYPE_INT4: return 11;
414425

@@ -434,6 +445,7 @@ Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_
434445
case PG_TYPE_INT2: return 2;
435446

436447
case PG_TYPE_OID:
448+
case PG_TYPE_XID:
437449
case PG_TYPE_INT4: return 4;
438450

439451
case PG_TYPE_FLOAT4:
@@ -461,6 +473,7 @@ Int2 pgtype_scale(StatementClass *stmt, Int4 type)
461473

462474
case PG_TYPE_INT2:
463475
case PG_TYPE_OID:
476+
case PG_TYPE_XID:
464477
case PG_TYPE_INT4:
465478
case PG_TYPE_FLOAT4:
466479
case PG_TYPE_FLOAT8:
@@ -502,6 +515,7 @@ Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type)
502515

503516
case PG_TYPE_INT2:
504517
case PG_TYPE_OID:
518+
case PG_TYPE_XID:
505519
case PG_TYPE_INT4:
506520
case PG_TYPE_FLOAT4:
507521
case PG_TYPE_MONEY:
@@ -566,7 +580,8 @@ Int2 pgtype_searchable(StatementClass *stmt, Int4 type)
566580
Int2 pgtype_unsigned(StatementClass *stmt, Int4 type)
567581
{
568582
switch(type) {
569-
case PG_TYPE_OID: return TRUE;
583+
case PG_TYPE_OID:
584+
case PG_TYPE_XID: return TRUE;
570585

571586
case PG_TYPE_INT2:
572587
case PG_TYPE_INT4:
@@ -584,6 +599,7 @@ char *pgtype_literal_prefix(StatementClass *stmt, Int4 type)
584599

585600
case PG_TYPE_INT2:
586601
case PG_TYPE_OID:
602+
case PG_TYPE_XID:
587603
case PG_TYPE_INT4:
588604
case PG_TYPE_FLOAT4:
589605
case PG_TYPE_FLOAT8:
@@ -599,6 +615,7 @@ char *pgtype_literal_suffix(StatementClass *stmt, Int4 type)
599615

600616
case PG_TYPE_INT2:
601617
case PG_TYPE_OID:
618+
case PG_TYPE_XID:
602619
case PG_TYPE_INT4:
603620
case PG_TYPE_FLOAT4:
604621
case PG_TYPE_FLOAT8:

src/interfaces/odbc/pgtypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#define PG_TYPE_DATETIME 1184
6161
#define PG_TYPE_TIMESTAMP 1296
6262

63-
extern Int4 pgtypes_defined[];
63+
/* extern Int4 pgtypes_defined[]; */
6464
extern Int2 sqlTypes[];
6565

6666
/* Defines for pgtype_precision */

src/interfaces/odbc/psqlodbc.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ typedef UInt4 Oid;
3939

4040
#define DRIVERNAME "PostgreSQL ODBC"
4141
#define DBMS_NAME "PostgreSQL"
42-
#define DBMS_VERSION "06.40.0002 PostgreSQL 6.4"
43-
#define POSTGRESDRIVERVERSION "06.40.0002"
42+
#define DBMS_VERSION "06.40.0003 PostgreSQL 6.4"
43+
#define POSTGRESDRIVERVERSION "06.40.0003"
4444

4545
#ifdef WIN32
4646
#define DRIVER_FILE_NAME "PSQLODBC.DLL"
@@ -83,6 +83,7 @@ typedef UInt4 Oid;
8383

8484
#define PG62 "6.2" /* "Protocol" key setting to force Postgres 6.2 */
8585
#define PG63 "6.3" /* "Protocol" key setting to force postgres 6.3 */
86+
#define PG64 "6.4"
8687

8788
typedef struct ConnectionClass_ ConnectionClass;
8889
typedef struct StatementClass_ StatementClass;
@@ -121,6 +122,8 @@ typedef struct GlobalValues_
121122
char cancel_as_freestmt;
122123
char extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
123124
char conn_settings[LARGE_REGISTRY_LEN];
125+
char protocol[SMALL_REGISTRY_LEN];
126+
124127
FILE* mylogFP;
125128
FILE* qlogFP;
126129
} GLOBAL_VALUES;

src/interfaces/odbc/psqlodbc.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ END
204204
//
205205

206206
VS_VERSION_INFO VERSIONINFO
207-
FILEVERSION 6,40,0,2
208-
PRODUCTVERSION 6,40,0,2
207+
FILEVERSION 6,40,0,3
208+
PRODUCTVERSION 6,40,0,3
209209
FILEFLAGSMASK 0x3L
210210
#ifdef _DEBUG
211211
FILEFLAGS 0x1L
@@ -223,12 +223,12 @@ BEGIN
223223
VALUE "Comments", "PostgreSQL ODBC driver for Windows 95\0"
224224
VALUE "CompanyName", "Insight Distribution Systems\0"
225225
VALUE "FileDescription", "PostgreSQL Driver\0"
226-
VALUE "FileVersion", " 6.40.0002\0"
226+
VALUE "FileVersion", " 6.40.0003\0"
227227
VALUE "InternalName", "psqlodbc\0"
228228
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"
229229
VALUE "OriginalFilename", "psqlodbc.dll\0"
230230
VALUE "ProductName", "Microsoft Open Database Connectivity\0"
231-
VALUE "ProductVersion", " 6.40.0002\0"
231+
VALUE "ProductVersion", " 6.40.0003\0"
232232
END
233233
END
234234
BLOCK "VarFileInfo"

0 commit comments

Comments
 (0)