summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dlg_specific.c11
-rw-r--r--dlg_specific.h3
-rw-r--r--dlg_wingui.c4
-rw-r--r--docs/config-opt.html11
-rw-r--r--docs/config.html4
-rw-r--r--pgapi30.c7
-rw-r--r--pgapifunc.h1
-rw-r--r--psqlodbc.h1
-rw-r--r--psqlodbc.rc4
-rw-r--r--resource.h4
-rw-r--r--statement.c8
11 files changed, 53 insertions, 5 deletions
diff --git a/dlg_specific.c b/dlg_specific.c
index d89777a..cbd24d5 100644
--- a/dlg_specific.c
+++ b/dlg_specific.c
@@ -683,6 +683,8 @@ copyConnAttributes(ConnInfo *ci, const char *attribute, const char *value)
ci->batch_size = atoi(value);
else if (stricmp(attribute, INI_OPTIONAL_ERRORS) == 0 || stricmp(attribute, ABBR_OPTIONAL_ERRORS) == 0)
ci->optional_errors = atoi(value);
+ else if (stricmp(attribute, INI_IGNORETIMEOUT) == 0 || stricmp(attribute, ABBR_IGNORETIMEOUT) == 0)
+ ci->ignore_timeout = atoi(value);
else if (stricmp(attribute, INI_SSLMODE) == 0 || stricmp(attribute, ABBR_SSLMODE) == 0)
{
switch (value[0])
@@ -1060,6 +1062,8 @@ MYLOG(0, "drivername=%s\n", drivername);
if (SQLGetPrivateProfileString(DSN, INI_BATCHSIZE, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0)
if (0 == (ci->batch_size = atoi(temp)))
ci->batch_size = DEFAULT_BATCH_SIZE;
+ if (SQLGetPrivateProfileString(DSN, INI_IGNORETIMEOUT, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0)
+ ci->ignore_timeout = atoi(temp);
if (SQLGetPrivateProfileString(DSN, INI_SSLMODE, NULL_STRING, temp, sizeof(temp), ODBC_INI) > 0)
STRCPY_FIXED(ci->sslmode, temp);
@@ -1351,6 +1355,11 @@ writeDSNinfo(const ConnInfo *ci)
INI_BATCHSIZE,
temp,
ODBC_INI);
+ ITOA_FIXED(temp, ci->ignore_timeout);
+ SQLWritePrivateProfileString(DSN,
+ INI_IGNORETIMEOUT,
+ temp,
+ ODBC_INI);
#ifdef _HANDLE_ENLIST_IN_DTC_
ITOA_FIXED(temp, ci->xa_opt);
SQLWritePrivateProfileString(DSN, INI_XAOPT, temp, ODBC_INI);
@@ -1763,6 +1772,7 @@ CC_conninfo_init(ConnInfo *conninfo, UInt4 option)
conninfo->keepalive_idle = -1;
conninfo->keepalive_interval = -1;
conninfo->batch_size = DEFAULT_BATCH_SIZE;
+ conninfo->ignore_timeout = DEFAULT_IGNORETIMEOUT;
conninfo->wcs_debug = -1;
#ifdef _HANDLE_ENLIST_IN_DTC_
conninfo->xa_opt = -1;
@@ -1863,6 +1873,7 @@ CC_copy_conninfo(ConnInfo *ci, const ConnInfo *sci)
CORR_VALCPY(keepalive_idle);
CORR_VALCPY(keepalive_interval);
CORR_VALCPY(batch_size);
+ CORR_VALCPY(ignore_timeout);
#ifdef _HANDLE_ENLIST_IN_DTC_
CORR_VALCPY(xa_opt);
#endif
diff --git a/dlg_specific.h b/dlg_specific.h
index 20aa704..b0b1ece 100644
--- a/dlg_specific.h
+++ b/dlg_specific.h
@@ -170,6 +170,8 @@ extern "C" {
#define ABBR_OPTIONAL_ERRORS "D7"
#define INI_BATCHSIZE "BatchSize"
#define ABBR_BATCHSIZE "D8"
+#define INI_IGNORETIMEOUT "IgnoreTimeout"
+#define ABBR_IGNORETIMEOUT "D9"
#define INI_DTCLOG "Dtclog"
/* "PreferLibpq", abbreviated "D4", used to mean whether to prefer libpq.
* libpq is now required
@@ -270,6 +272,7 @@ extern "C" {
#define DEFAULT_NUMERIC_AS (-101)
#define DEFAULT_OPTIONAL_ERRORS 0
#define DEFAULT_BATCH_SIZE 100
+#define DEFAULT_IGNORETIMEOUT 0
#ifdef _HANDLE_ENLIST_IN_DTC_
#define DEFAULT_XAOPT 1
diff --git a/dlg_wingui.c b/dlg_wingui.c
index 39f2681..471ccd0 100644
--- a/dlg_wingui.c
+++ b/dlg_wingui.c
@@ -212,10 +212,13 @@ MYLOG(0, "entering src=%d\n", src);
{
case 1:
ShowWindow(GetDlgItem(hdlg, DS_BATCH_SIZE), SW_SHOW);
+ ShowWindow(GetDlgItem(hdlg, DS_IGNORETIMEOUT), SW_SHOW);
SetDlgItemInt(hdlg, DS_BATCH_SIZE, ci->batch_size, FALSE);
+ CheckDlgButton(hdlg, DS_IGNORETIMEOUT, ci->ignore_timeout);
break;
default:
ShowWindow(GetDlgItem(hdlg, DS_BATCH_SIZE), SW_HIDE);
+ ShowWindow(GetDlgItem(hdlg, DS_IGNORETIMEOUT), SW_HIDE);
break;
}
@@ -268,6 +271,7 @@ MYLOG(3, "entering\n");
GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, comval->extra_systable_prefixes, sizeof(comval->extra_systable_prefixes));
ci->batch_size = GetDlgItemInt(hdlg, DS_BATCH_SIZE, NULL, FALSE);
+ ci->ignore_timeout = IsDlgButtonChecked(hdlg, DS_IGNORETIMEOUT);
/* fall through */
return 0;
diff --git a/docs/config-opt.html b/docs/config-opt.html
index 5665a43..6f17e15 100644
--- a/docs/config-opt.html
+++ b/docs/config-opt.html
@@ -507,6 +507,17 @@
D8
</TD>
</TR>
+ <TR>
+ <TD WIDTH=38%>
+ Ignore SQL_ATTR_QUERY_TIMEOUT set using SQLSetStmtAttr().
+ </TD>
+ <TD WIDTH=31%>
+ IgnoreTimeout
+ </TD>
+ <TD WIDTH=31%>
+ D9
+ </TD>
+ </TR>
</TABLE>
</TABLE>
<P><BR><BR>
diff --git a/docs/config.html b/docs/config.html
index ce7bcc9..18f48c1 100644
--- a/docs/config.html
+++ b/docs/config.html
@@ -60,6 +60,10 @@ correctly identify a function or expression column, regardless of the complexity
but it does not attempt to determine the data type or precision of these
columns.<br />&nbsp;</li>
+<li><b>Ignore Timeout:</b>
+Ignore SQL_ATTR_QUERY_TIMEOUT set using SQLSetStmtAttr(). Some tools issue SQLSetStmtAttr(.., SQL_ATTR_QUERY_TIMEOUT, ...) internally and sometimes it's difficult for users to change the value.
+<br />&nbsp;</li>
+
<li><b>MyLog (C:\mylog_xxxx.log):</b>
Log debug messages to that file. This is good
for debugging problems with the driver.<br />&nbsp;</li>
diff --git a/pgapi30.c b/pgapi30.c
index 3f8203d..07b18e5 100644
--- a/pgapi30.c
+++ b/pgapi30.c
@@ -461,6 +461,9 @@ PGAPI_GetConnectAttr(HDBC ConnectionHandle,
case SQL_ATTR_PGOPT_BATCHSIZE:
*((SQLINTEGER *) Value) = conn->connInfo.batch_size;
break;
+ case SQL_ATTR_PGOPT_IGNORETIMEOUT:
+ *((SQLINTEGER *) Value) = conn->connInfo.ignore_timeout;
+ break;
default:
ret = PGAPI_GetConnectOption(ConnectionHandle, (UWORD) Attribute, Value, &len, BufferLength);
}
@@ -1792,6 +1795,10 @@ PGAPI_SetConnectAttr(HDBC ConnectionHandle,
conn->connInfo.batch_size = CAST_PTR(SQLINTEGER, Value);
MYLOG(0, "batch size => %d\n", conn->connInfo.batch_size);
break;
+ case SQL_ATTR_PGOPT_IGNORETIMEOUT:
+ conn->connInfo.ignore_timeout = CAST_PTR(SQLINTEGER, Value);
+ MYLOG(0, "ignore_timeout => %d\n", conn->connInfo.ignore_timeout);
+ break;
default:
if (Attribute < 65536)
ret = PGAPI_SetConnectOption(ConnectionHandle, (SQLUSMALLINT) Attribute, (SQLLEN) Value);
diff --git a/pgapifunc.h b/pgapifunc.h
index 9469b52..5c5b20d 100644
--- a/pgapifunc.h
+++ b/pgapifunc.h
@@ -315,6 +315,7 @@ enum {
,SQL_ATTR_PGOPT_WCSDEBUG = 65548
,SQL_ATTR_PGOPT_MSJET = 65549
,SQL_ATTR_PGOPT_BATCHSIZE = 65550
+ ,SQL_ATTR_PGOPT_IGNORETIMEOUT = 65551
};
RETCODE SQL_API PGAPI_SetConnectAttr(HDBC ConnectionHandle,
SQLINTEGER Attribute, PTR Value,
diff --git a/psqlodbc.h b/psqlodbc.h
index dc12dc2..dfa4293 100644
--- a/psqlodbc.h
+++ b/psqlodbc.h
@@ -639,6 +639,7 @@ typedef struct
signed char wcs_debug;
signed char numeric_as;
signed char optional_errors;
+ signed char ignore_timeout;
UInt4 extra_opts;
Int4 keepalive_idle;
Int4 keepalive_interval;
diff --git a/psqlodbc.rc b/psqlodbc.rc
index da452bb..2c76ed6 100644
--- a/psqlodbc.rc
+++ b/psqlodbc.rc
@@ -97,6 +97,8 @@ BEGIN
WS_EX_TRANSPARENT
CONTROL "ユニ−クインデックスを使う(&I)",DRV_UNIQUEINDEX,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,56,129,10
+ CONTROL "タイムアウト無視",DS_IGNORETIMEOUT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,167,56,129,10
CONTROL "ステ−トメントの構文解析を行なう(&a)",DRV_PARSE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,167,40,152,10
CONTROL "Declare〜Fetchを使用する(&U)",DRV_USEDECLAREFETCH,
@@ -559,6 +561,8 @@ BEGIN
WS_EX_TRANSPARENT
CONTROL "Recognize Unique &Indexes",DRV_UNIQUEINDEX,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,15,56,110,10
+ CONTROL "Ignore Timeout",DS_IGNORETIMEOUT,"Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP,149,56,110,10
CONTROL "P&arse Statements",DRV_PARSE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,149,41,80,10
CONTROL "&Use Declare/Fetch",DRV_USEDECLAREFETCH,"Button",
diff --git a/resource.h b/resource.h
index 7b14173..fac1fbb 100644
--- a/resource.h
+++ b/resource.h
@@ -117,8 +117,8 @@
#define DS_NUMERIC_AS_VARCHAR 1109
#define DS_NUMERIC_AS_DOUBLE 1110
#define DS_NUMERIC_AS_LONGVARCHAR 1111
-#define DS_ARRAY_BATCH_EXEC 1112
-#define DS_BATCH_SIZE 1113
+#define DS_BATCH_SIZE 1112
+#define DS_IGNORETIMEOUT 1113
// Next default values for new objects
//
diff --git a/statement.c b/statement.c
index c1c07fe..93964fb 100644
--- a/statement.c
+++ b/statement.c
@@ -1854,6 +1854,7 @@ SC_execute(StatementClass *self)
BOOL useCursor, isSelectType;
int errnum_sav = STMT_OK, errnum;
char *errmsg_sav = NULL;
+ SQLULEN stmt_timeout;
conn = SC_get_conn(self);
ci = &(conn->connInfo);
@@ -1938,15 +1939,16 @@ SC_execute(StatementClass *self)
* If the session query timeout setting differs from the statement one,
* change it.
*/
- if (conn->stmt_timeout_in_effect != self->options.stmt_timeout)
+ stmt_timeout = conn->connInfo.ignore_timeout ? 0 : self->options.stmt_timeout;
+ if (conn->stmt_timeout_in_effect != stmt_timeout)
{
char query[64];
SPRINTF_FIXED(query, "SET statement_timeout = %d",
- (int) self->options.stmt_timeout * 1000);
+ (int) stmt_timeout * 1000);
res = CC_send_query(conn, query, NULL, 0, NULL);
if (QR_command_maybe_successful(res))
- conn->stmt_timeout_in_effect = self->options.stmt_timeout;
+ conn->stmt_timeout_in_effect = stmt_timeout;
QR_Destructor(res);
}