Added:
branches/guffert/test/my_bug13766.c
Modified:
branches/guffert/
branches/guffert/ChangeLog
branches/guffert/MYODBCDbg/MYODBCDbgLib/CMakeLists.txt
branches/guffert/MYODBCDbg/MYODBCDbgLib/Makefile.am
branches/guffert/MYODBCDbg/Makefile.am
branches/guffert/MYODBC_MYSQL.h
branches/guffert/Makefile.am
branches/guffert/cmake/FindODBC.cmake
branches/guffert/dltest/Makefile.am
branches/guffert/driver/Makefile.am
branches/guffert/driver/catalog.c
branches/guffert/driver/cursor.c
branches/guffert/driver/error.c
branches/guffert/driver/execute.c
branches/guffert/driver/info.c
branches/guffert/driver/myodbc3.h
branches/guffert/driver/myutil.h
branches/guffert/driver/results.c
branches/guffert/driver/utility.c
branches/guffert/dsn-editor/Makefile.am
branches/guffert/installer/Makefile.am
branches/guffert/installer/myodbc3i.c
branches/guffert/monitor/Makefile.am
branches/guffert/setup/ConfigDSN.c
branches/guffert/setup/MYODBCSetupDataSourceConfig.cpp
branches/guffert/setup/MYODBCSetupDataSourceDialog.cpp
branches/guffert/setup/MYODBCSetupDriverConnectPrompt.cpp
branches/guffert/setup/Makefile.am
branches/guffert/test/
branches/guffert/test/Makefile.am
branches/guffert/test/include/mytest3.h
branches/guffert/test/include/odbctap.h
branches/guffert/test/my_blob.c
branches/guffert/test/my_catalog.c
branches/guffert/test/my_error.c
branches/guffert/test/my_unixodbc.c
branches/guffert/util/MYODBCUtil.h
branches/guffert/util/MYODBCUtilClearDataSource.c
branches/guffert/util/MYODBCUtilReadDataSource.c
branches/guffert/util/MYODBCUtilReadDataSourceStr.c
branches/guffert/util/Makefile.am
Log:
Merged revisions 542-568 via svnmerge from
svn+ssh://bk-internal/connectors-svnroot/connector-odbc3/trunk
.......
r543 | jbalint | 2007-07-03 10:08:43 -0700 (Tue, 03 Jul 2007) | 2 lines
fix missing initialization in driver/results.c
account for differences on Windows in test/my_unixodbc.c
.......
r544 | jbalint | 2007-07-03 11:02:07 -0700 (Tue, 03 Jul 2007) | 4 lines
Fixed error handling of OOM and bad connections in catalog functions.
This might raise errors in code paths that had ignored them in the past.
Gathered the logic for internal result sets into one place. (Bug #26934)
.......
r545 | jbalint | 2007-07-03 11:08:56 -0700 (Tue, 03 Jul 2007) | 2 lines
fixed check_sqlstate() params for new tests
.......
r546 | jbalint | 2007-07-03 11:40:24 -0700 (Tue, 03 Jul 2007) | 1 line
added copyright notices
.......
r548 | jbalint | 2007-07-03 14:27:18 -0700 (Tue, 03 Jul 2007) | 1 line
added macro support for sleep() on windows
.......
r550 | kboortz | 2007-07-03 16:39:14 -0700 (Tue, 03 Jul 2007) | 1 line
Copy the CMakeLists.txt files in bootstrap
.......
r551 | jbalint | 2007-07-05 15:57:00 -0700 (Thu, 05 Jul 2007) | 1 line
fix obvious non-ptr assignment (found by gcc warning)
.......
r552 | jbalint | 2007-07-06 14:28:57 -0700 (Fri, 06 Jul 2007) | 2 lines
setup odbctap.h to count test failures and return this as the test program return code
(mainly for cmake/ctest to detect failures since it's not parsing the TAP)
.......
r553 | jbalint | 2007-07-09 09:55:01 -0700 (Mon, 09 Jul 2007) | 4 lines
Dis-allow NULL ptr for null indicator when calling SQLGetData()
if value is null. Now returns SQL_ERROR w/state 22002.
.......
r554 | jbalint | 2007-07-09 14:21:51 -0700 (Mon, 09 Jul 2007) | 1 line
fix using wrong "free"
.......
r555 | jbalint | 2007-07-09 21:21:30 -0700 (Mon, 09 Jul 2007) | 1 line
fix bad logic (test was only correct after first run)
.......
r556 | jbalint | 2007-07-09 23:01:46 -0700 (Mon, 09 Jul 2007) | 1 line
updated 22002/SQLGetData() message to match msdn
.......
r557 | jbalint | 2007-07-10 09:23:07 -0700 (Tue, 10 Jul 2007) | 2 lines
Fixed bad use of memory related to setup/util/GUI. (Bug#27315)
.......
r558 | jbalint | 2007-07-10 14:48:19 -0700 (Tue, 10 Jul 2007) | 6 lines
Added a new DSN "OPTION" (FLAG_ZERO_DATE_TO_MIN) to retrieve XXXX-00-00
dates as the minimum allowed ODBC date (XXXX-01-01). Added another
option (FLAG_MIN_DATE_TO_ZERO) to mirror this but for bound parameters.
FLAG_MIN_DATE_TO_ZERO only changes 0000-01-01 to 0000-00-00. (Bug #13766)
.......
r559 | jbalint | 2007-07-10 14:57:49 -0700 (Tue, 10 Jul 2007) | 4 lines
Fixed possible crash if SQLBindCol() was not called before SQLSetPos().
Fixed use of MYSQL structure pertaining to updating large blobs in
cursors. (Bug #10562)
.......
r560 | jwinstead | 2007-07-10 22:26:14 -0700 (Tue, 10 Jul 2007) | 5 lines
myodbc3i did not correctly format DSN when installing driver,
which could cause the installation to fail. (Bug #29709)
Thanks to S. Shiroki for the excellent bug report and fix.
.......
r561 | jwinstead | 2007-07-10 22:28:27 -0700 (Tue, 10 Jul 2007) | 2 lines
Fix changelog entry to be more correct
.......
r562 | jwinstead | 2007-07-11 08:50:44 -0700 (Wed, 11 Jul 2007) | 2 lines
Add missing statement close to test
.......
r563 | jbalint | 2007-07-11 08:59:04 -0700 (Wed, 11 Jul 2007) | 2 lines
fix test for bug#13766
.......
r564 | jwinstead | 2007-07-11 09:12:15 -0700 (Wed, 11 Jul 2007) | 2 lines
Fix warnings by using char * for argument to *_min_version() functions
.......
r565 | jwinstead | 2007-07-11 11:22:35 -0700 (Wed, 11 Jul 2007) | 2 lines
Handle inconsistencies in server behavior with 0000-mm-dd dates
.......
r566 | jwinstead | 2007-07-11 18:20:23 -0700 (Wed, 11 Jul 2007) | 2 lines
Add my_bug13766 to svn:ignore
.......
r567 | jwinstead | 2007-07-11 18:21:12 -0700 (Wed, 11 Jul 2007) | 3 lines
Change data type of array of functions to be the same as how it is
requested in SQLGetFunctions().
.......
Property changes on: branches/guffert
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-541
+ /trunk:1-568
Modified: branches/guffert/ChangeLog
===================================================================
--- branches/guffert/ChangeLog 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/ChangeLog 2007-07-12 01:45:35 UTC (rev 569)
@@ -38,8 +38,12 @@
set for a connection. This must be used instead of a "SET NAMES"
statement. Also available from the GUI setup dialog. (Related
to Bug #6667 and Bug #9498.)
+ * Dis-allow NULL ptr for null indicator when calling SQLGetData()
+ if value is null. Now returns SQL_ERROR w/state 22002.
Bugs fixed:
+ * myodbc3i did not correctly format driver info, which could cause the
+ installation to fail. (Bug #29709)
* Multiple result sets were not correctly flushed when a statement
handle was closed. (Bug #16817)
* SQLProcedures() did not handle NULL parameters, which could lead to
@@ -55,6 +59,17 @@
* Calling SQLGetDiagField with RecNumber 0,DiagIdentifier
NOT 0 returns SQL_ERROR (Bug #16224)
* Correctly return error if SQLBindCol is called with an invalid column
+ * Fixed error handling of OOM and bad connections in catalog functions.
+ This might raise errors in code paths that had ignored them in the past.
+ Gathered the logic for internal result sets into one place. (Bug #26934)
+ * Fixed bad use of memory related to setup/util/GUI. (Bug #27315)
+ * Added a new DSN "OPTION" (FLAG_ZERO_DATE_TO_MIN) to retrieve XXXX-00-00
+ dates as the minimum allowed ODBC date (XXXX-01-01). Added another
+ option (FLAG_MIN_DATE_TO_ZERO) to mirror this but for bound parameters.
+ FLAG_MIN_DATE_TO_ZERO only changes 0000-01-01 to 0000-00-00. (Bug #13766)
+ * Fixed possible crash if SQLBindCol() was not called before SQLSetPos().
+ Fixed use of MYSQL structure pertaining to updating large blobs in
+ cursors. (Bug #10562)
----
Modified: branches/guffert/MYODBCDbg/MYODBCDbgLib/CMakeLists.txt
===================================================================
--- branches/guffert/MYODBCDbg/MYODBCDbgLib/CMakeLists.txt 2007-07-12 01:37:22 UTC (rev
568)
+++ branches/guffert/MYODBCDbg/MYODBCDbgLib/CMakeLists.txt 2007-07-12 01:45:35 UTC (rev
569)
@@ -1,3 +1,25 @@
+# Copyright (C) 1995-2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL
+# as it is applied to this software. View the full text of the exception
+# in file LICENSE.exceptions in the top-level directory of this software
+# distribution.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+##########################################################################
+
ADD_LIBRARY(MYODBCDbg MYODBCDbgConnectAttrString.c
MYODBCDbgConnectOptionString.c
MYODBCDbgDiagFieldString.c
@@ -12,5 +34,3 @@
MYODBCDbgStmtTypeString.c
MYODBCDbgTransactionTypeString.c)
-
-
Modified: branches/guffert/MYODBCDbg/MYODBCDbgLib/Makefile.am
===================================================================
--- branches/guffert/MYODBCDbg/MYODBCDbgLib/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/MYODBCDbg/MYODBCDbgLib/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -17,4 +17,5 @@
MYODBCDbgTransactionTypeString.c
EXTRA_DIST = \
- MYODBCDbgLib.pro
+ MYODBCDbgLib.pro \
+ CMakeLists.txt
Modified: branches/guffert/MYODBCDbg/Makefile.am
===================================================================
--- branches/guffert/MYODBCDbg/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/MYODBCDbg/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -1,5 +1,5 @@
SUBDIRS = MYODBCDbgLib
EXTRA_DIST = \
- MYODBCDbg.pro
-
+ MYODBCDbg.pro \
+ CMakeLists.txt
Modified: branches/guffert/MYODBC_MYSQL.h
===================================================================
--- branches/guffert/MYODBC_MYSQL.h 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/MYODBC_MYSQL.h 2007-07-12 01:45:35 UTC (rev 569)
@@ -8,11 +8,13 @@
{
#endif
+#define DONT_DEFINE_VOID
#include <my_global.h>
#include <my_sys.h>
#include <mysql.h>
#include <my_list.h>
#include <m_string.h>
+#include <mysqld_error.h>
#if MYSQL_VERSION_ID < MIN_MYSQL_VERSION
error "MyODBC need a newer version of the MYSQL client library to compile"
Modified: branches/guffert/Makefile.am
===================================================================
--- branches/guffert/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -125,6 +125,8 @@
PostBuildTest.bat \
Uninstall.bat \
Upgrade.bat \
+ CMakeLists.txt \
+ cmake \
doc
# Remove Subversion ".svn" subdirectories from source distribution
Modified: branches/guffert/cmake/FindODBC.cmake
===================================================================
--- branches/guffert/cmake/FindODBC.cmake 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/cmake/FindODBC.cmake 2007-07-12 01:45:35 UTC (rev 569)
@@ -1,4 +1,25 @@
+# Copyright (C) 1995-2007 MySQL AB
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# There are special exceptions to the terms and conditions of the GPL
+# as it is applied to this software. View the full text of the exception
+# in file LICENSE.exceptions in the top-level directory of this software
+# distribution.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##########################################################################
+
IF(WITH_UNIXODBC)
# check for location of odbc_config
FIND_PROGRAM(ODBC_CONFIG odbc_config
Modified: branches/guffert/dltest/Makefile.am
===================================================================
--- branches/guffert/dltest/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/dltest/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -21,4 +21,5 @@
###################################################################
EXTRA_DIST = \
- dltest.pro
+ dltest.pro \
+ CMakeLists.txt
Modified: branches/guffert/driver/Makefile.am
===================================================================
--- branches/guffert/driver/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -112,4 +112,5 @@
myutil.h \
driver.pro \
myodbc3.def \
- myodbc3.rc
+ myodbc3.rc \
+ CMakeLists.txt
Modified: branches/guffert/driver/catalog.c
===================================================================
--- branches/guffert/driver/catalog.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/catalog.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -183,6 +183,7 @@
return found;
}
+
static MYSQL_ROW fix_fields_copy(STMT FAR *stmt,MYSQL_ROW row)
{
uint i;
@@ -193,6 +194,61 @@
/**
+ Create a fake result set in the current statement
+
+ @param[in] stmt Handle to statement
+ @param[in] rowval Row array
+ @param[in] rowsize sizeof(row array)
+ @param[in] rowcnt Number of rows
+ @param[in] fields Field array
+ @param[in] fldcnt Number of fields
+
+ @return SQL_SUCCESS or SQL_ERROR (and diag is set)
+*/
+static SQLRETURN
+create_fake_resultset(STMT *stmt, gptr rowval, size_t rowsize, my_ulonglong rowcnt,
+ MYSQL_FIELD *fields, uint fldcnt)
+{
+ stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES), MYF(MY_ZEROFILL));
+ stmt->result_array= (MYSQL_ROW) my_memdup((gptr) rowval, rowsize, MYF(0));
+ if (!(stmt->result && stmt->result_array))
+ {
+ if (stmt->result)
+ my_free((gptr) stmt->result, MYF(0));
+ if (stmt->result_array)
+ my_free((gptr) stmt->result, MYF(0));
+ set_mem_error(&stmt->dbc->mysql);
+ return handle_connection_error(stmt);
+ }
+ stmt->fake_result= 1;
+ stmt->result->row_count= rowcnt;
+ mysql_link_fields(stmt, fields, fldcnt);
+ return SQL_SUCCESS;
+}
+
+
+/**
+ Create an empty fake result set in the current statement
+
+ @param[in] stmt Handle to statement
+ @param[in] rowval Row array
+ @param[in] rowsize sizeof(row array)
+ @param[in] fields Field array
+ @param[in] fldcnt Number of fields
+
+ @return SQL_SUCCESS or SQL_ERROR (and diag is set)
+*/
+static SQLRETURN
+create_empty_fake_resultset(STMT *stmt, gptr rowval, size_t rowsize,
+ MYSQL_FIELD *fields, uint fldcnt)
+{
+ MYODBCDbgInfo("%s", "Can't match anything; Returning empty set");
+ return create_fake_resultset(stmt, rowval, rowsize, 0 /* rowcnt */,
+ fields, fldcnt);
+}
+
+
+/**
Get the table status for a table or tables.
@param[in] stmt Handle to statement
@@ -202,7 +258,8 @@
@param[in] table_length Length of table name, or @c SQL_NTS
@param[in] wildcard Whether the table name is a wildcard
- @return Result of SHOW TABLE STATUS
+ @return Result of SHOW TABLE STATUS, or NULL if there is an error
+ or empty result (check mysql_errno(&stmt->dbc->mysql) != 0)
*/
static MYSQL_RES *mysql_table_status(STMT *stmt,
SQLCHAR *catalog,
@@ -234,7 +291,7 @@
But it will never match anything, so bail out now.
*/
if (table && wildcard && !*table)
- return 0;
+ return NULL;
if (table && *table)
{
@@ -249,7 +306,7 @@
MYLOG_QUERY(stmt, buff);
if (mysql_query(mysql,buff))
- return 0;
+ return NULL;
return mysql_store_result(mysql);
}
@@ -343,11 +400,9 @@
stmt->result= mysql_list_dbs(&stmt->dbc->mysql,TableQualifier);
pthread_mutex_unlock(&stmt->dbc->lock);
- if ( !stmt->result )
+ if (!stmt->result)
{
- MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
- MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
- goto empty_set;
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
}
stmt->order = SQLTABLES_qualifier_order;
@@ -356,6 +411,11 @@
stmt->array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_qualifier_values,
sizeof(SQLTABLES_qualifier_values),
MYF(0));
+ if (!stmt->array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
mysql_link_fields(stmt,SQLTABLES_fields,SQLTABLES_FIELDS);
MYODBCDbgReturnReturn( SQL_SUCCESS );
}
@@ -366,14 +426,9 @@
{
/* Return set of allowed Table owners */
MYODBCDbgInfo( "%s", "Return set of table owners / Schema names" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_owner_values,
- sizeof(SQLTABLES_owner_values),
- MYF(0));
- stmt->result->row_count= 1;
- mysql_link_fields(stmt,SQLTABLES_fields, SQLTABLES_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+ MYODBCDbgReturnReturn(create_fake_resultset(stmt, (gptr) SQLTABLES_owner_values,
+ sizeof(SQLTABLES_owner_values),
+ 1, SQLTABLES_fields,
SQLTABLES_FIELDS));
}
TableType= myodbc_get_valid_buffer( Type_buff, szTableType, cbTableType );
@@ -384,15 +439,10 @@
{
/* Return set of TableType qualifiers */
MYODBCDbgInfo( "%s", "Return set of table types" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_type_values,
- sizeof(SQLTABLES_type_values),
- MYF(0));
- stmt->result->row_count= sizeof(SQLTABLES_type_values)/
- sizeof(SQLTABLES_type_values[0]);
- mysql_link_fields(stmt,SQLTABLES_fields,SQLTABLES_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+ MYODBCDbgReturnReturn(create_fake_resultset(stmt, (gptr) SQLTABLES_type_values,
+ sizeof(SQLTABLES_type_values),
+ sizeof(SQLTABLES_type_values) /
sizeof(SQLTABLES_type_values[0]),
+ SQLTABLES_fields, SQLTABLES_FIELDS));
}
sys_result= result= NULL;
@@ -426,13 +476,23 @@
pthread_mutex_lock(&stmt->dbc->lock);
result= mysql_table_status(stmt, szTableQualifier, cbTableQualifier,
szTableName, cbTableName, TRUE);
- pthread_mutex_unlock(&stmt->dbc->lock);
- if (!result)
+ if (!result && mysql_errno(&stmt->dbc->mysql))
{
- MYODBCDbgError("%d", mysql_errno(&stmt->dbc->mysql));
- MYODBCDbgError("%s", mysql_error(&stmt->dbc->mysql));
+ SQLRETURN rc;
+ /* unknown DB will return empty set from SQLTables */
+ switch (mysql_errno(&stmt->dbc->mysql))
+ {
+ case ER_BAD_DB_ERROR:
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ goto empty_set;
+ default:
+ rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
+ }
}
+ pthread_mutex_unlock(&stmt->dbc->lock);
}
/* System tables with type as 'SYSTEM' or 'SYSTEM TABLE' */
@@ -441,18 +501,20 @@
pthread_mutex_lock(&stmt->dbc->lock);
sys_result= mysql_table_status(stmt, (SQLCHAR *)"mysql", 5,
szTableName, cbTableName, TRUE);
- pthread_mutex_unlock(&stmt->dbc->lock);
- if (!sys_result)
+ if (!sys_result && mysql_errno(&stmt->dbc->mysql))
{
- MYODBCDbgError("%d", mysql_errno(&stmt->dbc->mysql));
- MYODBCDbgError("%s", mysql_error(&stmt->dbc->mysql));
+ SQLRETURN rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
}
+ pthread_mutex_unlock(&stmt->dbc->lock);
}
if (!result && !sys_result)
goto empty_set;
+ /* assemble final result set */
{
MYSQL_ROW data= 0, row;
char *db;
@@ -479,8 +541,11 @@
if (!(stmt->result_array=
(char **)my_malloc((uint)(sizeof(char *) * SQLTABLES_FIELDS *
row_count),
- MYF(MY_FAE | MY_ZEROFILL))))
- MYODBCDbgReturnReturn(set_error(stmt, MYERR_S1001, NULL, 4001));
+ MYF(MY_ZEROFILL))))
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
data= stmt->result_array;
@@ -555,16 +620,11 @@
MYODBCDbgInfo("total tables: %ld", (long)stmt->result->row_count);
MYODBCDbgReturnReturn(SQL_SUCCESS);
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_values,
- sizeof(SQLTABLES_values),
- MYF(0));
- mysql_link_fields(stmt, SQLTABLES_fields, SQLTABLES_FIELDS);
- MYODBCDbgReturnReturn(SQL_SUCCESS);
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLTABLES_values,
+ sizeof(SQLTABLES_values),
+ SQLTABLES_fields,
+ SQLTABLES_FIELDS));
}
@@ -644,6 +704,8 @@
@param[in] cbTable Length of table
@param[in] szColumn Pattern of column names to match
@param[in] cbColumn Length of column pattern
+
+ @return Result of SHOW COLUMNS FROM, or NULL if there is an error
*/
static
MYSQL_RES *mysql_list_dbcolumns(STMT *stmt,
@@ -688,18 +750,18 @@
if (mysql_query(mysql,buff) ||
!(result= mysql_store_result(mysql)))
{
- pthread_mutex_lock(&dbc->lock);
- return 0;
+ pthread_mutex_unlock(&dbc->lock);
+ return NULL;
}
pthread_mutex_unlock(&dbc->lock);
/* Build a SELECT ... LIMIT 0 to get the field metadata. */
if (!(select= (char *)my_malloc(sizeof(char) * (ulong)result->row_count *
(NAME_LEN + 1) + NAME_LEN * 2,
- MYF(MY_FAE))))
+ MYF(0))))
{
- MYODBCDbgError( "%s", "Memory allocation failed" );
- return 0;
+ set_mem_error(mysql);
+ return NULL;
}
to= strxmov(select, "SELECT `", NullS);
@@ -728,13 +790,13 @@
pthread_mutex_lock(&dbc->lock);
if (mysql_query(mysql, select))
{
- my_free(select, MYF(MY_FAE));
+ my_free(select, MYF(0));
pthread_mutex_unlock(&dbc->lock);
- return 0;
+ return NULL;
}
result= mysql_store_result(&dbc->mysql);
pthread_mutex_unlock(&dbc->lock);
- my_free(select, MYF(MY_FAE));
+ my_free(select, MYF(0));
return result;
}
@@ -782,11 +844,19 @@
/* Get the list of tables that match szCatalog and szTable */
pthread_mutex_lock(&stmt->dbc->lock);
res= mysql_table_status(stmt, szCatalog, cbCatalog, szTable, cbTable, TRUE);
- pthread_mutex_unlock(&stmt->dbc->lock);
- /** @todo handle errors correctly, see bug #26934 */
- if (!res)
+ if (!res && mysql_errno(&stmt->dbc->mysql))
+ {
+ SQLRETURN rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
+ }
+ else if (!res)
+ {
+ pthread_mutex_unlock(&stmt->dbc->lock);
goto empty_set;
+ }
+ pthread_mutex_unlock(&stmt->dbc->lock);
stmt->result= res;
alloc= &res->field_alloc;
@@ -812,16 +882,22 @@
(SQLCHAR *)table_row[0], lengths[0],
szColumn, cbColumn);
- /** @todo handle errors correctly, see bug #26934 */
if (!table_res)
- goto error;
+ {
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
rows+= mysql_num_fields(table_res);
stmt->result_array= (char **)my_realloc((gptr)stmt->result_array,
sizeof(char *) *
SQLCOLUMNS_FIELDS * rows,
- MYF(MY_FAE|MY_ALLOW_ZERO_PTR));
+ MYF(MY_ALLOW_ZERO_PTR));
+ if (!stmt->result_array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
while ((field= mysql_fetch_field(table_res)))
{
@@ -926,20 +1002,11 @@
mysql_link_fields(stmt, SQLCOLUMNS_fields, SQLCOLUMNS_FIELDS);
MYODBCDbgReturnReturn(SQL_SUCCESS);
-error:
- if (res)
- mysql_free_result(res);
-
empty_set:
- MYODBCDbgInfo("%s", "Can't match anything; Returning empty set");
- stmt->result= (MYSQL_RES *)my_malloc(sizeof(MYSQL_RES), MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW)my_memdup((gptr) SQLCOLUMNS_values,
- sizeof(SQLCOLUMNS_values),
- MYF(0));
- mysql_link_fields(stmt, SQLCOLUMNS_fields, SQLCOLUMNS_FIELDS);
- MYODBCDbgReturnReturn(SQL_SUCCESS);
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLCOLUMNS_values,
+ sizeof(SQLCOLUMNS_values),
+ SQLCOLUMNS_fields,
+ SQLCOLUMNS_FIELDS));
}
@@ -993,7 +1060,7 @@
/*
@type : internal
- @purpose : returns columns from a perticular table
+ @purpose : returns columns from a particular table, NULL on error
*/
static MYSQL_RES *mysql_list_dbkeys(DBC FAR *dbc,
const char *db,
@@ -1002,14 +1069,14 @@
MYSQL FAR *mysql= &dbc->mysql;
char buff[255];
- if ( valid_input_parameter(db) )
+ if (valid_input_parameter(db))
strxmov(buff,"SHOW KEYS FROM ",db,".`",table,"`",NullS);
else
strxmov(buff,"SHOW KEYS FROM `",table,"`",NullS);
MYLOG_DBC_QUERY(dbc, buff);
- if ( mysql_query(mysql,buff) )
- return 0;
+ if (mysql_query(mysql,buff))
+ return NULL;
return mysql_store_result(mysql);
}
@@ -1062,12 +1129,12 @@
escape_input_parameter(mysql, TableName);
pthread_mutex_lock(&dbc->lock);
- if ( !(stmt->result= mysql_list_dbkeys(stmt->dbc,TableQualifier,TableName)) )
+ stmt->result= mysql_list_dbkeys(stmt->dbc,TableQualifier,TableName);
+ if (!stmt->result)
{
- MYODBCDbgError( "%d", mysql_errno(mysql) );
- MYODBCDbgError( "%s", mysql_error(mysql) );
- pthread_mutex_unlock(&dbc->lock);
- goto empty_set;
+ SQLRETURN rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&dbc->lock);
+ MYODBCDbgReturnReturn(rc);
}
pthread_mutex_unlock(&dbc->lock);
#if MYSQL_VERSION_ID >= 40100
@@ -1080,6 +1147,11 @@
stmt->fix_fields= fix_fields_copy;
stmt->array= (MYSQL_ROW) my_memdup((gptr) SQLSTAT_values,
sizeof(SQLSTAT_values),MYF(0));
+ if (!stmt->array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
if ( option_flag(stmt, FLAG_NO_CATALOG) )
stmt->array[0]= "";
@@ -1110,16 +1182,11 @@
MYODBCDbgInfo( "total stats count: %ld", (long)stmt->result->row_count );
MYODBCDbgReturnReturn( SQL_SUCCESS );
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLSTAT_values,
- sizeof(SQLSTAT_values),
- MYF(0));
- mysql_link_fields(stmt,SQLSTAT_fields, SQLSTAT_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLSTAT_values,
+ sizeof(SQLSTAT_values),
+ SQLSTAT_fields,
+ SQLSTAT_FIELDS));
}
/*
@@ -1157,7 +1224,7 @@
/*
@type : internal
- @purpose : returns a table privileges result
+ @purpose : returns a table privileges result, NULL on error
*/
static MYSQL_RES *mysql_list_table_priv(DBC FAR *dbc,
const char *qualifier,
@@ -1175,8 +1242,8 @@
strxmov(buff,buff," ORDER BY Db,Table_name,Table_priv,User",NullS);
MYLOG_DBC_QUERY(dbc, buff);
- if ( mysql_query(mysql,buff) )
- return 0;
+ if (mysql_query(mysql,buff))
+ return NULL;
return mysql_store_result(mysql);
}
@@ -1252,13 +1319,12 @@
my_SQLFreeStmt(hstmt,MYSQL_RESET);
pthread_mutex_lock(&stmt->dbc->lock);
- if ( !(stmt->result= mysql_list_table_priv(stmt->dbc,
- TableQualifier,TableName)) )
+ stmt->result= mysql_list_table_priv(stmt->dbc, TableQualifier,TableName);
+ if (!stmt->result)
{
- MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
- MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
- pthread_mutex_unlock(&stmt->dbc->lock);
- goto empty_set;
+ SQLRETURN rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
}
pthread_mutex_unlock(&stmt->dbc->lock);
@@ -1266,7 +1332,12 @@
stmt->result_array= (char**) my_malloc(sizeof(char*)* SQLTABLES_PRIV_FIELDS *
(ulong)stmt->result->row_count *
MY_MAX_TABPRIV_COUNT,
- MYF(MY_FAE | MY_ZEROFILL));
+ MYF(MY_ZEROFILL));
+ if (!stmt->result_array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
alloc= &stmt->result->field_alloc;
data= stmt->result_array;
row_count= 0;
@@ -1302,20 +1373,14 @@
MYODBCDbgInfo( "total table priv count: %ld", (long)row_count );
MYODBCDbgReturnReturn( SQL_SUCCESS );
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLTABLES_priv_values,
- sizeof(SQLTABLES_priv_values),
- MYF(0));
- mysql_link_fields(stmt,SQLTABLES_priv_fields,SQLTABLES_PRIV_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLTABLES_priv_values,
+ sizeof(SQLTABLES_priv_values),
+ SQLTABLES_priv_fields,
+ SQLTABLES_PRIV_FIELDS));
}
-
/*
****************************************************************************
SQLColumnPrivileges
@@ -1324,7 +1389,7 @@
/*
@type : internal
- @purpose : returns a column privileges result
+ @purpose : returns a column privileges result, NULL on error
*/
static MYSQL_RES *mysql_list_column_priv(MYSQL *mysql,
const char *qualifier,
@@ -1346,7 +1411,7 @@
" ORDER BY c.Db,c.Table_name,c.Column_name,c.Column_priv", NullS);
if ( mysql_query(mysql,buff) )
- return 0;
+ return NULL;
return mysql_store_result(mysql);
}
@@ -1429,18 +1494,22 @@
my_SQLFreeStmt(hstmt,MYSQL_RESET);
pthread_mutex_lock(&stmt->dbc->lock);
- if ( !(stmt->result= mysql_list_column_priv(&stmt->dbc->mysql,
- TableQualifier,
- TableName,ColumnName)) )
+ stmt->result= mysql_list_column_priv(&stmt->dbc->mysql, TableQualifier,
+ TableName,ColumnName);
+ if (!stmt->result)
{
- MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
- MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
- pthread_mutex_unlock(&stmt->dbc->lock);
- goto empty_set;
+ SQLRETURN rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
}
pthread_mutex_unlock(&stmt->dbc->lock);
stmt->result_array= (char**) my_malloc(sizeof(char*)*SQLCOLUMNS_PRIV_FIELDS*
- (ulong) stmt->result->row_count
*MY_MAX_COLPRIV_COUNT, MYF(MY_FAE | MY_ZEROFILL));
+ (ulong) stmt->result->row_count
*MY_MAX_COLPRIV_COUNT, MYF(MY_ZEROFILL));
+ if (!stmt->result_array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
alloc= &stmt->result->field_alloc;
data= stmt->result_array;
row_count= 0;
@@ -1477,16 +1546,11 @@
MYODBCDbgInfo( "total columns priv count: %ld", (long)row_count );
MYODBCDbgReturnReturn( SQL_SUCCESS );
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLCOLUMNS_priv_values,
- sizeof(SQLCOLUMNS_priv_values),
- MYF(0));
- mysql_link_fields(stmt,SQLCOLUMNS_priv_fields,SQLCOLUMNS_PRIV_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLCOLUMNS_priv_values,
+ sizeof(SQLCOLUMNS_priv_values),
+ SQLCOLUMNS_priv_fields,
+ SQLCOLUMNS_PRIV_FIELDS));
}
/*
@@ -1581,21 +1645,19 @@
stmt->result= mysql_list_dbcolumns(stmt, szTableQualifier, cbTableQualifier,
szTableName, cbTableName, NULL, 0);
- if ( !(result= stmt->result) )
+ if (!(result= stmt->result))
{
- MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
- MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
- goto empty_set;
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
}
if ( fColType == SQL_ROWVER )
{
/* Find possible timestamp */
if ( !(stmt->result_array= (char**)
my_malloc(sizeof(char*)*SQLSPECIALCOLUMNS_FIELDS*
- result->field_count, MYF(MY_FAE
| MY_ZEROFILL))) )
+ result->field_count,
MYF(MY_ZEROFILL))) )
{
- MYODBCDbgError( "%s", "Memory allocation failed" );
- goto empty_set;
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
}
/* Convert mysql fields to data that odbc wants */
@@ -1657,10 +1719,10 @@
}
}
if ( !(stmt->result_array= (char**)
my_malloc(sizeof(char*)*SQLSPECIALCOLUMNS_FIELDS*
- result->field_count, MYF(MY_FAE |
MY_ZEROFILL))) )
+ result->field_count,
MYF(MY_ZEROFILL))) )
{
- MYODBCDbgError( "%s", "Memory allocation failed" );
- goto empty_set;
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
}
/* Convert MySQL fields to data that odbc wants */
@@ -1703,16 +1765,11 @@
MYODBCDbgInfo( "total columns count: %ld", (long)field_count );
MYODBCDbgReturnReturn( SQL_SUCCESS );
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLSPECIALCOLUMNS_values,
- sizeof(SQLSPECIALCOLUMNS_values),
- MYF(0));
- mysql_link_fields(stmt,SQLSPECIALCOLUMNS_fields,SQLSPECIALCOLUMNS_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr)
SQLSPECIALCOLUMNS_values,
+ sizeof(SQLSPECIALCOLUMNS_values),
+ SQLSPECIALCOLUMNS_fields,
+ SQLSPECIALCOLUMNS_FIELDS));
}
/*
@@ -1791,17 +1848,21 @@
my_SQLFreeStmt(hstmt,MYSQL_RESET);
pthread_mutex_lock(&stmt->dbc->lock);
- if ( !(stmt->result= mysql_list_dbkeys(stmt->dbc,TableQualifier,TableName)) )
+ if (!(stmt->result= mysql_list_dbkeys(stmt->dbc,TableQualifier,TableName)))
{
- MYODBCDbgError( "%d", mysql_errno(&stmt->dbc->mysql) );
- MYODBCDbgError( "%s", mysql_error(&stmt->dbc->mysql) );
- pthread_mutex_unlock(&stmt->dbc->lock);
- goto empty_set;
+ SQLRETURN rc= handle_connection_error(stmt);
+ pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
}
pthread_mutex_unlock(&stmt->dbc->lock);
stmt->result_array= (char**) my_malloc(sizeof(char*)*SQLPRIM_KEYS_FIELDS*
(ulong) stmt->result->row_count,
- MYF(MY_FAE | MY_ZEROFILL));
+ MYF(MY_ZEROFILL));
+ if (!stmt->result_array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
row_count= 0;
data= stmt->result_array;
while ( (row= mysql_fetch_row(stmt->result)) )
@@ -1825,16 +1886,11 @@
MYODBCDbgInfo( "total keys count: %ld", (long)row_count );
MYODBCDbgReturnReturn( SQL_SUCCESS );
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLPRIM_KEYS_values,
- sizeof(SQLPRIM_KEYS_values),
- MYF(0));
- mysql_link_fields(stmt,SQLPRIM_KEYS_fields,SQLPRIM_KEYS_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLPRIM_KEYS_values,
+ sizeof(SQLPRIM_KEYS_values),
+ SQLPRIM_KEYS_fields,
+ SQLPRIM_KEYS_FIELDS));
}
/*
@@ -1978,15 +2034,28 @@
szFkTableName, cbFkTableName,
FALSE)))
{
- MYODBCDbgError("%d", mysql_errno(&stmt->dbc->mysql))
- MYODBCDbgError("%s", mysql_error(&stmt->dbc->mysql));
+ if (mysql_errno(&stmt->dbc->mysql))
+ {
+ SQLRETURN rc= handle_connection_error(stmt);
pthread_mutex_unlock(&stmt->dbc->lock);
+ MYODBCDbgReturnReturn(rc);
+ }
+ else
+ {
+ pthread_mutex_unlock(&stmt->dbc->lock);
goto empty_set;
+ }
+ pthread_mutex_unlock(&stmt->dbc->lock);
}
pthread_mutex_unlock(&stmt->dbc->lock);
tempdata= (char**) my_malloc(sizeof(char*)*SQLFORE_KEYS_FIELDS*
64, /* Maximum index count */
- MYF(MY_FAE | MY_ZEROFILL));
+ MYF(MY_ZEROFILL));
+ if (!tempdata)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
/* Convert mysql fields to data that odbc wants */
alloc= &stmt->result->field_alloc;
@@ -2109,29 +2178,26 @@
sizeof(char*)*SQLFORE_KEYS_FIELDS*row_count,
MYF(0));
my_free((gptr)tempdata, MYF(0));
+ if (!stmt->result_array)
+ {
+ set_mem_error(&stmt->dbc->mysql);
+ MYODBCDbgReturnReturn(handle_connection_error(stmt));
+ }
}
else /* NO FOREIGN KEY support from SERVER */
{
- /** @todo this should just goto empty_set */
- stmt->result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->eof=1;
+ goto empty_set;
}
stmt->result->row_count= row_count;
mysql_link_fields(stmt,SQLFORE_KEYS_fields,SQLFORE_KEYS_FIELDS);
MYODBCDbgInfo( "total keys count: %ld", (long)row_count );
MYODBCDbgReturnReturn( SQL_SUCCESS );
- empty_set:
- MYODBCDbgInfo( "%s", "Can't match anything; Returning empty set" );
- stmt->result= (MYSQL_RES*) my_malloc(sizeof(MYSQL_RES),MYF(MY_ZEROFILL));
- stmt->fake_result= 1;
- stmt->result->row_count= 0;
- stmt->result_array= (MYSQL_ROW) my_memdup((gptr) SQLFORE_KEYS_values,
- sizeof(SQLFORE_KEYS_values),
- MYF(0));
- mysql_link_fields(stmt,SQLFORE_KEYS_fields,SQLFORE_KEYS_FIELDS);
- MYODBCDbgReturnReturn( SQL_SUCCESS );
+empty_set:
+ MYODBCDbgReturnReturn(create_empty_fake_resultset(stmt, (gptr) SQLFORE_KEYS_values,
+ sizeof(SQLFORE_KEYS_values),
+ SQLFORE_KEYS_fields,
+ SQLFORE_KEYS_FIELDS));
}
/*
Modified: branches/guffert/driver/cursor.c
===================================================================
--- branches/guffert/driver/cursor.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/cursor.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -414,14 +414,13 @@
NET **net, SQLCHAR **to)
{
SQLCHAR *orig_to= *to;
- MYSQL mysql= stmt->dbc->mysql;
/* Negative length means either NULL or DEFAULT, so we need 7 chars. */
SQLUINTEGER length= (*param.actual_len > 0 ? *param.actual_len + 1 : 7);
if ( !(*to= (SQLCHAR *) extend_buffer(*net,(char*) *to,length)) )
return set_error(stmt,MYERR_S1001,NULL,4001);
- if ( !(*to= (SQLCHAR*) insert_param(&mysql, (char*) *to, ¶m)) )
+ if ( !(*to= (SQLCHAR*) insert_param(stmt->dbc, (char*) *to, ¶m)) )
return set_error(stmt,MYERR_S1001,NULL,4001);
/* We have to remove zero bytes or we have problems! */
@@ -433,7 +432,7 @@
param.buffer= (gptr) ",";
*param.actual_len= 1;
- if ( !(*to= (SQLCHAR*) insert_param(&mysql,(char*) *to, ¶m)) )
+ if ( !(*to= (SQLCHAR*) insert_param(stmt->dbc,(char*) *to, ¶m)) )
return set_error(stmt,MYERR_S1001,NULL,4001);
return(SQL_SUCCESS);
@@ -474,13 +473,12 @@
{
PARAM_BIND dummy;
SQLLEN dummy_len= 5; /* sizeof(" AND ") */
- MYSQL mysql= stmt->dbc->mysql;
SQLUINTEGER length= *(param->actual_len)+5;
if ( !(*to= (SQLCHAR*) extend_buffer(*net, (char*) *to,length)) )
return set_error(stmt,MYERR_S1001,NULL,4001);
- if ( !(*to= (SQLCHAR*) insert_param(&mysql, (char*) *to, param)) )
+ if ( !(*to= (SQLCHAR*) insert_param(stmt->dbc, (char*) *to, param)) )
return set_error(stmt,MYERR_S1001,NULL,4001);
/* Insert " AND ", where clause with multiple search */
@@ -489,7 +487,7 @@
dummy.buffer= (gptr) " AND ";
dummy.actual_len= &dummy_len;
- if ( !(*to= (SQLCHAR*) insert_param(&mysql, (char*) *to, &dummy)) )
+ if ( !(*to= (SQLCHAR*) insert_param(stmt->dbc, (char*) *to, &dummy)) )
return set_error(stmt,MYERR_S1001,NULL,4001);
return SQL_SUCCESS;
@@ -820,7 +818,7 @@
field= mysql_fetch_field_direct(result,ncol);
bind= stmt->bind+ncol;
- if ( bind && !bind->field )
+ if (!stmt->bind || (bind && !bind->field))
{
ignore_count++;
continue;
@@ -1131,8 +1129,7 @@
SQLUINTEGER insert_count= 1; /* num rows to insert - will be real value
when row is 0 (all) */
SQLUINTEGER count= 0; /* current row
*/
SQLLEN length;
- MYSQL mysql= stmt->dbc->mysql;
- NET *net= &mysql.net;
+ NET *net= &stmt->dbc->mysql.net;
SQLUSMALLINT ncol;
SQLCHAR *to;
ulong query_length= 0; /* our original query len so we can reset pos
if break_insert */
Modified: branches/guffert/driver/error.c
===================================================================
--- branches/guffert/driver/error.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/error.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -331,6 +331,40 @@
/*
@type : myodbc3 internal
+ @purpose : sets a my_malloc() failure on a MYSQL* connection
+*/
+void set_mem_error(MYSQL *mysql)
+{
+ mysql->net.last_errno= CR_OUT_OF_MEMORY;
+ strmov(mysql->net.last_error, "Memory allocation failed");
+ strmov(mysql->net.sqlstate, "HY001");
+}
+
+
+/**
+ Handle a connection-related error.
+
+ @param[in] stmt Statement
+*/
+SQLRETURN handle_connection_error(STMT *stmt)
+{
+ unsigned int err= mysql_errno(&stmt->dbc->mysql);
+ switch (err) {
+ case CR_SERVER_GONE_ERROR:
+ case CR_SERVER_LOST:
+ return set_stmt_error(stmt, "08S01", mysql_error(&stmt->dbc->mysql), err);
+ case CR_OUT_OF_MEMORY:
+ return set_stmt_error(stmt, "HY001", mysql_error(&stmt->dbc->mysql), err);
+ case CR_COMMANDS_OUT_OF_SYNC:
+ case CR_UNKNOWN_ERROR:
+ default:
+ return set_stmt_error(stmt, "HY000", mysql_error(&stmt->dbc->mysql), err);
+ }
+}
+
+
+/*
+ @type : myodbc3 internal
@purpose : sets the error information to appropriate handle.
it also sets the SQLSTATE based on the ODBC VERSION
*/
Modified: branches/guffert/driver/execute.c
===================================================================
--- branches/guffert/driver/execute.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/execute.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -252,7 +252,7 @@
if ( !(to= add_to_buffer(net,to,query,length)) )
goto error;
query= pos+1; /* Skipp '?' */
- if ( !(to= insert_param(&stmt->dbc->mysql,to,param)) )
+ if ( !(to= insert_param(stmt->dbc,to,param)) )
goto error;
}
length= (uint) (stmt->query_end - query);
@@ -308,12 +308,12 @@
@param[in,out] to
@param[in] param
*/
-char *insert_param(MYSQL *mysql, char *to, PARAM_BIND *param)
+char *insert_param(DBC *dbc, char *to, PARAM_BIND *param)
{
int length;
char buff[128], *data;
my_bool convert= FALSE, free_data= FALSE;
- NET *net= &mysql->net;
+ NET *net= &dbc->mysql.net;
if (!param->actual_len || *(param->actual_len) == SQL_NTS)
{
@@ -344,7 +344,7 @@
*/
else if ( *(param->actual_len) == SQL_COLUMN_IGNORE )
{
- if (is_minimum_version(mysql->server_version, "4.0.3", 5))
+ if (is_minimum_version(dbc->mysql.server_version, "4.0.3", 5))
return add_to_buffer(net,to,"DEFAULT",7);
else
return add_to_buffer(net,to,"NULL",4);
@@ -489,8 +489,12 @@
case SQL_C_TYPE_DATE:
{
DATE_STRUCT *date= (DATE_STRUCT*) data;
- sprintf(buff, "%04d-%02d-%02d",
- date->year, date->month, date->day);
+ if ((dbc->flag & FLAG_MIN_DATE_TO_ZERO) &&
+ !date->year && (date->month == date->day == 1))
+ sprintf(buff, "0000-00-00");
+ else
+ sprintf(buff, "%04d-%02d-%02d",
+ date->year, date->month, date->day);
data= buff;
length= 10;
break;
@@ -509,9 +513,14 @@
case SQL_C_TYPE_TIMESTAMP:
{
TIMESTAMP_STRUCT *time= (TIMESTAMP_STRUCT*) data;
- sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
- time->year, time->month, time->day,
- time->hour, time->minute, time->second);
+ if ((dbc->flag & FLAG_MIN_DATE_TO_ZERO) &&
+ !time->year && (time->month == time->day == 1))
+ sprintf(buff, "0000-00-00 %02d:%02d:%02d",
+ time->hour, time->minute, time->second);
+ else
+ sprintf(buff, "%04d-%02d-%02d %02d:%02d:%02d",
+ time->year, time->month, time->day,
+ time->hour, time->minute, time->second);
data= buff;
length= 19;
break;
@@ -545,7 +554,7 @@
/* Make sure we have room for a fully-escaped string. */
if (!(to= extend_buffer(net, to, length * 2)))
return 0;
- to+= mysql_real_escape_string(mysql, to, data, length);
+ to+= mysql_real_escape_string(&dbc->mysql, to, data, length);
to= add_to_buffer(net, to, "'", 1);
break;
}
Modified: branches/guffert/driver/info.c
===================================================================
--- branches/guffert/driver/info.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/info.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -1205,7 +1205,7 @@
/**
List of functions supported in the driver.
*/
-SQLINTEGER myodbc3_functions[]=
+SQLUSMALLINT myodbc3_functions[]=
{
SQL_API_SQLALLOCCONNECT,
SQL_API_SQLALLOCENV,
@@ -1304,7 +1304,7 @@
SQLUSMALLINT fFunction,
SQLUSMALLINT *pfExists)
{
- SQLINTEGER index, myodbc_func_size;
+ SQLUSMALLINT index, myodbc_func_size;
MYODBCDbgEnter;
MYODBCDbgInfo("fFunction: %d",fFunction);
@@ -1315,7 +1315,7 @@
{
for (index= 0; index < myodbc_func_size; index++)
{
- int id= myodbc3_functions[index];
+ SQLUSMALLINT id= myodbc3_functions[index];
pfExists[id >> 4]|= (1 << (id & 0x000F));
}
MYODBCDbgReturnReturn(SQL_SUCCESS);
Modified: branches/guffert/driver/myodbc3.h
===================================================================
--- branches/guffert/driver/myodbc3.h 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/myodbc3.h 2007-07-12 01:45:35 UTC (rev 569)
@@ -157,6 +157,8 @@
/* Force auto-reconnect */
#define FLAG_AUTO_RECONNECT (FLAG_SAFE << 5)
#define FLAG_AUTO_IS_NULL (FLAG_SAFE << 6) /* 8388608 Enables SQL_AUTO_IS_NULL
*/
+#define FLAG_ZERO_DATE_TO_MIN (1 << 24) /* Convert XXXX-00-00 date to ODBC min date
on results */
+#define FLAG_MIN_DATE_TO_ZERO (1 << 25) /* Convert ODBC min date to 0000-00-00 on
query */
/* We don't make any assumption about what the default may be. */
#ifndef DEFAULT_TXN_ISOLATION
Modified: branches/guffert/driver/myutil.h
===================================================================
--- branches/guffert/driver/myutil.h 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/myutil.h 2007-07-12 01:45:35 UTC (rev 569)
@@ -86,7 +86,7 @@
SQLRETURN my_pos_update(STMT FAR *stmt,STMT FAR *stmtParam,
SQLUSMALLINT irow,DYNAMIC_STRING *dynStr);
char *check_if_positioned_cursor_exists(STMT FAR *stmt, STMT FAR **stmtNew);
-char *insert_param(MYSQL *mysql, char *to,PARAM_BIND *param);
+char *insert_param(DBC *dbc, char *to,PARAM_BIND *param);
char *add_to_buffer(NET *net,char *to,char *from,ulong length);
SQLRETURN copy_lresult(SQLSMALLINT HandleType, SQLHANDLE handle,
SQLCHAR FAR *rgbValue, SQLINTEGER cbValueMax,
@@ -105,6 +105,8 @@
long fill_length, ulong *offset);
SQLRETURN set_dbc_error(DBC FAR *dbc, char *state,const char *message,uint errcode);
SQLRETURN set_stmt_error(STMT *stmt, char *state,const char *message,uint errcode);
+SQLRETURN handle_connection_error(STMT *stmt);
+void set_mem_error(MYSQL *mysql);
void translate_error(char *save_state,myodbc_errid errid,uint mysql_err);
int unireg_to_sql_datatype(STMT FAR *stmt, MYSQL_FIELD *field, char *buff,
ulong *transfer_length,ulong *precision,
@@ -124,8 +126,9 @@
int unireg_to_c_datatype(MYSQL_FIELD *field);
int default_c_type(int sql_data_type);
ulong bind_length(int sql_data_type,ulong length);
-my_bool str_to_date(SQL_DATE_STRUCT *rgbValue, const char *str,uint length);
-my_bool str_to_ts(SQL_TIMESTAMP_STRUCT *ts, const char *str);
+my_bool str_to_date(SQL_DATE_STRUCT *rgbValue, const char *str,
+ uint length, int zeroToMin);
+my_bool str_to_ts(SQL_TIMESTAMP_STRUCT *ts, const char *str, int zeroToMin);
my_bool str_to_time_st(SQL_TIME_STRUCT *ts, const char *str);
ulong str_to_time_as_long(const char *str,uint length);
void init_getfunctions(void);
Modified: branches/guffert/driver/results.c
===================================================================
--- branches/guffert/driver/results.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/results.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -69,13 +69,20 @@
{
SQLLEN tmp;
- if (!pcbValue)
- pcbValue= &tmp; /* Easier code */
+ if (!value)
+ {
+ /* pcbValue must be available if its NULL */
+ if (!pcbValue)
+ return set_stmt_error(stmt,"22002",
+ "Indicator variable required but not supplied",0);
- if (!value)
*pcbValue= SQL_NULL_DATA;
+ }
else
{
+ if (!pcbValue)
+ pcbValue= &tmp; /* Easier code */
+
switch (fCType) {
case SQL_C_CHAR:
/* Handle BLOB -> CHAR conversion */
@@ -232,7 +239,8 @@
SQL_DATE_STRUCT tmp_date;
if (!rgbValue)
rgbValue= (char *)&tmp_date;
- if (!str_to_date((SQL_DATE_STRUCT *)rgbValue, value, length))
+ if (!str_to_date((SQL_DATE_STRUCT *)rgbValue, value,
+ length, stmt->dbc->flag & FLAG_ZERO_DATE_TO_MIN))
*pcbValue= sizeof(SQL_DATE_STRUCT);
else
*pcbValue= SQL_NULL_DATA; /* ODBC can't handle 0000-00-00 dates */
@@ -245,7 +253,7 @@
field->type == MYSQL_TYPE_DATETIME)
{
SQL_TIMESTAMP_STRUCT ts;
- if (str_to_ts(&ts, value))
+ if (str_to_ts(&ts, value, stmt->dbc->flag & FLAG_ZERO_DATE_TO_MIN))
*pcbValue= SQL_NULL_DATA;
else
{
@@ -320,7 +328,8 @@
}
else
{
- if (str_to_ts((SQL_TIMESTAMP_STRUCT *)rgbValue, value))
+ if (str_to_ts((SQL_TIMESTAMP_STRUCT *)rgbValue, value,
+ stmt->dbc->flag & FLAG_ZERO_DATE_TO_MIN))
*pcbValue= SQL_NULL_DATA;
else
*pcbValue= sizeof(SQL_TIMESTAMP_STRUCT);
@@ -612,7 +621,7 @@
CharacterAttributePtr= nparam;
if ( !NumericAttributePtr )
- NumericAttributePtr= strparam;
+ NumericAttributePtr= &strparam;
if ( (error= check_result(stmt)) != SQL_SUCCESS )
MYODBCDbgReturnReturn(error);
@@ -1284,6 +1293,8 @@
MYODBCDbgInfo( "current top-row: %ld", stmt->current_row );
MYODBCDbgInfo( "rows_found: %ld", stmt->rows_found_in_set );
+ cur_row = stmt->current_row;
+
if ( stmt->stmt_options.cursor_type == SQL_CURSOR_FORWARD_ONLY )
{
if ( fFetchType != SQL_FETCH_NEXT && !(stmt->dbc->flag &
FLAG_SAFE) )
@@ -1442,6 +1453,7 @@
if ( bind->rgbValue || bind->pcbValue )
{
ulong offset,pcb_offset;
+ SQLLEN pcbValue;
if ( stmt->stmt_options.bind_type == SQL_BIND_BY_COLUMN )
{
offset= bind->cbValueMax*i;
@@ -1455,7 +1467,7 @@
bind->field,
(bind->rgbValue ? (char*)
bind->rgbValue + offset : 0),
bind->cbValueMax,
- (bind->pcbValue ? (SQLLEN*) ((char*)
bind->pcbValue + pcb_offset) : 0),
+ &pcbValue,
*values,
(lengths ? *lengths : *values ?
strlen(*values) : 0) ) )
!= SQL_SUCCESS )
@@ -1468,6 +1480,8 @@
else
res= SQL_ERROR;
}
+ if (bind->pcbValue)
+ *(bind->pcbValue + pcb_offset) = pcbValue;
}
if ( lengths )
lengths++;
Modified: branches/guffert/driver/utility.c
===================================================================
--- branches/guffert/driver/utility.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/driver/utility.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -968,7 +968,7 @@
@purpose : convert a possible string to a timestamp value
*/
-my_bool str_to_ts(SQL_TIMESTAMP_STRUCT *ts, const char *str)
+my_bool str_to_ts(SQL_TIMESTAMP_STRUCT *ts, const char *str, int zeroToMin)
{
uint year, length;
char buff[15],*to;
@@ -1009,9 +1009,18 @@
year= (digit(buff[0])*1000+digit(buff[1])*100+digit(buff[2])*10+digit(buff[3]));
- if ( buff[4] == '0' && buff[5] == '0' )
+ if (!strncmp(&buff[4], "00", 2) || !strncmp(&buff[6], "00", 2))
+ {
+ if (!zeroToMin) /* Don't convert invalid */
return 1;
+ /* convert invalid to min allowed */
+ if (!strncmp(&buff[4], "00", 2))
+ buff[5]= '1';
+ if (!strncmp(&buff[6], "00", 2))
+ buff[7]= '1';
+ }
+
ts->year= year;
ts->month= digit(buff[4])*10+digit(buff[5]);
ts->day= digit(buff[6])*10+digit(buff[7]);
@@ -1049,10 +1058,13 @@
/*
@type : myodbc internal
- @purpose : convert a possible string to a data value
+ @purpose : convert a possible string to a data value. if
+ zeroToMin is specified, YEAR-00-00 dates will be
+ converted to the min valid ODBC date
*/
-my_bool str_to_date(SQL_DATE_STRUCT *rgbValue, const char *str,uint length)
+my_bool str_to_date(SQL_DATE_STRUCT *rgbValue, const char *str,
+ uint length, int zeroToMin)
{
uint field_length,year_length,digits,i,date[3];
const char *pos;
@@ -1081,14 +1093,24 @@
str++;
field_length= 1; /* Rest fields can only be 2 */
}
- if ( i <= 1 || date[1] == 0 ) /* Wrong date */
+ if (i <= 1 || (i > 1 && !date[1]) || (i > 2 && !date[2]))
+ {
+ if (!zeroToMin) /* Convert? */
return 1;
- while ( i < 3 )
+
+ rgbValue->year= date[0];
+ rgbValue->month= (i > 1 && date[1]) ? date[1] : 1;
+ rgbValue->day= (i > 2 && date[2]) ? date[2] : 1;
+ }
+ else
+ {
+ while ( i < 3 )
date[i++]= 1;
- rgbValue->year= date[0];
- rgbValue->month= date[1];
- rgbValue->day= date[2];
+ rgbValue->year= date[0];
+ rgbValue->month= date[1];
+ rgbValue->day= date[2];
+ }
return 0;
}
@@ -1097,7 +1119,7 @@
@type : myodbc internal
@purpose : convert a time string to a (ulong) value.
At least following formats are recogniced
- HHMMSS HHMM HH HH.MM.SS {t HH:MM:SS }
+ HHMMSS HHMM HH HH.MM.SS {t HH:MM:SS }
@return : HHMMSS
*/
Modified: branches/guffert/dsn-editor/Makefile.am
===================================================================
--- branches/guffert/dsn-editor/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/dsn-editor/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -26,4 +26,5 @@
EXTRA_DIST = \
main.cpp \
myodbc3c.icns \
- dsn-editor.pro
+ dsn-editor.pro \
+ CMakeLists.txt
Modified: branches/guffert/installer/Makefile.am
===================================================================
--- branches/guffert/installer/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/installer/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -34,4 +34,5 @@
###################################################################
EXTRA_DIST = \
- installer.pro
+ installer.pro \
+ CMakeLists.txt
Modified: branches/guffert/installer/myodbc3i.c
===================================================================
--- branches/guffert/installer/myodbc3i.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/installer/myodbc3i.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -578,8 +578,8 @@
pszDriverInfo[nChar] = pszAttributes[nChar];
}
+ pszDriverInfo[nChar++] = '\0';
pszDriverInfo[nChar] = '\0';
- pszDriverInfo[nChar++] = '\0';
/*
Call ODBC installer to do the work.
Modified: branches/guffert/monitor/Makefile.am
===================================================================
--- branches/guffert/monitor/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/monitor/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -25,4 +25,5 @@
EXTRA_DIST = \
myodbc3m.h \
- monitor.pro
+ monitor.pro \
+ CMakeLists.txt
Modified: branches/guffert/setup/ConfigDSN.c
===================================================================
--- branches/guffert/setup/ConfigDSN.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/setup/ConfigDSN.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -83,7 +83,7 @@
goto exitConfigDSN;
}
- pDataSource->pszDRIVER = (char *)strdup( pszDriver );
+ pDataSource->pszDRIVER = (char *)_global_strdup( pszDriver );
switch ( nRequest )
{
Modified: branches/guffert/setup/MYODBCSetupDataSourceConfig.cpp
===================================================================
--- branches/guffert/setup/MYODBCSetupDataSourceConfig.cpp 2007-07-12 01:37:22 UTC (rev
568)
+++ branches/guffert/setup/MYODBCSetupDataSourceConfig.cpp 2007-07-12 01:45:35 UTC (rev
569)
@@ -63,7 +63,7 @@
{
int argc = 1;
char * argv[] = { pszAppName, NULL };
- static QApplication app( argc, argv );
+ QApplication app( argc, argv );
// MYODBCSetupDataSourceDialog *pdialogDataSource = new
MYODBCSetupDataSourceDialog( 0, pDataSource );
//
Modified: branches/guffert/setup/MYODBCSetupDataSourceDialog.cpp
===================================================================
--- branches/guffert/setup/MYODBCSetupDataSourceDialog.cpp 2007-07-12 01:37:22 UTC (rev
568)
+++ branches/guffert/setup/MYODBCSetupDataSourceDialog.cpp 2007-07-12 01:45:35 UTC (rev
569)
@@ -269,7 +269,7 @@
if ( nFlags > 0 )
{
- pDataSource->pszOPTION = (char*)malloc( 50 );
+ pDataSource->pszOPTION = (char*)_global_alloc(50);
sprintf( pDataSource->pszOPTION, "%d", nFlags );
}
}
Modified: branches/guffert/setup/MYODBCSetupDriverConnectPrompt.cpp
===================================================================
--- branches/guffert/setup/MYODBCSetupDriverConnectPrompt.cpp 2007-07-12 01:37:22 UTC (rev
568)
+++ branches/guffert/setup/MYODBCSetupDriverConnectPrompt.cpp 2007-07-12 01:45:35 UTC (rev
569)
@@ -67,7 +67,7 @@
// METHOD 2 (tested to work on XP)
int argc = 1;
char * argv[] = { pszAppName, NULL };
- static QApplication app( argc, argv );
+ QApplication app( argc, argv );
// We are most likely to come in this route as caller is unlikely to have a qApp
*/
MYODBCSetupDataSourceDialog dialogDataSource( NULL, hDBC, pDataSource );
Modified: branches/guffert/setup/Makefile.am
===================================================================
--- branches/guffert/setup/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/setup/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -162,4 +162,5 @@
TopImage.xpm \
MySQL-16.xpm \
setup.pro \
- myodbc3S.rc
+ myodbc3S.rc \
+ CMakeLists.txt
Property changes on: branches/guffert/test
___________________________________________________________________
Name: svn:ignore
- .deps
.libs
Makefile
Makefile.in
my_basics
my_blob
my_bulk
my_catalog
my_curext
my_cursor
my_datetime
my_dyn_cursor
my_error
my_info
my_keys
my_param
my_position
my_prepare
my_relative
my_result
my_scroll
my_tran
my_types
my_unicode
my_unixodbc
my_use_result
odbc.ini
odbcinst.ini
+ .deps
.libs
Makefile
Makefile.in
my_basics
my_blob
my_bug13766
my_bulk
my_catalog
my_curext
my_cursor
my_datetime
my_dyn_cursor
my_error
my_info
my_keys
my_param
my_position
my_prepare
my_relative
my_result
my_scroll
my_tran
my_types
my_unicode
my_unixodbc
my_use_result
odbc.ini
odbcinst.ini
Modified: branches/guffert/test/Makefile.am
===================================================================
--- branches/guffert/test/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -60,7 +60,8 @@
my_types \
my_unicode \
my_unixodbc \
-my_use_result
+my_use_result \
+my_bug13766
noinst_PROGRAMS= $(tap_tests)
@@ -113,7 +114,8 @@
my_types.pro \
my_unixodbc.pro \
my_use_result.pro \
- test.pro
+ test.pro \
+ CMakeLists.txt
# We want to rebuild the "test.ini" file each time, as it might need an
# update from overriding variables on the command line
Modified: branches/guffert/test/include/mytest3.h
===================================================================
--- branches/guffert/test/include/mytest3.h 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/include/mytest3.h 2007-07-12 01:45:35 UTC (rev 569)
@@ -558,7 +558,7 @@
/*
Check for minimal MySQL version
*/
-bool mysql_min_version(SQLHDBC hdbc, SQLCHAR *min_version, unsigned int length)
+bool mysql_min_version(SQLHDBC hdbc, char *min_version, unsigned int length)
{
SQLCHAR server_version[MYSQL_NAME_LEN];
SQLRETURN rc;
@@ -569,7 +569,7 @@
rc = SQLGetInfo(hdbc,SQL_DBMS_VER,server_version,MYSQL_NAME_LEN,NULL);
mycon(hdbc, rc);
- if (strncmp((char *)server_version, (char *)min_version, length) >= 0)
+ if (strncmp((char *)server_version, min_version, length) >= 0)
return true;
return false;
@@ -578,7 +578,7 @@
/*
Check for minimal Connector/ODBC version
*/
-bool driver_min_version(SQLHDBC hdbc, SQLCHAR *min_version, unsigned int length)
+bool driver_min_version(SQLHDBC hdbc, char *min_version, unsigned int length)
{
SQLCHAR driver_version[MYSQL_NAME_LEN];
SQLRETURN rc;
@@ -589,7 +589,7 @@
rc = SQLGetInfo(hdbc,SQL_DRIVER_VER,driver_version,MYSQL_NAME_LEN,NULL);
mycon(hdbc, rc);
- if (strncmp((char *)driver_version, (char *)min_version, length) >= 0)
+ if (strncmp((char *)driver_version, min_version, length) >= 0)
return true;
return false;
Modified: branches/guffert/test/include/odbctap.h
===================================================================
--- branches/guffert/test/include/odbctap.h 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/include/odbctap.h 2007-07-12 01:45:35 UTC (rev 569)
@@ -39,9 +39,12 @@
#include "mytest3.h"
#include <stdarg.h>
-#ifndef WIN32
-#include <unistd.h>
-#include <signal.h>
+#ifdef WIN32
+# include <windows.h>
+# define sleep(x) Sleep(x*1000)
+#else
+# include <unistd.h>
+# include <signal.h>
#endif
#undef printMessage
@@ -115,7 +118,7 @@
SQLHENV henv; \
SQLHDBC hdbc; \
SQLHSTMT hstmt; \
- int i, num_tests; \
+ int i, num_tests, failcnt= 0; \
ENABLE_ALARMS; \
\
/* Set from environment, possibly overrided by command line */ \
@@ -161,6 +164,8 @@
(tests[i].expect == FAIL ? "# TODO" : \
rc == SKIP ? "# SKIP " : ""), \
SKIP_REASON ? SKIP_REASON : ""); \
+ if (rc == FAIL != tests[i].expect) \
+ failcnt++; \
SKIP_REASON= NULL; /* Reset SKIP_REASON */ \
/* Re-allocate statement to reset all its properties. */ \
SQLFreeStmt(hstmt, SQL_DROP); \
@@ -169,7 +174,7 @@
\
free_basic_handles(&henv,&hdbc,&hstmt); \
\
- exit(0); \
+ exit(failcnt); \
}
@@ -375,6 +380,23 @@
} while (0);
+int check_sqlstate(SQLHSTMT hstmt, char *sqlstate)
+{
+ SQLCHAR sql_state[6];
+ SQLINTEGER err_code= 0;
+ SQLCHAR err_msg[SQL_MAX_MESSAGE_LENGTH]= {0};
+ SQLSMALLINT err_len= 0;
+
+ memset(err_msg, 'C', SQL_MAX_MESSAGE_LENGTH);
+ SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, 1, sql_state, &err_code, err_msg,
+ SQL_MAX_MESSAGE_LENGTH - 1, &err_len);
+
+ is_str(sql_state, (SQLCHAR *)sqlstate, 5);
+
+ return OK;
+}
+
+
/**
*/
static void print_diag(SQLRETURN rc, SQLSMALLINT htype, SQLHANDLE handle,
@@ -444,8 +466,8 @@
{
SQLRETURN rc;
- rc= SQLEndTran(SQL_HANDLE_DBC, *hdbc, SQL_COMMIT);
- mycon(*hdbc, rc);
+ /* We don't care if this succeeds, the connection may have gone away. */
+ (void)SQLEndTran(SQL_HANDLE_DBC, *hdbc, SQL_COMMIT);
rc= SQLFreeStmt(*hstmt, SQL_DROP);
mystmt(*hstmt,rc);
Modified: branches/guffert/test/my_blob.c
===================================================================
--- branches/guffert/test/my_blob.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/my_blob.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -751,6 +751,42 @@
}
+/*
+ * Bug #10562 - Large blobs fail in a cursor
+ */
+DECLARE_TEST(t_bug10562)
+{
+ SQLLEN bsize = 12 * 1024;
+ /* Test to just insert 12k blob */
+ SQLCHAR *blob = malloc(bsize);
+ SQLCHAR *blobcheck = malloc(bsize);
+ memset(blob, 'X', bsize);
+
+ ok_sql(hstmt, "drop table if exists t_bug10562");
+ ok_sql(hstmt, "create table t_bug10562 ( id int not null primary key, mb longblob )");
+ ok_sql(hstmt, "insert into t_bug10562 (mb) values ('zzzzzzzzzz')");
+
+ ok_stmt(hstmt, SQLExecDirect(hstmt, "select id, mb from t_bug10562", SQL_NTS));
+ ok_stmt(hstmt, SQLFetch(hstmt));
+ ok_stmt(hstmt, SQLBindCol(hstmt, 2, SQL_C_BINARY, blob, bsize, &bsize));
+ ok_stmt(hstmt, SQLSetPos(hstmt, 1, SQL_UPDATE, SQL_LOCK_NO_CHANGE));
+ ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
+
+ /* Get the data back out to verify */
+ ok_sql(hstmt, "select mb from t_bug10562");
+ ok_stmt(hstmt, SQLFetch(hstmt));
+ ok_stmt(hstmt, SQLGetData(hstmt, 1, SQL_C_BINARY, blobcheck, bsize, NULL));
+ is(!memcmp(blob, blobcheck, bsize));
+
+ ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
+
+ ok_sql(hstmt, "drop table if exists t_bug10562");
+ free(blob);
+ free(blobcheck);
+ return OK;
+}
+
+
BEGIN_TESTS
ADD_TEST(t_blob)
ADD_TEST(t_1piecewrite2)
@@ -762,6 +798,7 @@
ADD_TEST(t_text_fetch)
ADD_TEST(getdata_lenonly)
ADD_TEST(t_bug9781)
+ ADD_TEST(t_bug10562)
END_TESTS
Copied: branches/guffert/test/my_bug13766.c (from rev 567, trunk/test/my_bug13766.c)
Modified: branches/guffert/test/my_catalog.c
===================================================================
--- branches/guffert/test/my_catalog.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/my_catalog.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -82,24 +82,6 @@
}
-void check_sqlstate(SQLHSTMT hstmt,SQLCHAR *sqlstate)
-{
- SQLCHAR sql_state[6];
- SQLINTEGER err_code=0;
- SQLCHAR err_msg[SQL_MAX_MESSAGE_LENGTH]={0};
- SQLSMALLINT err_len=0;
-
- memset(err_msg,'C',SQL_MAX_MESSAGE_LENGTH);
- SQLGetDiagRec(SQL_HANDLE_STMT,hstmt,1,
- (SQLCHAR *)&sql_state,(SQLINTEGER *)&err_code,
- (SQLCHAR*)&err_msg, SQL_MAX_MESSAGE_LENGTH-1,
- (SQLSMALLINT *)&err_len);
-
- printMessage("\n\t ERROR: %s\n",err_msg);
- printMessage("\n SQLSTATE (expected:%s, obtained:%s)\n",sqlstate,sql_state);
- myassert(strcmp(sql_state,sqlstate)==0);
-
-}
#define TODBC_BIND_CHAR(n,buf) SQLBindCol(hstmt,n,SQL_C_CHAR,&buf,sizeof(buf),NULL);
@@ -108,6 +90,7 @@
SQLCHAR database[100];
SQLRETURN rc;
SQLINTEGER nrows;
+ SQLLEN lenOrNull;
SQLExecDirect(hstmt, "DROP DATABASE my_all_db_test1", SQL_NTS);
SQLExecDirect(hstmt, "DROP DATABASE my_all_db_test2", SQL_NTS);
@@ -151,31 +134,31 @@
memset(database,0,100);
rc = SQLGetData(hstmt,1,SQL_C_CHAR,(SQLCHAR *)&database,100,NULL);
mystmt(hstmt,rc);
- printMessage("\n database: %s", database);
+ printMessage("\n catalog: %s", database);
memset(database,0,100);
- rc = SQLGetData(hstmt,2,SQL_C_CHAR,(SQLCHAR *)&database,100,NULL);
+ rc = SQLGetData(hstmt,2,SQL_C_CHAR,(SQLCHAR *)&database,100,&lenOrNull);
mystmt(hstmt,rc);
- printMessage("\n table: %s", database);
- myassert(strcmp(database,"")==0);
+ printMessage("\n schema: %s", database);
+ myassert(lenOrNull == SQL_NULL_DATA);
memset(database,0,100);
- rc = SQLGetData(hstmt,3,SQL_C_CHAR,(SQLCHAR *)&database,100,NULL);
+ rc = SQLGetData(hstmt,3,SQL_C_CHAR,(SQLCHAR *)&database,100,&lenOrNull);
mystmt(hstmt,rc);
printMessage("\n table: %s", database);
- myassert(strcmp(database,"")==0);
+ myassert(lenOrNull == SQL_NULL_DATA);
memset(database,0,100);
- rc = SQLGetData(hstmt,4,SQL_C_CHAR,(SQLCHAR *)&database,100,NULL);
+ rc = SQLGetData(hstmt,4,SQL_C_CHAR,(SQLCHAR *)&database,100,&lenOrNull);
mystmt(hstmt,rc);
- printMessage("\n table: %s", database);
- myassert(strcmp(database,"")==0);
+ printMessage("\n type: %s", database);
+ myassert(lenOrNull == SQL_NULL_DATA);
memset(database,0,100);
- rc = SQLGetData(hstmt,5,SQL_C_CHAR, (SQLCHAR*)&database,100,NULL);
+ rc = SQLGetData(hstmt,5,SQL_C_CHAR, (SQLCHAR*)&database,100,&lenOrNull);
mystmt(hstmt,rc);
printMessage("\n database remark: %s", database);
- myassert(strcmp(database,"")==0);
+ myassert(lenOrNull == SQL_NULL_DATA);
SQLFreeStmt(hstmt,SQL_UNBIND);
SQLFreeStmt(hstmt,SQL_CLOSE);
@@ -218,6 +201,14 @@
rc = SQLFreeStmt(hstmt, SQL_CLOSE);
mystmt(hstmt,rc);
+ /* unknown table should be empty */
+ rc = SQLTables(hstmt,"my_all_db_test%",SQL_NTS,NULL,0,"xyz",SQL_NTS,NULL,0);
+ mystmt(hstmt,rc);
+
+ assert(0 == my_print_non_format_result(hstmt));
+ rc = SQLFreeStmt(hstmt, SQL_CLOSE);
+ mystmt(hstmt,rc);
+
rc = SQLExecDirect(hstmt, "DROP DATABASE my_all_db_test1", SQL_NTS);
mystmt(hstmt,rc);
rc = SQLExecDirect(hstmt, "DROP DATABASE my_all_db_test2", SQL_NTS);
@@ -1023,7 +1014,7 @@
ok_stmt(hstmt, SQLColumns(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0));
/* We should have at least two rows. There may be more. */
- is(myrowcount(hstmt) > 2);
+ is(myrowcount(hstmt) >= 2);
ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
@@ -1064,6 +1055,30 @@
return OK;
}
+/**
+ Bug #26934: SQLTables behavior has changed
+*/
+DECLARE_TEST(t_bug26934)
+{
+ HENV henv1;
+ HDBC hdbc1;
+ HSTMT hstmt1;
+
+ alloc_basic_handles(&henv1, &hdbc1, &hstmt1);
+
+ ok_sql(hstmt1, "SET @@wait_timeout = 1");
+ sleep(2);
+ expect_stmt(hstmt1, SQLTables(hstmt1, "%", 1, NULL, SQL_NTS, NULL, SQL_NTS,
+ NULL, SQL_NTS), SQL_ERROR);
+ if (check_sqlstate(hstmt1, "08S01") != OK)
+ return FAIL;
+
+ free_basic_handles(&henv1, &hdbc1, &hstmt1);
+
+ return OK;
+}
+
+
BEGIN_TESTS
ADD_TEST(my_columns_null)
ADD_TEST(my_drop_table)
@@ -1083,6 +1098,7 @@
ADD_TEST(bug15713)
ADD_TEST(t_bug28316)
ADD_TEST(bug8860)
+ ADD_TEST(t_bug26934)
END_TESTS
Modified: branches/guffert/test/my_error.c
===================================================================
--- branches/guffert/test/my_error.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/my_error.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -23,23 +23,6 @@
#include "odbctap.h"
-int check_sqlstate(SQLHDBC hdbc, SQLHSTMT hstmt, char *sqlstate)
-{
- SQLCHAR sql_state[6];
- SQLINTEGER err_code= 0;
- SQLCHAR err_msg[SQL_MAX_MESSAGE_LENGTH]= {0};
- SQLSMALLINT err_len= 0;
-
- memset(err_msg, 'C', SQL_MAX_MESSAGE_LENGTH);
- SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, 1, sql_state, &err_code, err_msg,
- SQL_MAX_MESSAGE_LENGTH - 1, &err_len);
-
- is_str(sql_state, (SQLCHAR *)sqlstate, 5);
-
- return OK;
-}
-
-
DECLARE_TEST(t_odbc3_error)
{
SQLHENV henv1;
@@ -63,14 +46,14 @@
ok_con(hdbc1, SQLAllocHandle(SQL_HANDLE_STMT, hdbc1, &hstmt1));
expect_sql(hstmt1, "SELECT * FROM non_existing_table", SQL_ERROR);
- if (check_sqlstate(hdbc1, hstmt1, "42S02") != OK)
+ if (check_sqlstate(hstmt1, "42S02") != OK)
return FAIL;
ok_sql(hstmt1, "DROP TABLE IF EXISTS t_error");
ok_sql(hstmt1, "CREATE TABLE t_error (id INT)");
expect_sql(hstmt1, "CREATE TABLE t_error (id INT)", SQL_ERROR);
- if (check_sqlstate(hdbc1, hstmt1, "42S01") != OK)
+ if (check_sqlstate(hstmt1, "42S01") != OK)
return FAIL;
ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
@@ -78,7 +61,7 @@
expect_stmt(hstmt1, SQLSetStmtAttr(hstmt1, SQL_ATTR_FETCH_BOOKMARK_PTR,
(SQLPOINTER)NULL, 0),
SQL_ERROR);
- if (check_sqlstate(hdbc1, hstmt1, "HYC00") != OK)
+ if (check_sqlstate(hstmt1, "HYC00") != OK)
return FAIL;
ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
@@ -118,14 +101,14 @@
ok_con(hdbc1, SQLAllocHandle(SQL_HANDLE_STMT, hdbc1, &hstmt1));
expect_sql(hstmt1, "SELECT * FROM non_existing_table", SQL_ERROR);
- if (check_sqlstate(hdbc1, hstmt1, "S0002") != OK)
+ if (check_sqlstate(hstmt1, "S0002") != OK)
return FAIL;
ok_sql(hstmt1, "DROP TABLE IF EXISTS t_error");
ok_sql(hstmt1, "CREATE TABLE t_error (id INT)");
expect_sql(hstmt1, "CREATE TABLE t_error (id INT)", SQL_ERROR);
- if (check_sqlstate(hdbc1, hstmt1, "S0001") != OK)
+ if (check_sqlstate(hstmt1, "S0001") != OK)
return FAIL;
ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
@@ -133,7 +116,7 @@
expect_stmt(hstmt1, SQLSetStmtAttr(hstmt1, SQL_ATTR_FETCH_BOOKMARK_PTR,
(SQLPOINTER)NULL, 0),
SQL_ERROR);
- if (check_sqlstate(hdbc1, hstmt1, "S1C00") != OK)
+ if (check_sqlstate(hstmt1, "S1C00") != OK)
return FAIL;
ok_stmt(hstmt1, SQLFreeStmt(hstmt1, SQL_CLOSE));
@@ -265,7 +248,7 @@
/* Now check that the connection killed returns the right SQLSTATE */
expect_sql(hstmt2, "SELECT connection_id()", SQL_ERROR);
- return check_sqlstate(hdbc2, hstmt2, "08S01");
+ return check_sqlstate(hstmt2, "08S01");
}
@@ -297,16 +280,36 @@
/* test out of range column number */
expect_stmt(hstmt, SQLBindCol(hstmt, 10, SQL_C_CHAR, "", 4, NULL), SQL_ERROR);
- is(check_sqlstate(hdbc, hstmt, "HY002") == OK);
+ is(check_sqlstate(hstmt, "HY002") == OK);
/* test (unsupported) bookmark column number */
expect_stmt(hstmt, SQLBindCol(hstmt, 0, SQL_C_CHAR, "", 4, NULL), SQL_ERROR);
- is(check_sqlstate(hdbc, hstmt, "HY002") == OK);
+ is(check_sqlstate(hstmt, "HY002") == OK);
return OK;
}
+/*
+ * Test that calling SQLGetData() without a nullind ptr
+ * when the data is null returns an error.
+ */
+DECLARE_TEST(getdata_need_nullind)
+{
+ SQLINTEGER i;
+ ok_sql(hstmt, "select 1 as i , null as j ");
+ ok_stmt(hstmt, SQLFetch(hstmt));
+
+ /* that that nullind ptr is ok when data isn't null */
+ ok_stmt(hstmt, SQLGetData(hstmt, 1, SQL_C_LONG, &i, 0, NULL));
+
+ /* now that it's an error */
+ expect_stmt(hstmt, SQLGetData(hstmt, 2, SQL_C_LONG, &i, 0, NULL),
+ SQL_ERROR);
+ return check_sqlstate(hstmt, "22002");
+}
+
+
BEGIN_TESTS
#ifndef NO_DRIVERMANAGER
ADD_TEST(t_odbc2_error)
@@ -319,6 +322,7 @@
ADD_TODO(t_bug3456)
ADD_TEST(t_bug16224)
ADD_TEST(bind_invalidcol)
+ ADD_TEST(getdata_need_nullind)
END_TESTS
RUN_TESTS
Modified: branches/guffert/test/my_unixodbc.c
===================================================================
--- branches/guffert/test/my_unixodbc.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/test/my_unixodbc.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -35,10 +35,14 @@
rc = SQLGetEnvAttr(henv1,SQL_ATTR_ODBC_VERSION,(SQLPOINTER)&ov_version,0,0);
myenv(henv1,rc);
printMessage("default odbc version:%d\n",ov_version);
+#ifdef _WIN32
+ my_assert(ov_version == SQL_OV_ODBC3);
+#else
+ my_assert(ov_version == SQL_OV_ODBC2);
+#endif
rc = SQLSetEnvAttr(henv1,SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3,0);
myenv(henv1,rc);
- my_assert(ov_version == SQL_OV_ODBC2);
rc = SQLAllocConnect(henv1,&hdbc1);
myenv(henv1,rc);
Modified: branches/guffert/util/MYODBCUtil.h
===================================================================
--- branches/guffert/util/MYODBCUtil.h 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/util/MYODBCUtil.h 2007-07-12 01:45:35 UTC (rev 569)
@@ -230,6 +230,7 @@
char *strnglobaldup( const char *s, size_t n);
# define _global_strdup(s) strglobaldup(s)
# define _global_strndup(s, n) strnglobaldup(s, n)
+# define _global_alloc(n) GlobalAlloc(GMEM_FIXED, (n))
# define _global_free(p) GlobalFree(p)
#else
# define _global_strdup(s) strdup(s)
@@ -240,6 +241,7 @@
char *myodbc_strndup( const char *s, size_t n );
# define _global_strndup(s, n) myodbc_strndup(s, n)
# endif
+# define _global_alloc malloc
# define _global_free(p) free(p)
#endif
Modified: branches/guffert/util/MYODBCUtilClearDataSource.c
===================================================================
--- branches/guffert/util/MYODBCUtilClearDataSource.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/util/MYODBCUtilClearDataSource.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -51,7 +51,7 @@
if ( pDataSource->pszOPTION )
{
_global_free( pDataSource->pszOPTION );
- pDataSource->pszDSN = NULL;
+ pDataSource->pszOPTION = NULL;
}
if ( pDataSource->pszPASSWORD )
{
Modified: branches/guffert/util/MYODBCUtilReadDataSource.c
===================================================================
--- branches/guffert/util/MYODBCUtilReadDataSource.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/util/MYODBCUtilReadDataSource.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -302,7 +302,7 @@
Some people have reported that the friendly driver name is never found so...
*/
if ( !pDataSource->pszDRIVER )
- pDataSource->pszDRIVER = MYODBCINST_DRIVER_NAME;
+ pDataSource->pszDRIVER = _global_strdup(MYODBCINST_DRIVER_NAME);
#endif
#if defined(WIN32)
Modified: branches/guffert/util/MYODBCUtilReadDataSourceStr.c
===================================================================
--- branches/guffert/util/MYODBCUtilReadDataSourceStr.c 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/util/MYODBCUtilReadDataSourceStr.c 2007-07-12 01:45:35 UTC (rev 569)
@@ -296,7 +296,7 @@
}
if ( pszName )
- free( pszName );
+ _global_free( pszName );
pszName = 0;
}
}
@@ -319,7 +319,7 @@
} /* while scan */
if ( pszName )
- free( pszName );
+ _global_free( pszName );
return TRUE;
}
Modified: branches/guffert/util/Makefile.am
===================================================================
--- branches/guffert/util/Makefile.am 2007-07-12 01:37:22 UTC (rev 568)
+++ branches/guffert/util/Makefile.am 2007-07-12 01:45:35 UTC (rev 569)
@@ -30,4 +30,5 @@
endif
EXTRA_DIST = \
- util.pro
+ util.pro \
+ CMakeLists.txt
| Thread |
|---|
| • Connector/ODBC 3.51 commit: r569 - in branches/guffert: . MYODBCDbg MYODBCDbg/MYODBCDbgLib cmake dltest driver dsn-editor installer monitor setup test... | jwinstead | 12 Jul |