aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-01-25 03:28:27 +0000
committerBruce Momjian <bruce@momjian.us>2001-01-25 03:28:27 +0000
commit40203e4f3e65566fc268a26ad9d16f96328490eb (patch)
tree6e8361c6d0378fb9858bf2ea8f14f645a9ddb92b /src
parent0e968ee7055d8695a020c63e26581f39ef797246 (diff)
downloadpostgresql-40203e4f3e65566fc268a26ad9d16f96328490eb.tar.gz
postgresql-40203e4f3e65566fc268a26ad9d16f96328490eb.zip
Further to the previous ODBC patches I posted today, I found a couple of
problems with char array sizes having set a couple of constants to 0 for unlimited query length and row length. This additional patch cleans those problems up by defining a new constant (STD_STATEMENT_LEN) to 65536 and using that in place of MAX_STATEMENT_LEN. Another constant (MAX_MESSAGE_LEN) was defined as 2*BLCKSZ, but is now 65536. This is used to define the length of the message buffer in a number of places and as I understand it (probably not that well!) therefore also places a limit on the query length. Fixing this properly is beyond my capabilities but 65536 should hopefully be large enough for most people. Apologies for being over-enthusiastic and posting 3 patches in one day rather than 1 better tested one! Regards, Dave Page
Diffstat (limited to 'src')
-rw-r--r--src/interfaces/odbc/info.c14
-rw-r--r--src/interfaces/odbc/psqlodbc.h11
-rw-r--r--src/interfaces/odbc/statement.h2
3 files changed, 15 insertions, 12 deletions
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 78c3ace7237..52b64bef41c 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -350,7 +350,7 @@ RETCODE result;
case SQL_MAX_STATEMENT_LEN: /* ODBC 2.0 */
/* maybe this should be 0? */
len = 4;
- value = MAX_QUERY_SIZE;
+ value = MAX_STATEMENT_LEN;
break;
case SQL_MAX_TABLE_NAME_LEN: /* ODBC 1.0 */
@@ -916,7 +916,7 @@ TupleNode *row;
HSTMT htbl_stmt;
RETCODE result;
char *tableType;
-char tables_query[MAX_STATEMENT_LEN];
+char tables_query[STD_STATEMENT_LEN];
char table_name[MAX_INFO_STRING], table_owner[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
ConnInfo *ci;
char *prefix[32], prefixes[MEDIUM_REGISTRY_LEN];
@@ -1186,7 +1186,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
TupleNode *row;
HSTMT hcol_stmt;
StatementClass *col_stmt;
-char columns_query[MAX_STATEMENT_LEN];
+char columns_query[STD_STATEMENT_LEN];
RETCODE result;
char table_owner[MAX_INFO_STRING], table_name[MAX_INFO_STRING], field_name[MAX_INFO_STRING], field_type_name[MAX_INFO_STRING];
Int2 field_number, result_cols, scale;
@@ -1583,7 +1583,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
ConnInfo *ci;
HSTMT hcol_stmt;
StatementClass *col_stmt;
-char columns_query[MAX_STATEMENT_LEN];
+char columns_query[STD_STATEMENT_LEN];
RETCODE result;
char relhasrules[MAX_INFO_STRING];
@@ -1719,7 +1719,7 @@ RETCODE SQL_API SQLStatistics(
{
static char *func="SQLStatistics";
StatementClass *stmt = (StatementClass *) hstmt;
-char index_query[MAX_STATEMENT_LEN];
+char index_query[STD_STATEMENT_LEN];
HSTMT hindx_stmt;
RETCODE result;
char *table_name;
@@ -2095,7 +2095,7 @@ RETCODE result;
int seq = 0;
HSTMT htbl_stmt;
StatementClass *tbl_stmt;
-char tables_query[MAX_STATEMENT_LEN];
+char tables_query[STD_STATEMENT_LEN];
char attname[MAX_INFO_STRING];
SDWORD attname_len;
char pktab[MAX_TABLE_LEN + 1];
@@ -2262,7 +2262,7 @@ TupleNode *row;
HSTMT htbl_stmt, hpkey_stmt;
StatementClass *tbl_stmt;
RETCODE result, keyresult;
-char tables_query[MAX_STATEMENT_LEN];
+char tables_query[STD_STATEMENT_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 056e718d547..ee109aaf076 100644
--- a/src/interfaces/odbc/psqlodbc.h
+++ b/src/interfaces/odbc/psqlodbc.h
@@ -54,9 +54,8 @@ typedef UInt4 Oid;
#define BLCKSZ 4096
#endif
-#define MAX_ROW_SIZE 0 /* Unlimited rowsize with the Tuple Toaster */
-#define MAX_QUERY_SIZE 0 /* Unlimited query length from v7.0(?) */
-#define MAX_MESSAGE_LEN (2*BLCKSZ)
+#define MAX_MESSAGE_LEN 65536 /* This puts a limit on query size but I don't */
+ /* see an easy way round this - DJP 24-1-2001 */
#define MAX_CONNECT_STRING 4096
#define ERROR_MSG_LENGTH 4096
#define FETCH_MAX 100 /* default number of rows to cache for declare/fetch */
@@ -85,8 +84,12 @@ typedef UInt4 Oid;
#define MAX_INFO_STRING 128
#define MAX_KEYPARTS 20
#define MAX_KEYLEN 512 /* max key of the form "date+outlet+invoice" */
-#define MAX_STATEMENT_LEN MAX_MESSAGE_LEN
+#define MAX_ROW_SIZE 0 /* Unlimited rowsize with the Tuple Toaster */
+#define MAX_STATEMENT_LEN 0 /* Unlimited statement size with 7.0
+/* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
+/* Now that's 0, lets use this instead. DJP 24-1-2001 */
+#define STD_STATEMENT_LEN MAX_MESSAGE_LEN
#define PG62 "6.2" /* "Protocol" key setting to force Postgres 6.2 */
#define PG63 "6.3" /* "Protocol" key setting to force postgres 6.3 */
diff --git a/src/interfaces/odbc/statement.h b/src/interfaces/odbc/statement.h
index bd551d3ba79..ae2df856b25 100644
--- a/src/interfaces/odbc/statement.h
+++ b/src/interfaces/odbc/statement.h
@@ -184,7 +184,7 @@ struct StatementClass_ {
char cursor_name[MAX_CURSOR_LEN+1];
- char stmt_with_params[65536 /* MAX_STATEMENT_LEN */]; /* statement after parameter substitution */
+ char stmt_with_params[STD_STATEMENT_LEN]; /* statement after parameter substitution */
};