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

Commit e7ffdd4

Browse files
author
Hiroshi Inoue
committed
1) Decrease the size of some buffers.
2) Repair broken SQLStatistics().
1 parent 77f2775 commit e7ffdd4

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/interfaces/odbc/info.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ SQLTables(
11041104
HSTMT htbl_stmt;
11051105
RETCODE result;
11061106
char *tableType;
1107-
char tables_query[STD_STATEMENT_LEN];
1107+
char tables_query[INFO_INQUIRY_LEN];
11081108
char table_name[MAX_INFO_STRING],
11091109
table_owner[MAX_INFO_STRING],
11101110
relkind_or_hasrules[MAX_INFO_STRING];
@@ -1422,7 +1422,7 @@ SQLColumns(
14221422
TupleNode *row;
14231423
HSTMT hcol_stmt;
14241424
StatementClass *col_stmt;
1425-
char columns_query[STD_STATEMENT_LEN];
1425+
char columns_query[INFO_INQUIRY_LEN];
14261426
RETCODE result;
14271427
char table_owner[MAX_INFO_STRING],
14281428
table_name[MAX_INFO_STRING],
@@ -1862,7 +1862,7 @@ SQLSpecialColumns(
18621862
ConnInfo *ci;
18631863
HSTMT hcol_stmt;
18641864
StatementClass *col_stmt;
1865-
char columns_query[STD_STATEMENT_LEN];
1865+
char columns_query[INFO_INQUIRY_LEN];
18661866
RETCODE result;
18671867
char relhasrules[MAX_INFO_STRING];
18681868

@@ -2003,7 +2003,7 @@ SQLStatistics(
20032003
{
20042004
static char *func = "SQLStatistics";
20052005
StatementClass *stmt = (StatementClass *) hstmt;
2006-
char index_query[STD_STATEMENT_LEN];
2006+
char index_query[INFO_INQUIRY_LEN];
20072007
HSTMT hindx_stmt;
20082008
RETCODE result;
20092009
char *table_name;
@@ -2171,12 +2171,12 @@ SQLStatistics(
21712171
indx_stmt = (StatementClass *) hindx_stmt;
21722172

21732173
sprintf(index_query, "select c.relname, i.indkey, i.indisunique"
2174-
", x.indisclustered, a.amname, i.relhasrules"
2175-
" from pg_index x, pg_class i, pg_class c, pg_am a"
2176-
" where c.relname = '%s'"
2177-
" and c.oid = x.indrelid"
2178-
" and x.indexrelid = i.oid"
2179-
" and i.relam = a.oid"
2174+
", i.indisclustered, a.amname, c.relhasrules"
2175+
" from pg_index i, pg_class c, pg_class d, pg_am a"
2176+
" where d.relname = '%s'"
2177+
" and d.oid = i.indrelid"
2178+
" and i.indexrelid = c.oid"
2179+
" and c.relam = a.oid"
21802180
, table_name);
21812181

21822182
result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
@@ -2455,7 +2455,7 @@ SQLPrimaryKeys(
24552455
int seq = 0;
24562456
HSTMT htbl_stmt;
24572457
StatementClass *tbl_stmt;
2458-
char tables_query[STD_STATEMENT_LEN];
2458+
char tables_query[INFO_INQUIRY_LEN];
24592459
char attname[MAX_INFO_STRING];
24602460
SDWORD attname_len;
24612461
char pktab[MAX_TABLE_LEN + 1];
@@ -2641,7 +2641,7 @@ SQLForeignKeys(
26412641
StatementClass *tbl_stmt;
26422642
RETCODE result,
26432643
keyresult;
2644-
char tables_query[STD_STATEMENT_LEN];
2644+
char tables_query[INFO_INQUIRY_LEN];
26452645
char trig_deferrable[2];
26462646
char trig_initdeferred[2];
26472647
char trig_args[1024];

src/interfaces/odbc/psqlodbc.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Comments: See "notice.txt" for copyright and license information.
77
*
8-
* $Id: psqlodbc.h,v 1.42 2001/05/01 00:47:06 inoue Exp $
8+
* $Id: psqlodbc.h,v 1.43 2001/05/17 02:56:37 inoue Exp $
99
*
1010
*/
1111

@@ -191,6 +191,9 @@ typedef struct QueryInfo_
191191
#define PG_NUMERIC_MAX_PRECISION 1000
192192
#define PG_NUMERIC_MAX_SCALE 1000
193193

194+
#define INFO_INQUIRY_LEN 8192 /* this seems sufficiently big for
195+
queries used in info.c inoue 2001/05/17 */
196+
194197
#include "misc.h"
195198

196199
#endif

0 commit comments

Comments
 (0)