From e7ffdd4475533276dec64e24de78a2b0d89c5934 Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Thu, 17 May 2001 02:56:37 +0000 Subject: [PATCH] 1) Decrease the size of some buffers. 2) Repair broken SQLStatistics(). --- src/interfaces/odbc/info.c | 24 ++++++++++++------------ src/interfaces/odbc/psqlodbc.h | 5 ++++- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c index e393c5b069..5e3e980d9f 100644 --- a/src/interfaces/odbc/info.c +++ b/src/interfaces/odbc/info.c @@ -1104,7 +1104,7 @@ SQLTables( HSTMT htbl_stmt; RETCODE result; char *tableType; - char tables_query[STD_STATEMENT_LEN]; + char tables_query[INFO_INQUIRY_LEN]; char table_name[MAX_INFO_STRING], table_owner[MAX_INFO_STRING], relkind_or_hasrules[MAX_INFO_STRING]; @@ -1422,7 +1422,7 @@ SQLColumns( TupleNode *row; HSTMT hcol_stmt; StatementClass *col_stmt; - char columns_query[STD_STATEMENT_LEN]; + char columns_query[INFO_INQUIRY_LEN]; RETCODE result; char table_owner[MAX_INFO_STRING], table_name[MAX_INFO_STRING], @@ -1862,7 +1862,7 @@ SQLSpecialColumns( ConnInfo *ci; HSTMT hcol_stmt; StatementClass *col_stmt; - char columns_query[STD_STATEMENT_LEN]; + char columns_query[INFO_INQUIRY_LEN]; RETCODE result; char relhasrules[MAX_INFO_STRING]; @@ -2003,7 +2003,7 @@ SQLStatistics( { static char *func = "SQLStatistics"; StatementClass *stmt = (StatementClass *) hstmt; - char index_query[STD_STATEMENT_LEN]; + char index_query[INFO_INQUIRY_LEN]; HSTMT hindx_stmt; RETCODE result; char *table_name; @@ -2171,12 +2171,12 @@ SQLStatistics( indx_stmt = (StatementClass *) hindx_stmt; sprintf(index_query, "select c.relname, i.indkey, i.indisunique" - ", x.indisclustered, a.amname, i.relhasrules" - " from pg_index x, pg_class i, pg_class c, pg_am a" - " where c.relname = '%s'" - " and c.oid = x.indrelid" - " and x.indexrelid = i.oid" - " and i.relam = a.oid" + ", i.indisclustered, a.amname, c.relhasrules" + " from pg_index i, pg_class c, pg_class d, pg_am a" + " where d.relname = '%s'" + " and d.oid = i.indrelid" + " and i.indexrelid = c.oid" + " and c.relam = a.oid" , table_name); result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query)); @@ -2455,7 +2455,7 @@ SQLPrimaryKeys( int seq = 0; HSTMT htbl_stmt; StatementClass *tbl_stmt; - char tables_query[STD_STATEMENT_LEN]; + char tables_query[INFO_INQUIRY_LEN]; char attname[MAX_INFO_STRING]; SDWORD attname_len; char pktab[MAX_TABLE_LEN + 1]; @@ -2641,7 +2641,7 @@ SQLForeignKeys( StatementClass *tbl_stmt; RETCODE result, keyresult; - char tables_query[STD_STATEMENT_LEN]; + char tables_query[INFO_INQUIRY_LEN]; char trig_deferrable[2]; char trig_initdeferred[2]; char trig_args[1024]; diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h index 9d39fdc7ff..c14b32045b 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.42 2001/05/01 00:47:06 inoue Exp $ + * $Id: psqlodbc.h,v 1.43 2001/05/17 02:56:37 inoue Exp $ * */ @@ -191,6 +191,9 @@ typedef struct QueryInfo_ #define PG_NUMERIC_MAX_PRECISION 1000 #define PG_NUMERIC_MAX_SCALE 1000 +#define INFO_INQUIRY_LEN 8192 /* this seems sufficiently big for +queries used in info.c inoue 2001/05/17 */ + #include "misc.h" #endif -- 2.40.0