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

Commit58df3f7

Browse files
author
Hiroshi Inoue
committed
1) Improve literal handling in parse_statement().
2) Remove some no longer valid comments.3) Fix an option dialog setting bug.4) Fix ODBCVER handling errors.
1 parentffba91c commit58df3f7

File tree

7 files changed

+45
-37
lines changed

7 files changed

+45
-37
lines changed

‎src/interfaces/odbc/dlg_specific.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,18 @@ updateCommons(const ConnInfo *ci)
439439
INI_KSQO,tmp,fileName);
440440

441441
/*
442-
* Never update the onlyread, unique_index from this module
443-
* sprintf(tmp, "%d", comval->unique_index);
444-
* SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp,
445-
* fileName);
446-
*
447-
* sprintf(tmp, "%d", comval->onlyread);
448-
* SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
449-
* fileName);
442+
* Never update the onlyread, unique_index from this module.
450443
*/
444+
if (!ci)
445+
{
446+
sprintf(tmp,"%d",comval->unique_index);
447+
SQLWritePrivateProfileString(sectionName,INI_UNIQUEINDEX,tmp,
448+
fileName);
449+
450+
sprintf(tmp,"%d",comval->onlyread);
451+
SQLWritePrivateProfileString(sectionName,INI_READONLY,tmp,
452+
fileName);
453+
}
451454

452455
sprintf(tmp,"%d",comval->use_declarefetch);
453456
SQLWritePrivateProfileString(sectionName,

‎src/interfaces/odbc/dlg_specific.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494
/*Connection Defaults */
9595
#defineDEFAULT_PORT"5432"
96-
#defineDEFAULT_READONLY1
96+
#defineDEFAULT_READONLY0
9797
#defineDEFAULT_PROTOCOL"6.4"/* the latest protocol is
9898
* the default */
9999
#defineDEFAULT_USEDECLAREFETCH0
@@ -102,7 +102,7 @@
102102
#defineDEFAULT_BOOLSASCHAR1
103103
#defineDEFAULT_OPTIMIZER1/* disable */
104104
#defineDEFAULT_KSQO1/* on */
105-
#defineDEFAULT_UNIQUEINDEX0/* dont recognize */
105+
#defineDEFAULT_UNIQUEINDEX1/* dont recognize */
106106
#defineDEFAULT_COMMLOG0/* dont log */
107107
#defineDEFAULT_DEBUG0
108108
#defineDEFAULT_UNKNOWNSIZESUNKNOWNS_AS_MAX

‎src/interfaces/odbc/odbcapi.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
*-------
2727
*/
2828

29-
#ifdefWIN32
30-
#defineODBCVER_REP 0x3000
31-
#endif
3229
#include"psqlodbc.h"
3330
#include<stdio.h>
3431
#include<string.h>
@@ -200,7 +197,7 @@ SQLFetch(HSTMT StatementHandle)
200197
{
201198
staticchar*func="SQLFetch";
202199

203-
#if (ODBCVER >=0x3000)
200+
#if (ODBCVER >=0x0300)
204201
StatementClass*stmt= (StatementClass*)StatementHandle;
205202
ConnectionClass*conn=SC_get_conn(stmt);
206203

@@ -273,7 +270,7 @@ SQLGetFunctions(HDBC ConnectionHandle,
273270
SQLUSMALLINTFunctionId,SQLUSMALLINT*Supported)
274271
{
275272
mylog("[SQLGetFunctions]");
276-
#if (ODBCVER >=0x3000)
273+
#if (ODBCVER >=0x0300)
277274
if (FunctionId==SQL_API_ODBC3_ALL_FUNCTIONS)
278275
returnPGAPI_GetFunctions30(ConnectionHandle,FunctionId,Supported);
279276
#endif
@@ -284,14 +281,14 @@ SQLGetInfo(HDBC ConnectionHandle,
284281
SQLUSMALLINTInfoType,PTRInfoValue,
285282
SQLSMALLINTBufferLength,SQLSMALLINT*StringLength)
286283
{
287-
#if (ODBCVER >=0x3000)
284+
#if (ODBCVER >=0x0300)
288285
RETCODEret;
289286

290287
mylog("[SQLGetInfo(30)]");
291288
if ((ret=PGAPI_GetInfo(ConnectionHandle,InfoType,InfoValue,
292289
BufferLength,StringLength))==SQL_ERROR)
293290
{
294-
if (((ConnectionClass*)ConnectionHandle)->driver_version >=0x3000)
291+
if (((ConnectionClass*)ConnectionHandle)->driver_version >=0x0300)
295292
returnPGAPI_GetInfo30(ConnectionHandle,InfoType,InfoValue,
296293
BufferLength,StringLength);
297294
}

‎src/interfaces/odbc/odbcapi30.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
*-------
1919
*/
2020

21+
#ifndefODBCVER_REP
2122
#defineODBCVER_REP 0x0300
23+
#endif
2224
#include"psqlodbc.h"
2325
#include<stdio.h>
2426
#include<string.h>
@@ -532,7 +534,7 @@ PGAPI_GetFunctions30(HDBC hdbc, UWORD fFunction, UWORD FAR * pfExists)
532534
{
533535
if (fFunction!=SQL_API_ODBC3_ALL_FUNCTIONS)
534536
returnSQL_ERROR;
535-
memset(pfExists,0,sizeof(UWORD)*250);
537+
memset(pfExists,0,sizeof(UWORD)*SQL_API_ODBC3_ALL_FUNCTIONS_SIZE);
536538

537539
/* SQL_FUNC_ESET(pfExists, SQL_API_SQLALLOCCONNECT); 1 deprecated */
538540
/* SQL_FUNC_ESET(pfExists, SQL_API_SQLALLOCENV); 2 deprecated */

‎src/interfaces/odbc/options.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ set_statement_option(ConnectionClass *conn,
178178
/* "0" returned in SQLGetStmtOption */
179179
break;
180180

181-
caseSQL_RETRIEVE_DATA:/* ignored, but saved */
181+
caseSQL_RETRIEVE_DATA:
182182
mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n",vParam);
183183
if (conn)
184184
conn->stmtOptions.retrieve_data=vParam;
@@ -636,7 +636,7 @@ PGAPI_GetStmtOption(
636636
*((SDWORD*)pvParam)=0;
637637
break;
638638

639-
caseSQL_RETRIEVE_DATA:/* NOT SUPPORTED, but saved */
639+
caseSQL_RETRIEVE_DATA:
640640
*((SDWORD*)pvParam)=stmt->options.retrieve_data;
641641
break;
642642

‎src/interfaces/odbc/parse.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -378,18 +378,19 @@ parse_statement(StatementClass *stmt)
378378
{
379379
/* just eat the expression */
380380
mylog("in_expr=%d or func=%d\n",in_expr,in_func);
381-
if (!unquoted)
382-
continue;
383381

384-
if (token[0]=='(')
385-
{
386-
blevel++;
387-
mylog("blevel++ = %d\n",blevel);
388-
}
389-
elseif (token[0]==')')
382+
if (unquoted)
390383
{
391-
blevel--;
392-
mylog("blevel-- = %d\n",blevel);
384+
if (token[0]=='(')
385+
{
386+
blevel++;
387+
mylog("blevel++ = %d\n",blevel);
388+
}
389+
elseif (token[0]==')')
390+
{
391+
blevel--;
392+
mylog("blevel-- = %d\n",blevel);
393+
}
393394
}
394395
if (blevel==0)
395396
{
@@ -400,7 +401,7 @@ parse_statement(StatementClass *stmt)
400401
in_expr= FALSE;
401402
in_field= FALSE;
402403
}
403-
elseif (!stricmp(token,"as"))
404+
elseif (unquoted&&!stricmp(token,"as"))
404405
{
405406
mylog("got AS in_expr\n");
406407
in_func= FALSE;
@@ -474,9 +475,8 @@ parse_statement(StatementClass *stmt)
474475

475476
if (quote)
476477
{
477-
fi[stmt->nfld++]->quote= TRUE;
478-
in_expr= TRUE;
479-
continue;
478+
fi[stmt->nfld]->quote= TRUE;
479+
fi[stmt->nfld]->precision=strlen(token);
480480
}
481481
elseif (numeric)
482482
{
@@ -573,6 +573,7 @@ parse_statement(StatementClass *stmt)
573573
in_expr= TRUE;
574574
fi[stmt->nfld-1]->expr= TRUE;
575575
fi[stmt->nfld-1]->name[0]='\0';
576+
fi[stmt->nfld-1]->precision=0;
576577
mylog("*** setting expression\n");
577578
}
578579

@@ -661,7 +662,12 @@ parse_statement(StatementClass *stmt)
661662
* following may be better
662663
*/
663664
fi[i]->type=PG_TYPE_UNKNOWN;
664-
fi[i]->precision=254;
665+
if (fi[i]->precision==0)
666+
{
667+
fi[i]->type=PG_TYPE_VARCHAR;
668+
fi[i]->precision=254;
669+
}
670+
fi[i]->length=fi[i]->precision;
665671
continue;
666672
}
667673
/* it's a dot, resolve to table or alias */

‎src/interfaces/odbc/psqlodbc.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ BEGIN
104104
BS_AUTOCHECKBOX | WS_TABSTOP,13,47,84,10
105105
CONTROL "Cancel as FreeStmt (Exp)",DRV_CANCELASFREESTMT,"Button",
106106
BS_AUTOCHECKBOX | WS_TABSTOP,164,50,112,10
107-
CONTROL "Mylog(Debug ouput",DRV_DEBUG,"Button",
107+
CONTROL "Mylog(Debug ouput)",DRV_DEBUG,"Button",
108108
BS_AUTOCHECKBOX | WS_TABSTOP,164,63,112,10
109109
GROUPBOX "Unknown Sizes",IDC_STATIC,13,76,175,24
110110
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
@@ -150,7 +150,7 @@ BEGIN
150150
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
151151
BS_AUTOCHECKBOX | WS_TABSTOP,45,28,88,10
152152
CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button",
153-
BS_AUTOCHECKBOX | WS_TABSTOP,149,28,72,10
153+
BS_AUTOCHECKBOX | WS_TABSTOP,149,28,86,10
154154
GROUPBOX "Protocol",IDC_STATIC,43,44,180,25
155155
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON |
156156
WS_GROUP,53,54,47,10

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp