Modified:
branches/guffert/
branches/guffert/ChangeLog
branches/guffert/cmake/FindMySQL.cmake
branches/guffert/driver/Makefile.am
branches/guffert/driver/dll.c
branches/guffert/driver/handle.c
branches/guffert/driver/info.c
branches/guffert/driver/options.c
branches/guffert/setup/MYODBCSetupConfigDSNEdit.c
branches/guffert/test/my_basics.c
branches/guffert/test/my_cursor.c
branches/guffert/test/my_info.c
branches/guffert/test/my_result.c
branches/guffert/test/odbctap.h
Log:
Merged revisions 809,811-814,819-837,845-847,849-851,853,858-1001 via svnmerge from
svn+ssh://bk-internal/connectors-svnroot/connector-odbc3/trunk
.......
r859 | jwinstead | 2007-11-13 21:51:23 -0800 (Tue, 13 Nov 2007) | 2 lines
Bump version number, fix a couple of typos in myodbc3.def comments
.......
r891 | jwinstead | 2007-11-26 12:05:41 -0800 (Mon, 26 Nov 2007) | 2 lines
Disallow SQL_ATTR_ENLIST_IN_DTC. (Bug #32727)
.......
r961 | jwinstead | 2007-12-21 13:51:07 -0800 (Fri, 21 Dec 2007) | 3 lines
Disabled possible delay in environment handle cleanup in multithreaded
environments. (Bug #32366)
.......
r962 | bdegtyariov | 2007-12-24 11:39:29 -0800 (Mon, 24 Dec 2007) | 1 line
Fixed thread synchronization bug in SQLAllocStmt()/SQLFreeStmt() functions. (Bug #32857)
.......
r963 | bdegtyariov | 2007-12-27 05:19:28 -0800 (Thu, 27 Dec 2007) | 1 line
Fixed SQLExtendedFetch() ignoring SQL_ROWSET_SIZE attribute if Don't cache result option
is set. (Bug #324020)
.......
r964 | bdegtyariov | 2007-12-27 11:36:57 -0800 (Thu, 27 Dec 2007) | 2 lines
SQLGetInfo() returns the "null" string as database name if no database was selected.
Added mydriver variable.
.......
r965 | jwinstead | 2007-12-28 09:25:44 -0800 (Fri, 28 Dec 2007) | 3 lines
Add date for build, rewrite changelog entries to describe problems in a more
consistent way.
.......
r966 | jwinstead | 2007-12-28 09:38:59 -0800 (Fri, 28 Dec 2007) | 2 lines
Fix %lu to be %u, since it is just an SQLUINTEGER. Failed on RHEL ia64 with -O2.
.......
r967 | jbalint | 2007-12-29 18:55:25 -0800 (Sat, 29 Dec 2007) | 2 lines
added test timeout support for windows
.......
r968 | jbalint | 2007-12-29 19:05:37 -0800 (Sat, 29 Dec 2007) | 2 lines
fix timeout to 30 secs
.......
r969 | jwinstead | 2007-12-31 09:29:20 -0800 (Mon, 31 Dec 2007) | 2 lines
Add THREAD and version test for my_thread_end_wait_time before using it
.......
r970 | jwinstead | 2007-12-31 09:29:51 -0800 (Mon, 31 Dec 2007) | 2 lines
Fix typo in comment
.......
r971 | bdegtyariov | 2007-12-31 09:46:20 -0800 (Mon, 31 Dec 2007) | 1 line
Rolled back revision 963
.......
r976 | jwinstead | 2008-01-02 14:55:43 -0800 (Wed, 02 Jan 2008) | 4 lines
Remove references to old MYODBC_DBG define, and use a new define to
determine when we are linking with the non-threadsafe libmysql and
my_thread_end_wait_time will not be available.
.......
r978 | jwinstead | 2008-01-02 17:29:46 -0800 (Wed, 02 Jan 2008) | 2 lines
Set and read TEST_DRIVER in the environment
.......
r979 | jwinstead | 2008-01-02 17:30:09 -0800 (Wed, 02 Jan 2008) | 2 lines
Use correct size for length
.......
r981 | jwinstead | 2008-01-02 18:22:01 -0800 (Wed, 02 Jan 2008) | 2 lines
Fix variable size in test
.......
r987 | jwinstead | 2008-01-03 14:55:18 -0800 (Thu, 03 Jan 2008) | 2 lines
Backport some test compatibility issues from 5.1
.......
r988 | jwinstead | 2008-01-03 14:56:07 -0800 (Thu, 03 Jan 2008) | 2 lines
Make test result depend on server version
.......
r989 | jwinstead | 2008-01-04 10:36:26 -0800 (Fri, 04 Jan 2008) | 3 lines
Changing the DSN name when editing a DSN left behind the DSN
under the old name in addition to creating the new entry. (Bug #31165)
.......
r997 | jwinstead | 2008-01-09 15:44:55 -0800 (Wed, 09 Jan 2008) | 2 lines
Update build date
.......
r998 | jwinstead | 2008-01-09 16:38:37 -0800 (Wed, 09 Jan 2008) | 2 lines
Fix version number check in test
.......
r1000 | jwinstead | 2008-01-10 18:08:08 -0800 (Thu, 10 Jan 2008) | 3 lines
Fix t_binary_collation to check for SQL_VARCHAR instead of SQL_WVARCHAR, and
that bug was fixed in 5.0.46, not just 5.0.48.
.......
Property changes on: branches/guffert
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-808,810-857
+ /trunk:1-1001
Modified: branches/guffert/ChangeLog
===================================================================
--- branches/guffert/ChangeLog 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/ChangeLog 2008-01-11 05:57:46 UTC (rev 1002)
@@ -15,6 +15,8 @@
under the old name in addition to creating the new entry. Fixed for
native Windows GUI. (Bug #31165)
+ Includes changes from Connector/ODBC 3.51.23.
+
----
5.1.1 (12-Dec-2007)
@@ -83,6 +85,22 @@
----
+3.51.23 (9-Jan-2008)
+
+ Bugs fixed:
+ * Allowed connections to be enlisted in distributed transactions, even
+ though the driver doesn't support them. (Bug #32727)
+ * Cleaning up environment handles in multithread environments could result
+ in a five (or more) second delay. (Bug #32366)
+ * SQLAllocStmt() and SQLFreeStmt() did not synchronize access to the
+ list of statements associated with a connection. (Bug #32857)
+ * SQLGetInfo() returned the wrong value for SQL_DATABASE_NAME when no
+ database was selected. (Bug #3780)
+ * Changing the DSN name when editing a DSN left behind the DSN
+ under the old name in addition to creating the new entry. (Bug #31165)
+
+----
+
3.51.22 (13-Nov-2007)
Functionality added or changed:
Modified: branches/guffert/cmake/FindMySQL.cmake
===================================================================
--- branches/guffert/cmake/FindMySQL.cmake 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/cmake/FindMySQL.cmake 2008-01-11 05:57:46 UTC (rev 1002)
@@ -43,7 +43,6 @@
IF (CMAKE_BUILD_TYPE STREQUAL Debug)
SET(libsuffixDist debug)
SET(libsuffixBuild Debug)
- ADD_DEFINITIONS(-DMYODBC_DBG)
ELSE (CMAKE_BUILD_TYPE STREQUAL Debug)
SET(libsuffixDist opt)
SET(libsuffixBuild Release)
Modified: branches/guffert/driver/Makefile.am
===================================================================
--- branches/guffert/driver/Makefile.am 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/driver/Makefile.am 2008-01-11 05:57:46 UTC (rev 1002)
@@ -55,9 +55,7 @@
# Linker and preprocessor options #
# #
###################################################################
-if WITH_DEBUG
-libmyodbc5_la_CPPFLAGS = -DMYODBC_DBG
-endif
+libmyodbc5_la_CPPFLAGS = -DNONTHREADSAFE
libmyodbc5_la_LDFLAGS = -release @NUMERIC_VERSION@ -module
Modified: branches/guffert/driver/dll.c
===================================================================
--- branches/guffert/driver/dll.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/driver/dll.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -97,10 +97,22 @@
my_free(decimal_point,MYF(0));
my_free(default_locale,MYF(0));
my_free(thousands_sep,MYF(0));
+
+ /* my_thread_end_wait_time was added in 5.1.14 and 5.0.32 */
+#if !defined(NONTHREADSAFE) && \
+ (MYSQL_VERSION_ID >= 50114 || \
+ (MYSQL_VERSION_ID >= 50032 && MYSQL_VERSION_ID < 50100))
+ /*
+ This eliminates the delay when my_end() is called and other threads
+ have been initialized but not ended.
+ */
+ my_thread_end_wait_time= 0;
+#endif
+
#ifdef MY_DONT_FREE_DBUG
/*
- Function my_end() was changed to deallocate DBUG memory by default,
- a flag MY_DONT_FREE_DBUG was added to disable this new behaviour
+ Function my_end() was changed to deallocate DBUG memory by default,
+ a flag MY_DONT_FREE_DBUG was added to disable this new behaviour
*/
my_end(MY_DONT_FREE_DBUG);
#else
@@ -116,50 +128,43 @@
*/
#ifdef _WIN32
-static int inited=0,threads=0;
-static DWORD main_thread;
-HINSTANCE NEAR s_hModule; /* Saved module handle */
-int APIENTRY LibMain(HANDLE hInst,DWORD ul_reason_being_called,
+static int inited= 0;
+int APIENTRY LibMain(HANDLE hInst, DWORD ul_reason_being_called,
LPVOID lpReserved)
{
switch (ul_reason_being_called) {
case DLL_PROCESS_ATTACH: /* case of libentry call in win 3.x */
- if (!inited++)
- {
- s_hModule=hInst;
- myodbc_init();
- main_thread=GetCurrentThreadId();
- }
- break;
- case DLL_THREAD_ATTACH:
- threads++;
-#ifdef THREAD
- my_thread_init();
-#endif
+ if (!inited++)
+ myodbc_init();
break;
case DLL_PROCESS_DETACH: /* case of wep call in win 3.x */
if (!--inited)
myodbc_end();
break;
+
+ /*
+ We don't explicitly call my_thread_init() to avoid initialization in
+ threads that may not even make ODBC calls. my_thread_init() will be
+ called implicitly when mysys calls are made from the thread.
+ */
+ case DLL_THREAD_ATTACH:
+ break;
case DLL_THREAD_DETACH:
#ifdef THREAD
- /* Main thread will free by my_end() */
- threads--;
- if (main_thread != GetCurrentThreadId())
- my_thread_end();
-#else
- --threads;
+ my_thread_end();
#endif
break;
+
default:
break;
- } /* switch */
+ }
return TRUE;
UNREFERENCED_PARAMETER(lpReserved);
-} /* LibMain */
+}
+
/*
@type : myodbc3 internal
@purpose : entry point for the DLL
@@ -183,7 +188,6 @@
int _export FAR PASCAL libmain(HANDLE hModule,short cbHeapSize,
SQLCHAR FAR *lszCmdLine)
{
- s_hModule = hModule;
myodbc_init();
return TRUE;
}
Modified: branches/guffert/driver/handle.c
===================================================================
--- branches/guffert/driver/handle.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/driver/handle.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -303,7 +303,9 @@
stmt= (STMT FAR*) *phstmt;
stmt->dbc= dbc;
+ pthread_mutex_lock(&stmt->dbc->lock);
dbc->statements= list_add(dbc->statements,&stmt->list);
+ pthread_mutex_unlock(&stmt->dbc->lock);
stmt->list.data= stmt;
stmt->stmt_options= dbc->stmt_options;
stmt->state= ST_UNKNOWN;
@@ -486,7 +488,9 @@
x_free(stmt->cursor.name);
delete_dynamic(&stmt->param_pos);
+ pthread_mutex_lock(&stmt->dbc->lock);
stmt->dbc->statements=
list_delete(stmt->dbc->statements,&stmt->list);
+ pthread_mutex_unlock(&stmt->dbc->lock);
#ifndef _UNIX_
GlobalUnlock(GlobalHandle ((HGLOBAL) hstmt));
GlobalFree(GlobalHandle((HGLOBAL) hstmt));
Modified: branches/guffert/driver/info.c
===================================================================
--- branches/guffert/driver/info.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/driver/info.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -213,6 +213,10 @@
MYINFO_SET_STR("N");
case SQL_DATABASE_NAME:
+ if (reget_current_catalog(dbc))
+ return set_dbc_error(dbc, "HY000",
+ "SQLGetInfo() failed to return current catalog.",
+ 0);
MYINFO_SET_STR(dbc->database);
case SQL_DATETIME_LITERALS:
Modified: branches/guffert/driver/options.c
===================================================================
--- branches/guffert/driver/options.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/driver/options.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -352,6 +352,10 @@
}
break;
+ case SQL_ATTR_ENLIST_IN_DTC:
+ return set_dbc_error(dbc, "HYC00",
+ "Optional feature not supported", 0);
+
/*
3.x driver doesn't support any statement attributes
at connection level, but to make sure all 2.x apps
Modified: branches/guffert/setup/MYODBCSetupConfigDSNEdit.c
===================================================================
--- branches/guffert/setup/MYODBCSetupConfigDSNEdit.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/setup/MYODBCSetupConfigDSNEdit.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -28,6 +28,8 @@
*/
BOOL MYODBCSetupConfigDSNEdit( HWND hWnd, MYODBCUTIL_DATASOURCE *pDataSource )
{
+ char *origdsn= NULL;
+
pDataSource->nMode = MYODBCUTIL_DATASOURCE_MODE_DSN_EDIT;
/*!
@@ -81,6 +83,8 @@
/* merge in any missing attributes we can find in the system information */
MYODBCUtilReadDataSource( pDataSource, pDataSource->pszDSN );
+ origdsn= strdup(pDataSource->pszDSN);
+
/*!
ODBC RULE
@@ -97,12 +101,15 @@
}
}
- /*!
- ODBC RULE
+ /*
+ If the data source name changed, delete the old entry.
+ */
+ if (strcmp(origdsn, pDataSource->pszDSN))
+ {
+ SQLRemoveDSNFromIni(origdsn);
+ }
+ free(origdsn);
- If the data source name was not changed, ConfigDSN calls
- SQLWritePrivateProfileString in the installer DLL to make any other changes.
- */
/*!
MYODBC RULE
Modified: branches/guffert/test/my_basics.c
===================================================================
--- branches/guffert/test/my_basics.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/test/my_basics.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -497,7 +497,7 @@
if (using_dm(hdbc))
skip("test does not work with all driver managers");
- sprintf((char *)conn, "DSN=%s;UID=%s;PWD=%s;OPTION=16",
+ sprintf((char *)conn, "DSN=%s;UID=%s;PASSWORD=%s;OPTION=16",
mydsn, myuid, mypwd);
if (mysock != NULL)
{
@@ -799,6 +799,17 @@
}
+/**
+ Bug #32727: Unable to abort distributed transactions enlisted in MSDTC
+*/
+DECLARE_TEST(t_bug32727)
+{
+ is(SQLSetConnectAttr(hdbc, SQL_ATTR_ENLIST_IN_DTC,
+ (SQLPOINTER)1, SQL_IS_UINTEGER) == SQL_ERROR);
+ return OK;
+}
+
+
BEGIN_TESTS
ADD_TEST(my_basics)
ADD_TEST(t_max_select)
@@ -821,6 +832,7 @@
ADD_TEST(sqlcancel)
ADD_TEST(t_bug32014)
ADD_TEST(t_bug10128)
+ ADD_TEST(t_bug32727)
END_TESTS
Modified: branches/guffert/test/my_cursor.c
===================================================================
--- branches/guffert/test/my_cursor.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/test/my_cursor.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -2768,6 +2768,264 @@
}
+/**
+ Bug #32420: Don't cache results and SQLExtendedFetch ignore SQL_ROWSET_SIZE
+ option
+*/
+DECLARE_TEST(t_bug32420)
+{
+ HDBC hdbc1;
+ HSTMT hstmt1;
+
+ SQLINTEGER nData[4];
+ SQLCHAR szData[4][16];
+ SQLUSMALLINT rgfRowStatus[4];
+ SQLCHAR conn[256], conn_out[256];
+ SQLSMALLINT conn_out_len;
+ SQLULEN row_count;
+
+ /* Don't cache result option in the connection string */
+ sprintf(conn, "DRIVER=%s;USER=%s;PASSWORD=%s;"
+ "DATABASE=%s;SERVER=%s;OPTION=1048576",
+ mydriver, myuid, mypwd, mydb, myserver);
+
+ if (mysock != NULL)
+ {
+ strcat((char *)conn, ";SOCKET=");
+ strcat((char *)conn, (char *)mysock);
+ }
+
+ ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1));
+
+ ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, conn, sizeof(conn), conn_out,
+ sizeof(conn_out), &conn_out_len,
+ SQL_DRIVER_NOPROMPT));
+ ok_con(hdbc1, SQLAllocStmt(hdbc1, &hstmt1));
+
+ ok_sql(hstmt1, "drop table if exists bug32420");
+ ok_sql(hstmt1, "CREATE TABLE bug32420 ("\
+ "tt_int INT PRIMARY KEY auto_increment,"\
+ "tt_varchar VARCHAR(128) NOT NULL)");
+ ok_sql(hstmt1, "INSERT INTO bug32420 VALUES "\
+ "(100, 'string 1'),"\
+ "(200, 'string 2'),"\
+ "(300, 'string 3'),"\
+ "(400, 'string 4'),"\
+ "(500, 'string 5'),"\
+ "(600, 'string 6'),"\
+ "(700, 'string 7'),"\
+ "(800, 'string 8'),"\
+ "(900, 'string 9'),"\
+ "(910, 'string A'),"\
+ "(920, 'string B')");
+
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
+
+ ok_stmt(hstmt1, SQLSetStmtOption(hstmt1, SQL_ROWSET_SIZE, 4));
+
+ ok_sql(hstmt1, "select * from bug32420");
+ ok_stmt(hstmt1, SQLBindCol(hstmt1, 1, SQL_C_LONG, nData, 0, NULL));
+ ok_stmt(hstmt1, SQLBindCol(hstmt1, 2, SQL_C_CHAR, szData, sizeof(szData[0]),
+ NULL));
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 100);
+ is_str(szData[0], "string 1", 8);
+ is_num(nData[1], 200);
+ is_str(szData[1], "string 2", 8);
+ is_num(nData[2], 300);
+ is_str(szData[2], "string 3", 8);
+ is_num(nData[3], 400);
+ is_str(szData[3], "string 4", 8);
+
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 500);
+ is_str(szData[0], "string 5", 8);
+ is_num(nData[1], 600);
+ is_str(szData[1], "string 6", 8);
+ is_num(nData[2], 700);
+ is_str(szData[2], "string 7", 8);
+ is_num(nData[3], 800);
+ is_str(szData[3], "string 8", 8);
+
+ /*
+ Now checking the last records when the result is shorter than
+ ROWSET_SIZE
+ */
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 3);
+ is_num(nData[0], 900);
+ is_str(szData[0], "string 9", 8);
+ is_num(nData[1], 910);
+ is_str(szData[1], "string A", 8);
+ is_num(nData[2], 920);
+ is_str(szData[2], "string B", 8);
+
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
+ ok_sql(hstmt1, "drop table if exists bug32420");
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_DROP));
+ ok_con(hdbc1, SQLDisconnect(hdbc1));
+ ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
+
+ /*
+ Result cache is enabled. Need to check that cached results are not
+ broken
+ */
+ sprintf(conn,"DRIVER=%s;USER=%s;PASSWORD=%s;"
+ "DATABASE=%s;SERVER=%s",
+ mydriver, myuid, mypwd, mydb, myserver);
+
+ if (mysock != NULL)
+ {
+ strcat((char *)conn, ";SOCKET=");
+ strcat((char *)conn, (char *)mysock);
+ }
+
+ ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1));
+
+ ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, conn, sizeof(conn), conn_out,
+ sizeof(conn_out), &conn_out_len,
+ SQL_DRIVER_NOPROMPT));
+ ok_con(hdbc1, SQLAllocStmt(hdbc1, &hstmt1));
+ ok_stmt(hstmt1, SQLSetStmtAttr(hstmt1, SQL_ATTR_CURSOR_TYPE,
+ SQL_CURSOR_DYNAMIC, 0));
+ ok_sql(hstmt1, "drop table if exists bug32420");
+ ok_sql(hstmt1, "CREATE TABLE bug32420 ("\
+ "tt_int INT PRIMARY KEY auto_increment,"\
+ "tt_varchar VARCHAR(128) NOT NULL)");
+ ok_sql(hstmt1, "INSERT INTO bug32420 VALUES "\
+ "(100, 'string 1'),"\
+ "(200, 'string 2'),"\
+ "(300, 'string 3'),"\
+ "(400, 'string 4'),"\
+ "(500, 'string 5'),"\
+ "(600, 'string 6'),"\
+ "(700, 'string 7'),"\
+ "(800, 'string 8'),"\
+ "(900, 'string 9'),"\
+ "(910, 'string A'),"\
+ "(920, 'string B')");
+
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
+
+ ok_stmt(hstmt1, SQLSetStmtOption(hstmt1, SQL_ROWSET_SIZE, 4));
+
+ ok_sql(hstmt1, "select * from bug32420");
+ ok_stmt(hstmt1, SQLBindCol(hstmt1, 1, SQL_C_LONG, nData, 0, NULL));
+ ok_stmt(hstmt1, SQLBindCol(hstmt1, 2, SQL_C_CHAR, szData, sizeof(szData[0]),
+ NULL));
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 100);
+ is_str(szData[0], "string 1", 8);
+ is_num(nData[1], 200);
+ is_str(szData[1], "string 2", 8);
+ is_num(nData[2], 300);
+ is_str(szData[2], "string 3", 8);
+ is_num(nData[3], 400);
+ is_str(szData[3], "string 4", 8);
+
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 500);
+ is_str(szData[0], "string 5", 8);
+ is_num(nData[1], 600);
+ is_str(szData[1], "string 6", 8);
+ is_num(nData[2], 700);
+ is_str(szData[2], "string 7", 8);
+ is_num(nData[3], 800);
+ is_str(szData[3], "string 8", 8);
+
+ /*
+ Now checking the last records when the result is shorter than
+ ROWSET_SIZE
+ */
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_NEXT, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 3);
+ is_num(nData[0], 900);
+ is_str(szData[0], "string 9", 8);
+ is_num(nData[1], 910);
+ is_str(szData[1], "string A", 8);
+ is_num(nData[2], 920);
+ is_str(szData[2], "string B", 8);
+
+ /* Dynamic cursor allows fetching first records */
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_FIRST, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 100);
+ is_str(szData[0], "string 1", 8);
+ is_num(nData[1], 200);
+ is_str(szData[1], "string 2", 8);
+ is_num(nData[2], 300);
+ is_str(szData[2], "string 3", 8);
+ is_num(nData[3], 400);
+ is_str(szData[3], "string 4", 8);
+
+ /* Fetching last records */
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_LAST, 0, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 800);
+ is_str(szData[0], "string 8", 8);
+ is_num(nData[1], 900);
+ is_str(szData[1], "string 9", 8);
+ is_num(nData[2], 910);
+ is_str(szData[2], "string A", 8);
+ is_num(nData[3], 920);
+ is_str(szData[3], "string B", 8);
+
+ /* Fetching with absolute offset */
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_ABSOLUTE, 3, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 4);
+ is_num(nData[0], 300);
+ is_str(szData[0], "string 3", 8);
+ is_num(nData[1], 400);
+ is_str(szData[1], "string 4", 8);
+ is_num(nData[2], 500);
+ is_str(szData[2], "string 5", 8);
+ is_num(nData[3], 600);
+ is_str(szData[3], "string 6", 8);
+
+ /* Fetching with relative offset */
+ ok_stmt(hstmt1, SQLExtendedFetch(hstmt1, SQL_FETCH_RELATIVE, 2, &row_count,
+ rgfRowStatus));
+
+ is_num(row_count, 3);
+ is_num(nData[0], 900);
+ is_str(szData[0], "string 9", 8);
+ is_num(nData[1], 910);
+ is_str(szData[1], "string A", 8);
+ is_num(nData[2], 920);
+ is_str(szData[2], "string B", 8);
+
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
+ ok_sql(hstmt1, "drop table if exists bug32420");
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_DROP));
+ ok_con(hdbc1, SQLDisconnect(hdbc1));
+ ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
+
+ return OK;
+}
+
+
BEGIN_TESTS
ADD_TEST(my_positioned_cursor)
ADD_TEST(my_setpos_cursor)
@@ -2811,6 +3069,7 @@
ADD_TEST(t_update_offsets)
ADD_TEST(t_bug29765)
ADD_TEST(t_bug6157)
+ ADD_TODO(t_bug32420)
END_TESTS
Modified: branches/guffert/test/my_info.c
===================================================================
--- branches/guffert/test/my_info.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/test/my_info.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -211,6 +211,56 @@
}
+/*
+ Bug 3780, reading or setting ADODB.Connection.DefaultDatabase
+ is not supported
+*/
+DECLARE_TEST(t_bug3780)
+{
+ HDBC hdbc1;
+ HSTMT hstmt1;
+ SQLCHAR conn[256], conn_out[256];
+ SQLSMALLINT conn_out_len;
+ SQLCHAR rgbValue[MAX_NAME_LEN];
+ SQLSMALLINT pcbInfo;
+ SQLINTEGER len;
+
+ /* The connection string must not include DATABASE. */
+ sprintf((char *)conn, "DRIVER=%s;SERVER=localhost;" \
+ "UID=%s;PASSWORD=%s", mydriver, myuid, mypwd);
+ if (mysock != NULL)
+ {
+ strcat((char *)conn, ";SOCKET=");
+ strcat((char *)conn, (char *)mysock);
+ }
+
+ ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1));
+
+ ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, conn, sizeof(conn), conn_out,
+ sizeof(conn_out), &conn_out_len,
+ SQL_DRIVER_NOPROMPT));
+ ok_con(hdbc1, SQLAllocStmt(hdbc1, &hstmt1));
+
+ ok_con(hdbc1, SQLGetInfo(hdbc1, SQL_DATABASE_NAME, rgbValue,
+ MAX_NAME_LEN, &pcbInfo));
+
+ is_num(pcbInfo, 4);
+ is_str(rgbValue, "null", pcbInfo);
+
+ ok_con(hdbc1, SQLGetConnectAttr(hdbc1, SQL_ATTR_CURRENT_CATALOG,
+ rgbValue, MAX_NAME_LEN, &len));
+
+ is_num(pcbInfo, 4);
+ is_str(rgbValue, "null", len);
+
+ ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_DROP));
+ ok_con(hdbc1, SQLDisconnect(hdbc1));
+ ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
+
+ return OK;
+}
+
+
BEGIN_TESTS
ADD_TEST(sqlgetinfo)
ADD_TEST(t_gettypeinfo)
@@ -220,6 +270,7 @@
ADD_TEST(t_bug28657)
ADD_TEST(t_bug14639)
ADD_TEST(t_bug31055)
+ ADD_TEST(t_bug3780)
END_TESTS
Modified: branches/guffert/test/my_result.c
===================================================================
--- branches/guffert/test/my_result.c 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/test/my_result.c 2008-01-11 05:57:46 UTC (rev 1002)
@@ -1727,10 +1727,7 @@
&name_length, &data_type, &column_size,
&decimal_digits, &nullable));
if (mysql_min_version(hdbc, "5.2", 3) ||
- /*
- 5.0.46 or later in 5.0 series based on ChangeLog, even though
- Bug#10491 says its pushed only in 5.0.48
- */
+ /* 5.0.46 or later in 5.0 series */
(!strncmp("5.0", server_version, 3) &&
mysql_min_version(hdbc, "5.0.46", 6)) ||
/* 5.1.22 or later in 5.1 series */
Modified: branches/guffert/test/odbctap.h
===================================================================
--- branches/guffert/test/odbctap.h 2008-01-11 05:14:25 UTC (rev 1001)
+++ branches/guffert/test/odbctap.h 2008-01-11 05:57:46 UTC (rev 1002)
@@ -78,7 +78,7 @@
#define MAX_ROW_DATA_LEN 1000
#define MYSQL_NAME_LEN 64
-SQLCHAR *mydriver= (SQLCHAR *)"MyODBC";
+SQLCHAR *mydriver= (SQLCHAR *)"{MySQL ODBC 5.1 Driver}";
SQLCHAR *mydsn= (SQLCHAR *)"test";
SQLCHAR *myuid= (SQLCHAR *)"root";
SQLCHAR *mypwd= (SQLCHAR *)"";
@@ -134,9 +134,20 @@
} my_test;
#ifdef WIN32
-#define ENABLE_ALARMS
-#define RUN_TESTS_SIGNAL
-#define RUN_TESTS_ALARM
+void test_timeout(int signum);
+HANDLE halarm= NULL;
+DWORD WINAPI win32_alarm(LPVOID arg)
+{
+ DWORD timeout= ((DWORD) arg) * 1000;
+ while (WaitForSingleObject(halarm, timeout) == WAIT_OBJECT_0);
+ test_timeout(0);
+ return 0;
+}
+#define ENABLE_ALARMS int do_alarms= !getenv("DISABLE_TIMEOUT")
+#define RUN_TESTS_SIGNAL halarm= CreateEvent(NULL, FALSE, FALSE, NULL); \
+ if (do_alarms) \
+ CreateThread(NULL, 0, win32_alarm, (LPVOID) 30, 0, NULL)
+#define RUN_TESTS_ALARM (void) SetEvent(halarm)
#else
#define ENABLE_ALARMS int do_alarms= !getenv("DISABLE_TIMEOUT")
#define RUN_TESTS_SIGNAL (void)signal(SIGALRM, test_timeout)
@@ -178,8 +189,8 @@
/* Set from environment, possibly overrided by command line */ \
if (getenv("TEST_DSN")) \
mydsn= (SQLCHAR *)getenv("TEST_DSN"); \
- if (getenv("TEST_DRIVER")) \
- mydriver= (SQLCHAR *)getenv("TEST_DRIVER"); \
+ if (getenv("TEST_DRIVER")) \
+ mydriver= (SQLCHAR *)getenv("TEST_DRIVER"); \
if (getenv("TEST_UID")) \
myuid= (SQLCHAR *)getenv("TEST_UID"); \
if (getenv("TEST_PASSWORD")) \
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r1002 - in branches/guffert: . cmake driver setup test | jwinstead | 11 Jan |