diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-01-26 22:41:59 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-01-26 22:41:59 +0000 |
commit | 5a832218fd24e659826a8e5ca6cdafbdba1dde4b (patch) | |
tree | b6141aa4086978d09e5982e0d868b2d2b4ef356d /src/interfaces/odbc/info.c | |
parent | 7edafafd731c36466daf99440882ae9225a141f1 (diff) |
odbc1.diff changes the text on the Protocol Radio buttons on the driver
dialogue from '6.4/6.5' to '6.5+' and removes some C++ comments from
resource.h (which VC++ insists on putting there).
odbc2.diff adds code to query the PostgreSQL version upon connection. This
is then used to determine what values to return for from SQLGetInfo for
SQL_DBMS_VER, SQL_MAX_ROW_SIZE, SQL_MAX_STATEMENT_LEN, SQL_OJ_CAPABILITIES
and SQL_OUTER_JOINS. The version string as returned by SELECT vERSION() (as
a char array) and the major.minor version number (as a flost) have been
added to the ConnectionClass structure.
Dave Page
Diffstat (limited to 'src/interfaces/odbc/info.c')
-rw-r--r-- | src/interfaces/odbc/info.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c index 52b64bef41c..681c72759d0 100644 --- a/src/interfaces/odbc/info.c +++ b/src/interfaces/odbc/info.c @@ -191,7 +191,11 @@ RETCODE result; break; case SQL_DBMS_VER: /* ODBC 1.0 */ - p = DBMS_VERSION; + /* The ODBC spec wants ##.##.#### ...whatever... so prepend the driver */ + /* version number to the dbms version string */ + p = POSTGRESDRIVERVERSION; + strcat(p, " "); + strcat(p, conn->pg_version); break; case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */ @@ -337,7 +341,11 @@ RETCODE result; case SQL_MAX_ROW_SIZE: /* ODBC 2.0 */ len = 4; - value = MAX_ROW_SIZE; + if (conn->pg_version_number >= (float) 7.1) { /* Large Rowa in 7.1+ */ + value = MAX_ROW_SIZE; + } else { /* Without the Toaster we're limited to the blocksize */ + value = BLCKSZ; + } break; case SQL_MAX_ROW_SIZE_INCLUDES_LONG: /* ODBC 2.0 */ @@ -350,7 +358,11 @@ RETCODE result; case SQL_MAX_STATEMENT_LEN: /* ODBC 2.0 */ /* maybe this should be 0? */ len = 4; - value = MAX_STATEMENT_LEN; + if (conn->pg_version_number >= (float) 7.0) { /* Long Queries in 7.0+ */ + value = MAX_STATEMENT_LEN; + } else { /* Prior to 7.0 we used 2*BLCKSZ */ + value = (2*BLCKSZ); + } break; case SQL_MAX_TABLE_NAME_LEN: /* ODBC 1.0 */ @@ -419,13 +431,17 @@ RETCODE result; case SQL_OJ_CAPABILITIES: /* ODBC 2.01 */ len = 4; - value = (SQL_OJ_LEFT | - SQL_OJ_RIGHT | - SQL_OJ_FULL | - SQL_OJ_NESTED | - SQL_OJ_NOT_ORDERED | - SQL_OJ_INNER | - SQL_OJ_ALL_COMPARISON_OPS); + if (conn->pg_version_number >= (float) 7.1) { /* OJs in 7.1+ */ + value = (SQL_OJ_LEFT | + SQL_OJ_RIGHT | + SQL_OJ_FULL | + SQL_OJ_NESTED | + SQL_OJ_NOT_ORDERED | + SQL_OJ_INNER | + SQL_OJ_ALL_COMPARISON_OPS); + } else { /* OJs not in <7.1 */ + value = 0; + } break; case SQL_ORDER_BY_COLUMNS_IN_SELECT: /* ODBC 2.0 */ @@ -433,7 +449,11 @@ RETCODE result; break; case SQL_OUTER_JOINS: /* ODBC 1.0 */ - p = "Y"; + if (conn->pg_version_number >= (float) 7.1) { /* OJs in 7.1+ */ + p = "Y"; + } else { /* OJs not in <7.1 */ + p = "N"; + } break; case SQL_OWNER_TERM: /* ODBC 1.0 */ |