2) Remove some no longer valid comments.
3) Fix an option dialog setting bug.
4) Fix ODBCVER handling errors.
INI_KSQO, tmp, fileName);
/*
- * 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);
+ * Never update the onlyread, unique_index from this module.
*/
+ 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);
SQLWritePrivateProfileString(sectionName,
/* Connection Defaults */
#define DEFAULT_PORT "5432"
-#define DEFAULT_READONLY 1
+#define DEFAULT_READONLY 0
#define DEFAULT_PROTOCOL "6.4" /* the latest protocol is
* the default */
#define DEFAULT_USEDECLAREFETCH 0
#define DEFAULT_BOOLSASCHAR 1
#define DEFAULT_OPTIMIZER 1 /* disable */
#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_DEBUG 0
#define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX
*-------
*/
-#ifdef WIN32
-#define ODBCVER_REP 0x3000
-#endif
#include "psqlodbc.h"
#include <stdio.h>
#include <string.h>
{
static char *func = "SQLFetch";
-#if (ODBCVER >= 0x3000)
+#if (ODBCVER >= 0x0300)
StatementClass *stmt = (StatementClass *) StatementHandle;
ConnectionClass *conn = SC_get_conn(stmt);
SQLUSMALLINT FunctionId, SQLUSMALLINT *Supported)
{
mylog("[SQLGetFunctions]");
-#if (ODBCVER >= 0x3000)
+#if (ODBCVER >= 0x0300)
if (FunctionId == SQL_API_ODBC3_ALL_FUNCTIONS)
return PGAPI_GetFunctions30(ConnectionHandle, FunctionId, Supported);
#endif
SQLUSMALLINT InfoType, PTR InfoValue,
SQLSMALLINT BufferLength, SQLSMALLINT *StringLength)
{
-#if (ODBCVER >= 0x3000)
+#if (ODBCVER >= 0x0300)
RETCODE ret;
mylog("[SQLGetInfo(30)]");
if ((ret = PGAPI_GetInfo(ConnectionHandle, InfoType, InfoValue,
BufferLength, StringLength)) == SQL_ERROR)
{
- if (((ConnectionClass *) ConnectionHandle)->driver_version >= 0x3000)
+ if (((ConnectionClass *) ConnectionHandle)->driver_version >= 0x0300)
return PGAPI_GetInfo30(ConnectionHandle, InfoType, InfoValue,
BufferLength, StringLength);
}
*-------
*/
+#ifndef ODBCVER_REP
#define ODBCVER_REP 0x0300
+#endif
#include "psqlodbc.h"
#include <stdio.h>
#include <string.h>
{
if (fFunction != SQL_API_ODBC3_ALL_FUNCTIONS)
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_SQLALLOCENV); 2 deprecated */
/* "0" returned in SQLGetStmtOption */
break;
- case SQL_RETRIEVE_DATA: /* ignored, but saved */
+ case SQL_RETRIEVE_DATA:
mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
if (conn)
conn->stmtOptions.retrieve_data = vParam;
*((SDWORD *) pvParam) = 0;
break;
- case SQL_RETRIEVE_DATA: /* NOT SUPPORTED, but saved */
+ case SQL_RETRIEVE_DATA:
*((SDWORD *) pvParam) = stmt->options.retrieve_data;
break;
{
/* just eat the expression */
mylog("in_expr=%d or func=%d\n", in_expr, in_func);
- if (!unquoted)
- continue;
- if (token[0] == '(')
- {
- blevel++;
- mylog("blevel++ = %d\n", blevel);
- }
- else if (token[0] == ')')
+ if (unquoted)
{
- blevel--;
- mylog("blevel-- = %d\n", blevel);
+ if (token[0] == '(')
+ {
+ blevel++;
+ mylog("blevel++ = %d\n", blevel);
+ }
+ else if (token[0] == ')')
+ {
+ blevel--;
+ mylog("blevel-- = %d\n", blevel);
+ }
}
if (blevel == 0)
{
in_expr = FALSE;
in_field = FALSE;
}
- else if (!stricmp(token, "as"))
+ else if (unquoted && !stricmp(token, "as"))
{
mylog("got AS in_expr\n");
in_func = FALSE;
if (quote)
{
- fi[stmt->nfld++]->quote = TRUE;
- in_expr = TRUE;
- continue;
+ fi[stmt->nfld]->quote = TRUE;
+ fi[stmt->nfld]->precision = strlen(token);
}
else if (numeric)
{
in_expr = TRUE;
fi[stmt->nfld - 1]->expr = TRUE;
fi[stmt->nfld - 1]->name[0] = '\0';
+ fi[stmt->nfld - 1]->precision = 0;
mylog("*** setting expression\n");
}
* following may be better
*/
fi[i]->type = PG_TYPE_UNKNOWN;
- fi[i]->precision = 254;
+ if (fi[i]->precision == 0)
+ {
+ fi[i]->type = PG_TYPE_VARCHAR;
+ fi[i]->precision = 254;
+ }
+ fi[i]->length = fi[i]->precision;
continue;
}
/* it's a dot, resolve to table or alias */
BS_AUTOCHECKBOX | WS_TABSTOP,13,47,84,10
CONTROL "Cancel as FreeStmt (Exp)",DRV_CANCELASFREESTMT,"Button",
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
GROUPBOX "Unknown Sizes",IDC_STATIC,13,76,175,24
CONTROL "Maximum",DRV_UNKNOWN_MAX,"Button",BS_AUTORADIOBUTTON |
CONTROL "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,45,28,88,10
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
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,53,54,47,10