Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit40203e4

Browse files
committed
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 forunlimited query length and row length. This additional patch cleans thoseproblems up by defining a new constant (STD_STATEMENT_LEN) to 65536 andusing that in place of MAX_STATEMENT_LEN.Another constant (MAX_MESSAGE_LEN) was defined as 2*BLCKSZ, but is now65536. This is used to define the length of the message buffer in a numberof places and as I understand it (probably not that well!) therefore alsoplaces a limit on the query length. Fixing this properly is beyond mycapabilities but 65536 should hopefully be large enough for most people.Apologies for being over-enthusiastic and posting 3 patches in one dayrather than 1 better tested one!Regards,Dave Page
1 parent0e968ee commit40203e4

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

‎src/interfaces/odbc/info.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ RETCODE result;
350350
caseSQL_MAX_STATEMENT_LEN:/* ODBC 2.0 */
351351
/* maybe this should be 0? */
352352
len=4;
353-
value=MAX_QUERY_SIZE;
353+
value=MAX_STATEMENT_LEN;
354354
break;
355355

356356
caseSQL_MAX_TABLE_NAME_LEN:/* ODBC 1.0 */
@@ -916,7 +916,7 @@ TupleNode *row;
916916
HSTMThtbl_stmt;
917917
RETCODEresult;
918918
char*tableType;
919-
chartables_query[MAX_STATEMENT_LEN];
919+
chartables_query[STD_STATEMENT_LEN];
920920
chartable_name[MAX_INFO_STRING],table_owner[MAX_INFO_STRING],relhasrules[MAX_INFO_STRING];
921921
ConnInfo*ci;
922922
char*prefix[32],prefixes[MEDIUM_REGISTRY_LEN];
@@ -1186,7 +1186,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
11861186
TupleNode*row;
11871187
HSTMThcol_stmt;
11881188
StatementClass*col_stmt;
1189-
charcolumns_query[MAX_STATEMENT_LEN];
1189+
charcolumns_query[STD_STATEMENT_LEN];
11901190
RETCODEresult;
11911191
chartable_owner[MAX_INFO_STRING],table_name[MAX_INFO_STRING],field_name[MAX_INFO_STRING],field_type_name[MAX_INFO_STRING];
11921192
Int2field_number,result_cols,scale;
@@ -1583,7 +1583,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
15831583
ConnInfo*ci;
15841584
HSTMThcol_stmt;
15851585
StatementClass*col_stmt;
1586-
charcolumns_query[MAX_STATEMENT_LEN];
1586+
charcolumns_query[STD_STATEMENT_LEN];
15871587
RETCODEresult;
15881588
charrelhasrules[MAX_INFO_STRING];
15891589

@@ -1719,7 +1719,7 @@ RETCODE SQL_API SQLStatistics(
17191719
{
17201720
staticchar*func="SQLStatistics";
17211721
StatementClass*stmt= (StatementClass*)hstmt;
1722-
charindex_query[MAX_STATEMENT_LEN];
1722+
charindex_query[STD_STATEMENT_LEN];
17231723
HSTMThindx_stmt;
17241724
RETCODEresult;
17251725
char*table_name;
@@ -2095,7 +2095,7 @@ RETCODE result;
20952095
intseq=0;
20962096
HSTMThtbl_stmt;
20972097
StatementClass*tbl_stmt;
2098-
chartables_query[MAX_STATEMENT_LEN];
2098+
chartables_query[STD_STATEMENT_LEN];
20992099
charattname[MAX_INFO_STRING];
21002100
SDWORDattname_len;
21012101
charpktab[MAX_TABLE_LEN+1];
@@ -2262,7 +2262,7 @@ TupleNode *row;
22622262
HSTMThtbl_stmt,hpkey_stmt;
22632263
StatementClass*tbl_stmt;
22642264
RETCODEresult,keyresult;
2265-
chartables_query[MAX_STATEMENT_LEN];
2265+
chartables_query[STD_STATEMENT_LEN];
22662266
chartrig_deferrable[2];
22672267
chartrig_initdeferred[2];
22682268
chartrig_args[1024];

‎src/interfaces/odbc/psqlodbc.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ typedef UInt4 Oid;
5454
#defineBLCKSZ 4096
5555
#endif
5656

57-
#defineMAX_ROW_SIZE0/* Unlimited rowsize with the Tuple Toaster */
58-
#defineMAX_QUERY_SIZE0/* Unlimited query length from v7.0(?) */
59-
#defineMAX_MESSAGE_LEN(2*BLCKSZ)
57+
#defineMAX_MESSAGE_LEN65536/* This puts a limit on query size but I don't */
58+
/* see an easy way round this - DJP 24-1-2001 */
6059
#defineMAX_CONNECT_STRING4096
6160
#defineERROR_MSG_LENGTH4096
6261
#defineFETCH_MAX100/* default number of rows to cache for declare/fetch */
@@ -85,8 +84,12 @@ typedef UInt4 Oid;
8584
#defineMAX_INFO_STRING128
8685
#defineMAX_KEYPARTS20
8786
#defineMAX_KEYLEN512/*max key of the form "date+outlet+invoice" */
88-
#defineMAX_STATEMENT_LENMAX_MESSAGE_LEN
87+
#defineMAX_ROW_SIZE0/* Unlimited rowsize with the Tuple Toaster */
88+
#defineMAX_STATEMENT_LEN0/* Unlimited statement size with 7.0
8989
90+
/* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
91+
/* Now that's 0, lets use this instead. DJP 24-1-2001 */
92+
#defineSTD_STATEMENT_LENMAX_MESSAGE_LEN
9093

9194
#definePG62"6.2"/* "Protocol" key setting to force Postgres 6.2 */
9295
#definePG63"6.3"/* "Protocol" key setting to force postgres 6.3 */

‎src/interfaces/odbc/statement.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ struct StatementClass_ {
184184

185185
charcursor_name[MAX_CURSOR_LEN+1];
186186

187-
charstmt_with_params[65536/* MAX_STATEMENT_LEN */];/* statement after parameter substitution */
187+
charstmt_with_params[STD_STATEMENT_LEN];/* statement after parameter substitution */
188188

189189
};
190190

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp