summaryrefslogtreecommitdiff
path: root/storage/connect/odbconn.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-01-13 17:24:31 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2015-01-13 17:24:31 +0100
commit70b4e6d368671773cb75830b672c871b2c47b887 (patch)
tree3a388ca14a2a5337f051db5b081c3fb841109089 /storage/connect/odbconn.cpp
parent85c65f4e1caa0dd28bc279ee1e83712f57ba3747 (diff)
downloadmariadb-git-70b4e6d368671773cb75830b672c871b2c47b887.tar.gz
- Add ConnectTimout and QueryTimout options for ODBC tables. Should
fix MDEV-7415. (To be specified in option_list) modified: storage/connect/ha_connect.cc storage/connect/odbccat.h storage/connect/odbconn.cpp storage/connect/odbconn.h storage/connect/tabodbc.cpp storage/connect/tabodbc.h
Diffstat (limited to 'storage/connect/odbconn.cpp')
-rw-r--r--storage/connect/odbconn.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index ec8be43b059..3e616ec8f04 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -1,7 +1,7 @@
/************ Odbconn C++ Functions Source Code File (.CPP) ************/
-/* Name: ODBCONN.CPP Version 2.0 */
+/* Name: ODBCONN.CPP Version 2.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 1998-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 1998-2015 */
/* */
/* This file contains the ODBC connection classes functions. */
/***********************************************************************/
@@ -291,7 +291,7 @@ static void ResetNullValues(CATPARM *cap)
/* of an ODBC table that will be retrieved by GetData commands. */
/***********************************************************************/
PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
- char *colpat, int maxres, bool info)
+ char *colpat, int maxres, int cto, int qto, bool info)
{
int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING,
TYPE_SHORT, TYPE_STRING, TYPE_INT, TYPE_INT,
@@ -310,6 +310,8 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
/************************************************************************/
if (!info) {
ocp = new(g) ODBConn(g, NULL);
+ ocp->SetLoginTimeout((DWORD)cto);
+ ocp->SetQueryTimeout((DWORD)qto);
if (ocp->Open(dsn, 10) < 1) // openReadOnly + noODBCdialog
return NULL;
@@ -386,10 +388,12 @@ PQRYRES ODBCColumns(PGLOBAL g, char *dsn, char *db, char *table,
/* ODBCSrcCols: constructs the result blocks containing the */
/* description of all the columns of a Srcdef option. */
/**************************************************************************/
-PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src)
+PQRYRES ODBCSrcCols(PGLOBAL g, char *dsn, char *src, int cto, int qto)
{
ODBConn *ocp = new(g) ODBConn(g, NULL);
+ ocp->SetLoginTimeout((DWORD)cto);
+ ocp->SetQueryTimeout((DWORD)qto);
return ocp->GetMetaData(g, dsn, src);
} // end of ODBCSrcCols
@@ -570,7 +574,7 @@ PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
/* an ODBC database that will be retrieved by GetData commands. */
/**************************************************************************/
PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
- int maxres, bool info)
+ int maxres, int cto, int qto, bool info)
{
int buftyp[] = {TYPE_STRING, TYPE_STRING, TYPE_STRING,
TYPE_STRING, TYPE_STRING};
@@ -590,6 +594,8 @@ PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *db, char *tabpat,
/* Open the connection with the ODBC data source. */
/**********************************************************************/
ocp = new(g) ODBConn(g, NULL);
+ ocp->SetLoginTimeout((DWORD)cto);
+ ocp->SetQueryTimeout((DWORD)qto);
if (ocp->Open(dsn, 2) < 1) // 2 is openReadOnly
return NULL;
@@ -1134,10 +1140,13 @@ void ODBConn::AllocConnect(DWORD Options)
} // endif
#endif // _DEBUG
- rc = SQLSetConnectOption(m_hdbc, SQL_LOGIN_TIMEOUT, m_LoginTimeout);
+ if ((signed)m_LoginTimeout >= 0) {
+ rc = SQLSetConnectOption(m_hdbc, SQL_LOGIN_TIMEOUT, m_LoginTimeout);
- if (trace && rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
- htrc("Warning: Failure setting login timeout\n");
+ if (trace && rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
+ htrc("Warning: Failure setting login timeout\n");
+
+ } // endif Timeout
if (!m_Updatable) {
rc = SQLSetConnectOption(m_hdbc, SQL_ACCESS_MODE, SQL_MODE_READ_ONLY);