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

Commit0e708e5

Browse files
author
Byron Nikolaidis
committed
Update driver to official 6.30.0244 release.
1 parent556e603 commit0e708e5

File tree

11 files changed

+533
-194
lines changed

11 files changed

+533
-194
lines changed

‎src/interfaces/odbc/bind.c

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
200200

201201
// - - - - - - - - -
202202

203-
// Returns the description of a parameter marker.
203+
// Returns the description of a parameter marker.
204+
//This function is listed as not being supported by SQLGetFunctions() because it is
205+
//used to describe "parameter markers" (not bound parameters), in which case,
206+
//the dbms should return info on the markers. Since Postgres doesn't support that,
207+
//it is best to say this function is not supported and let the application assume a
208+
//data type (most likely varchar).
204209

205210
RETCODESQL_APISQLDescribeParam(
206211
HSTMThstmt,
@@ -223,6 +228,8 @@ StatementClass *stmt = (StatementClass *) hstmt;
223228

224229
ipar--;
225230

231+
//This implementation is not very good, since it is supposed to describe
232+
//parameter markers, not bound parameters.
226233
if(pfSqlType)
227234
*pfSqlType=stmt->parameters[ipar].SQLType;
228235

@@ -252,25 +259,50 @@ RETCODE SQL_API SQLParamOptions(
252259

253260
// - - - - - - - - -
254261

255-
// Returns the number of parameters in an SQL statement
256-
262+
//This function should really talk to the dbms to determine the number of
263+
//"parameter markers" (not bound parameters) in the statement. But, since
264+
//Postgres doesn't support that, the driver should just count the number of markers
265+
//and return that. The reason the driver just can't say this function is unsupported
266+
//like it does for SQLDescribeParam is that some applications don't care and try
267+
//to call it anyway.
268+
//If the statement does not have parameters, it should just return 0.
257269
RETCODESQL_APISQLNumParams(
258270
HSTMThstmt,
259271
SWORDFAR*pcpar)
260272
{
261273
StatementClass*stmt= (StatementClass*)hstmt;
274+
charin_quote= FALSE;
275+
unsignedinti;
262276

263277

264278
if(!stmt)
265279
returnSQL_INVALID_HANDLE;
266280

267-
//If the statement does not have parameters, it should just return 0.
281+
if (pcpar)
282+
*pcpar=0;
283+
else
284+
returnSQL_ERROR;
268285

269-
if (pcpar) {
270-
*pcpar=stmt->parameters_allocated;
271-
}
272286

273-
returnSQL_SUCCESS;
287+
if(!stmt->statement) {
288+
// no statement has been allocated
289+
stmt->errormsg="SQLNumParams called with no statement ready.";
290+
stmt->errornumber=STMT_SEQUENCE_ERROR;
291+
returnSQL_ERROR;
292+
}else {
293+
294+
for(i=0;i<strlen(stmt->statement);i++) {
295+
296+
if(stmt->statement[i]=='?'&& !in_quote)
297+
(*pcpar)++;
298+
else {
299+
if (stmt->statement[i]=='\'')
300+
in_quote= (in_quote ? FALSE : TRUE);
301+
}
302+
}
303+
304+
returnSQL_SUCCESS;
305+
}
274306
}
275307

276308
/********************************************************************

‎src/interfaces/odbc/convert.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,12 @@ struct tm *tim;
365365
//truncate the data.
366366
// return COPY_RESULT_TRUNCATED;
367367

368-
*pcbValue=cbValueMax-1;
368+
//LongVarBinary types do handle truncated multiple get calls
369+
//through convert_lo().
370+
371+
if (pcbValue)
372+
*pcbValue=cbValueMax-1;
373+
369374
returnCOPY_OK;
370375

371376
}else {

‎src/interfaces/odbc/dlg_specific.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,15 @@ char temp[128];
623623
globals.unknown_sizes=atoi(temp);
624624

625625

626+
//Lie about supported functions?
627+
SQLGetPrivateProfileString(DBMS_NAME,INI_LIE,"",
628+
temp,sizeof(temp),ODBCINST_INI);
629+
if (temp[0]=='\0')
630+
globals.lie=DEFAULT_LIE;
631+
else
632+
globals.lie=atoi(temp);
633+
634+
626635
//Readonly is stored in the driver section AND per datasource
627636
SQLGetPrivateProfileString(DBMS_NAME,INI_READONLY,"",
628637
temp,sizeof(temp),ODBCINST_INI);

‎src/interfaces/odbc/dlg_specific.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#defineINI_FAKEOIDINDEX"FakeOidIndex"
5757
#defineINI_SHOWOIDCOLUMN"ShowOidColumn"
5858
#defineINI_SHOWSYSTEMTABLES"ShowSystemTables"
59+
#defineINI_LIE"Lie"
5960
#defineINI_EXTRASYSTABLEPREFIXES"ExtraSysTablePrefixes"
6061

6162
/*Connection Defaults */
@@ -74,6 +75,7 @@
7475
#defineDEFAULT_FAKEOIDINDEX0
7576
#defineDEFAULT_SHOWOIDCOLUMN0
7677
#defineDEFAULT_SHOWSYSTEMTABLES0// dont show system tables
78+
#defineDEFAULT_LIE0
7779

7880
#defineDEFAULT_EXTRASYSTABLEPREFIXES"dd_;"
7981

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp