mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
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.
This commit is contained in:
@ -439,15 +439,18 @@ updateCommons(const ConnInfo *ci)
|
|||||||
INI_KSQO, tmp, fileName);
|
INI_KSQO, tmp, fileName);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Never update the onlyread, unique_index from this module
|
* Never update the onlyread, unique_index from this module.
|
||||||
* sprintf(tmp, "%d", comval->unique_index);
|
|
||||||
* SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp,
|
|
||||||
* fileName);
|
|
||||||
*
|
|
||||||
* sprintf(tmp, "%d", comval->onlyread);
|
|
||||||
* SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
|
|
||||||
* fileName);
|
|
||||||
*/
|
*/
|
||||||
|
if (!ci)
|
||||||
|
{
|
||||||
|
sprintf(tmp, "%d", comval->unique_index);
|
||||||
|
SQLWritePrivateProfileString(sectionName, INI_UNIQUEINDEX, tmp,
|
||||||
|
fileName);
|
||||||
|
|
||||||
|
sprintf(tmp, "%d", comval->onlyread);
|
||||||
|
SQLWritePrivateProfileString(sectionName, INI_READONLY, tmp,
|
||||||
|
fileName);
|
||||||
|
}
|
||||||
|
|
||||||
sprintf(tmp, "%d", comval->use_declarefetch);
|
sprintf(tmp, "%d", comval->use_declarefetch);
|
||||||
SQLWritePrivateProfileString(sectionName,
|
SQLWritePrivateProfileString(sectionName,
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
/* Connection Defaults */
|
/* Connection Defaults */
|
||||||
#define DEFAULT_PORT "5432"
|
#define DEFAULT_PORT "5432"
|
||||||
#define DEFAULT_READONLY 1
|
#define DEFAULT_READONLY 0
|
||||||
#define DEFAULT_PROTOCOL "6.4" /* the latest protocol is
|
#define DEFAULT_PROTOCOL "6.4" /* the latest protocol is
|
||||||
* the default */
|
* the default */
|
||||||
#define DEFAULT_USEDECLAREFETCH 0
|
#define DEFAULT_USEDECLAREFETCH 0
|
||||||
@ -102,7 +102,7 @@
|
|||||||
#define DEFAULT_BOOLSASCHAR 1
|
#define DEFAULT_BOOLSASCHAR 1
|
||||||
#define DEFAULT_OPTIMIZER 1 /* disable */
|
#define DEFAULT_OPTIMIZER 1 /* disable */
|
||||||
#define DEFAULT_KSQO 1 /* on */
|
#define DEFAULT_KSQO 1 /* on */
|
||||||
#define DEFAULT_UNIQUEINDEX 0 /* dont recognize */
|
#define DEFAULT_UNIQUEINDEX 1 /* dont recognize */
|
||||||
#define DEFAULT_COMMLOG 0 /* dont log */
|
#define DEFAULT_COMMLOG 0 /* dont log */
|
||||||
#define DEFAULT_DEBUG 0
|
#define DEFAULT_DEBUG 0
|
||||||
#define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX
|
#define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX
|
||||||
|
@ -26,9 +26,6 @@
|
|||||||
*-------
|
*-------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
#define ODBCVER_REP 0x3000
|
|
||||||
#endif
|
|
||||||
#include "psqlodbc.h"
|
#include "psqlodbc.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -200,7 +197,7 @@ SQLFetch(HSTMT StatementHandle)
|
|||||||
{
|
{
|
||||||
static char *func = "SQLFetch";
|
static char *func = "SQLFetch";
|
||||||
|
|
||||||
#if (ODBCVER >= 0x3000)
|
#if (ODBCVER >= 0x0300)
|
||||||
StatementClass *stmt = (StatementClass *) StatementHandle;
|
StatementClass *stmt = (StatementClass *) StatementHandle;
|
||||||
ConnectionClass *conn = SC_get_conn(stmt);
|
ConnectionClass *conn = SC_get_conn(stmt);
|
||||||
|
|
||||||
@ -273,7 +270,7 @@ SQLGetFunctions(HDBC ConnectionHandle,
|
|||||||
SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
|
SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
|
||||||
{
|
{
|
||||||
mylog("[SQLGetFunctions]");
|
mylog("[SQLGetFunctions]");
|
||||||
#if (ODBCVER >= 0x3000)
|
#if (ODBCVER >= 0x0300)
|
||||||
if (FunctionId == SQL_API_ODBC3_ALL_FUNCTIONS)
|
if (FunctionId == SQL_API_ODBC3_ALL_FUNCTIONS)
|
||||||
return PGAPI_GetFunctions30(ConnectionHandle, FunctionId, Supported);
|
return PGAPI_GetFunctions30(ConnectionHandle, FunctionId, Supported);
|
||||||
#endif
|
#endif
|
||||||
@ -284,14 +281,14 @@ SQLGetInfo(HDBC ConnectionHandle,
|
|||||||
SQLUSMALLINT InfoType, PTR InfoValue,
|
SQLUSMALLINT InfoType, PTR InfoValue,
|
||||||
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
|
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
|
||||||
{
|
{
|
||||||
#if (ODBCVER >= 0x3000)
|
#if (ODBCVER >= 0x0300)
|
||||||
RETCODE ret;
|
RETCODE ret;
|
||||||
|
|
||||||
mylog("[SQLGetInfo(30)]");
|
mylog("[SQLGetInfo(30)]");
|
||||||
if ((ret = PGAPI_GetInfo(ConnectionHandle, InfoType, InfoValue,
|
if ((ret = PGAPI_GetInfo(ConnectionHandle, InfoType, InfoValue,
|
||||||
BufferLength, StringLength)) == SQL_ERROR)
|
BufferLength, StringLength)) == SQL_ERROR)
|
||||||
{
|
{
|
||||||
if (((ConnectionClass *) ConnectionHandle)->driver_version >= 0x3000)
|
if (((ConnectionClass *) ConnectionHandle)->driver_version >= 0x0300)
|
||||||
return PGAPI_GetInfo30(ConnectionHandle, InfoType, InfoValue,
|
return PGAPI_GetInfo30(ConnectionHandle, InfoType, InfoValue,
|
||||||
BufferLength, StringLength);
|
BufferLength, StringLength);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
*-------
|
*-------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef ODBCVER_REP
|
||||||
#define ODBCVER_REP 0x0300
|
#define ODBCVER_REP 0x0300
|
||||||
|
#endif
|
||||||
#include "psqlodbc.h"
|
#include "psqlodbc.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -532,7 +534,7 @@ PGAPI_GetFunctions30(HDBC hdbc, UWORD fFunction, UWORD FAR * pfExists)
|
|||||||
{
|
{
|
||||||
if (fFunction != SQL_API_ODBC3_ALL_FUNCTIONS)
|
if (fFunction != SQL_API_ODBC3_ALL_FUNCTIONS)
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
memset(pfExists, 0, sizeof(UWORD) * 250);
|
memset(pfExists, 0, sizeof(UWORD) * SQL_API_ODBC3_ALL_FUNCTIONS_SIZE);
|
||||||
|
|
||||||
/* SQL_FUNC_ESET(pfExists, SQL_API_SQLALLOCCONNECT); 1 deprecated */
|
/* SQL_FUNC_ESET(pfExists, SQL_API_SQLALLOCCONNECT); 1 deprecated */
|
||||||
/* SQL_FUNC_ESET(pfExists, SQL_API_SQLALLOCENV); 2 deprecated */
|
/* SQL_FUNC_ESET(pfExists, SQL_API_SQLALLOCENV); 2 deprecated */
|
||||||
|
@ -178,7 +178,7 @@ set_statement_option(ConnectionClass *conn,
|
|||||||
/* "0" returned in SQLGetStmtOption */
|
/* "0" returned in SQLGetStmtOption */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_RETRIEVE_DATA: /* ignored, but saved */
|
case SQL_RETRIEVE_DATA:
|
||||||
mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
|
mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
|
||||||
if (conn)
|
if (conn)
|
||||||
conn->stmtOptions.retrieve_data = vParam;
|
conn->stmtOptions.retrieve_data = vParam;
|
||||||
@ -636,7 +636,7 @@ PGAPI_GetStmtOption(
|
|||||||
*((SDWORD *) pvParam) = 0;
|
*((SDWORD *) pvParam) = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_RETRIEVE_DATA: /* NOT SUPPORTED, but saved */
|
case SQL_RETRIEVE_DATA:
|
||||||
*((SDWORD *) pvParam) = stmt->options.retrieve_data;
|
*((SDWORD *) pvParam) = stmt->options.retrieve_data;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -378,9 +378,9 @@ parse_statement(StatementClass *stmt)
|
|||||||
{
|
{
|
||||||
/* just eat the expression */
|
/* just eat the expression */
|
||||||
mylog("in_expr=%d or func=%d\n", in_expr, in_func);
|
mylog("in_expr=%d or func=%d\n", in_expr, in_func);
|
||||||
if (!unquoted)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
if (unquoted)
|
||||||
|
{
|
||||||
if (token[0] == '(')
|
if (token[0] == '(')
|
||||||
{
|
{
|
||||||
blevel++;
|
blevel++;
|
||||||
@ -391,6 +391,7 @@ parse_statement(StatementClass *stmt)
|
|||||||
blevel--;
|
blevel--;
|
||||||
mylog("blevel-- = %d\n", blevel);
|
mylog("blevel-- = %d\n", blevel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (blevel == 0)
|
if (blevel == 0)
|
||||||
{
|
{
|
||||||
if (delim == ',')
|
if (delim == ',')
|
||||||
@ -400,7 +401,7 @@ parse_statement(StatementClass *stmt)
|
|||||||
in_expr = FALSE;
|
in_expr = FALSE;
|
||||||
in_field = FALSE;
|
in_field = FALSE;
|
||||||
}
|
}
|
||||||
else if (!stricmp(token, "as"))
|
else if (unquoted && !stricmp(token, "as"))
|
||||||
{
|
{
|
||||||
mylog("got AS in_expr\n");
|
mylog("got AS in_expr\n");
|
||||||
in_func = FALSE;
|
in_func = FALSE;
|
||||||
@ -474,9 +475,8 @@ parse_statement(StatementClass *stmt)
|
|||||||
|
|
||||||
if (quote)
|
if (quote)
|
||||||
{
|
{
|
||||||
fi[stmt->nfld++]->quote = TRUE;
|
fi[stmt->nfld]->quote = TRUE;
|
||||||
in_expr = TRUE;
|
fi[stmt->nfld]->precision = strlen(token);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
else if (numeric)
|
else if (numeric)
|
||||||
{
|
{
|
||||||
@ -573,6 +573,7 @@ parse_statement(StatementClass *stmt)
|
|||||||
in_expr = TRUE;
|
in_expr = TRUE;
|
||||||
fi[stmt->nfld - 1]->expr = TRUE;
|
fi[stmt->nfld - 1]->expr = TRUE;
|
||||||
fi[stmt->nfld - 1]->name[0] = '\0';
|
fi[stmt->nfld - 1]->name[0] = '\0';
|
||||||
|
fi[stmt->nfld - 1]->precision = 0;
|
||||||
mylog("*** setting expression\n");
|
mylog("*** setting expression\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,7 +662,12 @@ parse_statement(StatementClass *stmt)
|
|||||||
* following may be better
|
* following may be better
|
||||||
*/
|
*/
|
||||||
fi[i]->type = PG_TYPE_UNKNOWN;
|
fi[i]->type = PG_TYPE_UNKNOWN;
|
||||||
|
if (fi[i]->precision == 0)
|
||||||
|
{
|
||||||
|
fi[i]->type = PG_TYPE_VARCHAR;
|
||||||
fi[i]->precision = 254;
|
fi[i]->precision = 254;
|
||||||
|
}
|
||||||
|
fi[i]->length = fi[i]->precision;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* it's a dot, resolve to table or alias */
|
/* it's a dot, resolve to table or alias */
|
||||||
|
@ -104,7 +104,7 @@ BEGIN
|
|||||||
BS_AUTOCHECKBOX | WS_TABSTOP,13,47,84,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,13,47,84,10
|
||||||
CONTROL "Cancel as FreeStmt (Exp)",DRV_CANCELASFREESTMT,"Button",
|
CONTROL "Cancel as FreeStmt (Exp)",DRV_CANCELASFREESTMT,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,164,50,112,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,164,50,112,10
|
||||||
CONTROL "Mylog(Debug ouput",DRV_DEBUG,"Button",
|
CONTROL "Mylog(Debug ouput)",DRV_DEBUG,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,164,63,112,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,164,63,112,10
|
||||||
GROUPBOX "Unknown Sizes",IDC_STATIC,13,76,175,24
|
GROUPBOX "Unknown Sizes",IDC_STATIC,13,76,175,24
|
||||||
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
|
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
|
||||||
@ -150,7 +150,7 @@ BEGIN
|
|||||||
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
|
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,45,28,88,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,45,28,88,10
|
||||||
CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button",
|
CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button",
|
||||||
BS_AUTOCHECKBOX | WS_TABSTOP,149,28,72,10
|
BS_AUTOCHECKBOX | WS_TABSTOP,149,28,86,10
|
||||||
GROUPBOX "Protocol",IDC_STATIC,43,44,180,25
|
GROUPBOX "Protocol",IDC_STATIC,43,44,180,25
|
||||||
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON |
|
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON |
|
||||||
WS_GROUP,53,54,47,10
|
WS_GROUP,53,54,47,10
|
||||||
|
Reference in New Issue
Block a user