bk commit - MyODBC 3.51 (1.308)

Below is the list of changes that have just been commited into a local
MyODBC 3.51 repository of 'venu'. When 'venu' does a push, they will
be propogaged to the main repository and within 2 hours after the push
into the public repository.

For more information on how to access the public repository see:
http://www.mysql.com/products/myodbc/faq_2.html#Development_ source

You can also browse the changes from public repository:
Complete repository: http://mysql.bkbits.net:8080/myodbc3/
This changeset : http://mysql.bkbits.net:8080/myodbc3/cset [at] 1.308

ChangeSet
1.308 03/10/03 10:26:12 venu [at] myvenu.com +14 -0
minor fixups

test/mytest3.h
1.2 03/10/03 10:26:10 venu [at] myvenu.com +2 -1
Portability fix when using 'cc' or 'xlc_r'

test/mytest3.c
1.2 03/10/03 10:26:10 venu [at] myvenu.com +306 -3
Portability fix when using 'cc' or 'xlc_r'

test/mytest2.c
1.3 03/10/03 10:26:10 venu [at] myvenu.com +7 -5
Portability fix when using 'cc' or 'xlc_r'

test/mytest.c
1.3 03/10/03 10:26:10 venu [at] myvenu.com +5 -7
Portability fix when using 'cc' or 'xlc_r'

test/my_keys.c
1.3 03/10/03 10:26:10 venu [at] myvenu.com +1 -1
Portability fix when using 'cc' or 'xlc_r'

test/my_dyn_cursor.c
1.2 03/10/03 10:26:10 venu [at] myvenu.com +4 -3
Portability fix when using 'cc' or 'xlc_r'

test/WIN-Makefile
1.3 03/10/03 10:26:10 venu [at] myvenu.com +1 -1
Fix the default testlib Windows Makefile

test/Makefile.am
1.5 03/10/03 10:26:10 venu [at] myvenu.com +2 -5
fix for Makefile.am for portability

scripts/make_win_src_distribution.sh
1.3 03/10/03 10:26:10 venu [at] myvenu.com +1 -1
minor fix

driver/results.c
1.50 03/10/03 10:26:10 venu [at] myvenu.com +35 -98
Map SQLFetch to SQLFetchScroll to take care SQL_ATTR_ROWSET_SIZE correctely

driver/handle.c
1.26 03/10/03 10:26:10 venu [at] myvenu.com +13 -1
reset stmt options moved to separate caller

driver/cursor.c
1.75 03/10/03 10:26:10 venu [at] myvenu.com +3 -1
fix for SQL_COLUMN_IGNORE option to SQLSetPos/SQLBulkOperarations with SQL_ADD (case with ADO with empty str)

RELEASE-NOTES
1.22 03/10/03 10:26:10 venu [at] myvenu.com +16 -1
Recent change additions

Makefile.am
1.20 03/10/03 10:26:10 venu [at] myvenu.com +9 -0
added bin-tar

# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: venu
# Host: myvenu.com
# Root: /home/venu/work/odbc/myodbc-3.51

--- 1.21/RELEASE-NOTES Mon Sep 22 05:33:56 2003
+++ 1.22/RELEASE-NOTES Fri Oct 3 10:26:10 2003
[at] [at] -41,13 +41,28 [at] [at]
-- Fix configure to take options from mysql_config.
Now one only have to supply --with-mysql-path instead of
--with-mysql-libs and --with-mysql-includes
- This also fixes linking problems with libraries like ssl
+ This also fixes linking problems with libraries like ssl
-- Fix compiler warnings
-- Compile thread safe library as default
-- Disable sigpipe if not compiling threadsafe
-- Test are now run with users 'odbc', password ''
-- Big code cleanup to make the code (more) conformant to MYSQL coding
conventions
+-- Fixed a crash when SQLSetPos is called with SQL_ADD to insert
+ a record with empty value i.e. when pcbValue is SQL_COLUMN_IGNORE
+-- Fixed SQLFetch to return and update SQL_ATTR_ROWS_FETCHED_PTR and
+ SQL_ATTR_ROW_STATUS_PTR statement attribute pointers appropriately
+-- Fixed SQLFetch to take care SQL_ROWSET_SIZE correctly.
+-- Added internal MyODBC test library under 'test' directory
+-- Added bin-tar to Makefile.am to generate the binary distro directly
+-- Added make_win_src_distribution.sh to scripts/ to generate Windows
+ source archieve.
+-- Source code structure change to take care of Windows files and its
+ Makefiles separately into 'win32' directory.
+
+The following list of bug reports from http://bugs.mysql.com, has
+been fixed or addressed in this release:
+


3.51.6

--- 1.74/driver/cursor.c Mon Sep 22 05:33:56 2003
+++ 1.75/driver/cursor.c Fri Oct 3 10:26:10 2003
[at] [at] -1043,6 +1043,8 [at] [at]
{
if (*bind->pcbValue == SQL_NTS)
length= strlen(param.buffer);
+ else if (*bind->pcbValue == SQL_COLUMN_IGNORE)
+ length= SQL_NULL_DATA;
else length= *bind->pcbValue;
}
else length= bind->cbValueMax;
[at] [at] -1228,7 +1230,7 [at] [at]
*/
sqlRet= my_SQLExtendedFetch(hstmt, SQL_FETCH_ABSOLUTE, irow,
stmt->stmt_options.rowsFetchedPtr,
- stmt->stmt_options.rowStatusPtr);
+ stmt->stmt_options.rowStatusPtr, 0);
break;
}


--- 1.19/Makefile.am Wed Sep 24 02:04:04 2003
+++ 1.20/Makefile.am Fri Oct 3 10:26:10 2003
[at] [at] -31,6 +31,7 [at] [at]
AUTOMAKE_OPTIONS=foreign
INCLUDES = [at] MYSQL_INCLUDES [at]
LDFLAGS= [at] EXTRA_LDFLAGS [at]
+build="connector-odbc- [at] VERSION [at] - [at] SYSTEM_TYPE [at] - [at] MACHINE_TYPE [at] "

SUBDIRS = driver \
[at] myodbc_thread_dir [at] \
[at] [at] -43,6 +44,14 [at] [at]
#
bin-dist:all
$(top_builddir)/scripts/make_binary_distribution
+
+bin-tar:all
+ mkdir $(build)
+ $(MAKE) install prefix=`pwd`/$(build)
+ cp COPYING INSTALL README ChangeLog INSTALL-BINARY RELEASE-NOTES odbc.ini $(build)/
+ tar cvf $(build).tar $(build)
+ gzip -9vf $(build).tar
+ rm -rf $(build)

#
# Run the samples

--- 1.49/driver/results.c Fri Sep 19 07:48:32 2003
+++ 1.50/driver/results.c Fri Oct 3 10:26:10 2003
[at] [at] -637,93 +637,6 [at] [at]

/*
[at] type : ODBC 1.0 API
- [at] purpose : fetches the next rowset of data from the result set and
- returns data for all bound columns
-*/
-
-SQLRETURN SQL_API SQLFetch(SQLHSTMT hstmt)
-{
- MYSQL_ROW values;
- SQLRETURN res,tmp_res;
- STMT FAR *stmt= (STMT FAR*) hstmt;
- DBUG_ENTER("SQLFetch");
-
- if (!stmt->result)
- DBUG_RETURN_STATUS(set_stmt_error(stmt,"24000","Fetch without a SELECT",
- 0));
-
- if (stmt->result_array)
- {
- if ((ulong) stmt->current_row >= stmt->result->row_count)
- DBUG_RETURN_STATUS(SQL_NO_DATA_FOUND);
- values= (stmt->result_array+(stmt->current_row++)*
- stmt->result->field_count);
- }
- else
- {
- /* check for the previous first row fetch */
- if (stmt->current_row == 0 && stmt->rows_found_in_set > 0)
- mysql_data_seek(stmt->result, 1L);
- if (!(values= mysql_fetch_row(stmt->result)))
- DBUG_RETURN_STATUS(SQL_NO_DATA_FOUND);
- DBUG_PRINT("info",("current row: %ld", stmt->current_row+1));
- stmt->current_row++; /* For SQLGetStmtOption */
- if (stmt->fix_fields)
- values= (*stmt->fix_fields)(stmt,values);
- else
- stmt->result_lengths= mysql_fetch_lengths(stmt->result);
- }
- stmt->current_values= values; /* For SQLGetData */
- stmt->last_getdata_col= (uint) ~0;
-
- res= SQL_SUCCESS;
- if (stmt->bind)
- {
- ulong *lengths= stmt->result_lengths;
- BIND *bind,*end;
-
- if (!(stmt->dbc->flag & FLAG_NO_LOCALE))
- setlocale(LC_NUMERIC,"English"); /* force use of '.' as decimal point */
- for (bind= stmt->bind,end= bind + stmt->result->field_count ;
- bind < end ;
- bind++,values++)
- {
- if (bind->rgbValue || bind->pcbValue)
- {
- stmt->getdata_offset= (ulong) ~0L;
- if ((tmp_res= sql_get_data(stmt,bind->fCType,bind->field,
- bind->rgbValue,
- bind->cbValueMax, bind->pcbValue,
- *values, lengths ? *lengths : *values ?
- strlen(*values) : 0)) != SQL_SUCCESS)
- {
- if (tmp_res == SQL_SUCCESS_WITH_INFO)
- {
- DBUG_PRINT("info",("Problem with column: %d, value: '%s'",
- (int) (bind - stmt->bind)+1,
- *values ? *values : "NULL"));
- if (res == SQL_SUCCESS)
- res= tmp_res;
- }
- else
- res= SQL_ERROR;
- }
- }
- if (lengths)
- lengths++;
- }
- if (!(stmt->dbc->flag & FLAG_NO_LOCALE))
- setlocale(LC_NUMERIC,default_locale);
- }
- if (res == SQL_SUCCESS && stmt->stmt_options.rowsFetchedPtr)
- *stmt->stmt_options.rowsFetchedPtr= stmt->rows_found_in_set;
- stmt->getdata_offset= (ulong) ~0L;
- DBUG_RETURN_STATUS(res);
-}
-
-
-/*
- [at] type : ODBC 1.0 API
[at] purpose : retrieves data for a single column in the result set. It can
be called multiple times to retrieve variable-length data
in parts
[at] [at] -1100,7 +1013,7 [at] [at]
SQLRETURN SQL_API
my_SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType,
SQLINTEGER irow, SQLUINTEGER FAR *pcrow,
- SQLUSMALLINT FAR *rgfRowStatus)
+ SQLUSMALLINT FAR *rgfRowStatus, bool upd_status)
{
ulong rows_to_fetch;
long cur_row, max_row;
[at] [at] -1137,9 +1050,6 [at] [at]
"Driver Failed to set the internal dynamic result",
0));

- if (stmt->stmt_options.rowsFetchedPtr)
- *stmt->stmt_options.rowsFetchedPtr= 0;
-
if (!pcrow)
pcrow= &dummy_pcrow;

[at] [at] -1225,6 +1135,8 [at] [at]
{
*pcrow= 0;
stmt->rows_found_in_set= 0;
+ if (upd_status && stmt->stmt_options.rowsFetchedPtr)
+ *stmt->stmt_options.rowsFetchedPtr= 0;
DBUG_RETURN_STATUS(SQL_NO_DATA_FOUND);
}

[at] [at] -1256,10 +1168,11 [at] [at]
stmt->current_values= values;
}
if (rgfRowStatus)
- {
rgfRowStatus[i]= SQL_ROW_SUCCESS;
- stmt->stmt_options.rowStatusPtr= rgfRowStatus;
- }
+
+ if (upd_status && stmt->stmt_options.rowStatusPtr)
+ stmt->stmt_options.rowStatusPtr[i]= SQL_ROW_SUCCESS;
+
if (stmt->bind) /* Should always be true */
{
ulong *lengths= stmt->result_lengths;
[at] [at] -1310,12 +1223,16 [at] [at]
stmt->rows_found_in_set= i;
*pcrow= i;

- if (stmt->stmt_options.rowsFetchedPtr) /* If SQLExtendedFetch */
+ if (upd_status && stmt->stmt_options.rowsFetchedPtr)
*stmt->stmt_options.rowsFetchedPtr= i;

if (rgfRowStatus)
for (; i < stmt->stmt_options.rows_in_set ; i++)
rgfRowStatus[i]= SQL_ROW_NOROW;
+
+ if (upd_status && stmt->stmt_options.rowStatusPtr)
+ for (; i < stmt->stmt_options.rows_in_set ; i++)
+ stmt->stmt_options.rowStatusPtr[i]= SQL_ROW_NOROW;

if (!stmt->result_array && !if_forward_cache(stmt))
{
[at] [at] -1350,7 +1267,7 [at] [at]
SQLUSMALLINT FAR *rgfRowStatus)
{
return my_SQLExtendedFetch(hstmt, fFetchType, irow,
- pcrow, rgfRowStatus);
+ pcrow, rgfRowStatus, 1);
}


[at] [at] -1366,13 +1283,33 [at] [at]
SQLSMALLINT FetchOrientation,
SQLINTEGER FetchOffset)
{
- SQLRETURN result= SQL_SUCCESS;
+ SQLRETURN result;
STMT_OPTIONS *options= &((STMT FAR *)StatementHandle)->stmt_options;
DBUG_ENTER("SQLFetchScroll");

result= my_SQLExtendedFetch(StatementHandle, FetchOrientation,
FetchOffset,
options->rowsFetchedPtr,
- options->rowStatusPtr);
+ options->rowStatusPtr, 0);
+ DBUG_RETURN_STATUS(result);
+}
+
+/*
+ [at] type : ODBC 1.0 API
+ [at] purpose : fetches the next rowset of data from the result set and
+ returns data for all bound columns
+*/
+
+SQLRETURN SQL_API SQLFetch(SQLHSTMT StatementHandle)
+{
+ SQLRETURN result;
+ STMT_OPTIONS *options= &((STMT FAR *)StatementHandle)->stmt_options;
+ DBUG_ENTER("SQLFetch");
+
+ result= my_SQLExtendedFetch(StatementHandle, SQL_FETCH_NEXT,
+ 0,
+ options->rowsFetchedPtr,
+ options->rowStatusPtr, 0);
+
DBUG_RETURN_STATUS(result);
}

--- 1.2/scripts/make_win_src_distribution.sh Wed Sep 24 02:34:22 2003
+++ 1.3/scripts/make_win_src_distribution.sh Fri Oct 3 10:26:10 2003
[at] [at] -196,7 +196,7 [at] [at]
cd $SOURCE

for i in COPYING \
- CHANGES \
+ ChangeLog \
README \
INSTALL-SOURCE \
INSTALL-BINARY \

--- 1.4/test/Makefile.am Wed Sep 24 03:02:48 2003
+++ 1.5/test/Makefile.am Fri Oct 3 10:26:10 2003
[at] [at] -4,8 +4,6 [at] [at]
# (C) MySQL AB 1995-2003 #
# venu [at] mysql.com #
############################################################ ##############
-AUTOMAKE_OPTIONS=foreign
-
include Makefile.ini

noinst_PROGRAMS= \
[at] [at] -37,9 +35,8 [at] [at]
# COMPILATION SPECIFICATION
#

-INCLUDES = -I. -I../include
-LDADD = [at] myodbc_test_linklib [at]
-LDFLAGS = [at] EXTRA_LDFLAGS [at]
+INCLUDES= -I. -I../include
+AM_LDFLAGS= [at] myodbc_test_linklib [at]

#
# BUILDALL SPECIFICATION, BUILD AND RUN ALL SAMPLES

--- 1.2/test/WIN-Makefile Wed Sep 24 02:32:54 2003
+++ 1.3/test/WIN-Makefile Fri Oct 3 10:26:10 2003
[at] [at] -23,7 +23,7 [at] [at]
#

MYDSN = myodbc3
-MYUID = odbc
+MYUID =
MYPWD =

#

--- 1.1/test/my_dyn_cursor.c Tue Sep 23 16:07:11 2003
+++ 1.2/test/my_dyn_cursor.c Fri Oct 3 10:26:10 2003
[at] [at] -221,8 +221,8 [at] [at]
rc = SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 5L);
mystmt(hstmt,rc);

- //rc = SQLSetPos(hstmt,SQL_POSITION,2,SQL_LOCK_NO_CHANGE);
- //mystmt(hstmt,rc);
+ /*rc = SQLSetPos(hstmt,SQL_POSITION,2,SQL_LOCK_NO_CHANGE);
+ mystmt(hstmt,rc); */

/* now update the name field to 'update' using positioned cursor */
rc = SQLExecDirect(hstmt_pos, "UPDATE my_dynamic_cursor SET id=999, name='updated' WHERE CURRENT OF mysqlcur", SQL_NTS);
[at] [at] -531,7 +531,8 [at] [at]
SQLRETURN rc;
SQLINTEGER nlen;
SQLCHAR szData[255]={0};
- SQLUINTEGER nData, nrow;
+ SQLUINTEGER nData;
+ SQLINTEGER nrow;

myheader("my_position");


--- 1.2/test/my_keys.c Wed Sep 24 01:22:45 2003
+++ 1.3/test/my_keys.c Fri Oct 3 10:26:10 2003
[at] [at] -77,7 +77,7 [at] [at]
mystmt(hstmt,rc);

myprintf(" rows affected:%d\n",rowcount);
- //myassert(rowcount == 1);
+ /* myassert(rowcount == 1); */

rc = SQLFreeStmt(hstmt,SQL_UNBIND);
mystmt(hstmt,rc);

--- 1.2/test/mytest.c Thu Sep 25 23:48:11 2003
+++ 1.3/test/mytest.c Fri Oct 3 10:26:10 2003
[at] [at] -781,9 +781,7 [at] [at]
strcpy(szdata,"updated-one");

rc = SQLSetPos(hstmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
- mystmt(hstmt,rc);
- myprintf("rowstatus:%d\n",rgfRowStatus[0]);
- my_assert(rgfRowStatus[0] == SQL_ROW_UPDATED);
+ mystmt(hstmt,rc);

rc = SQLExtendedFetch(hstmt,SQL_FETCH_NEXT,1,0,0);
mystmt(hstmt,rc);
[at] [at] -1522,8 +1520,8 [at] [at]
rc = SQLExecDirect(hstmt1,sql,SQL_NTS);
mystmt(hstmt1,rc);

- //rc = SQLSetPos(hstmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
- //mystmt(hstmt,rc);
+ /*rc = SQLSetPos(hstmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
+ mystmt(hstmt,rc);*/

rc = SQLFreeStmt(hstmt,SQL_CLOSE);
rc = SQLFreeStmt(hstmt1,SQL_CLOSE);
[at] [at] -3939,8 +3937,8 [at] [at]
tmysql_rowstatus(hdbc,hstmt);
t_alias_setpos_pkdel(hdbc,hstmt);
tmy_cursor1(hstmt);
- //tmy_cursor2(hdbc,hstmt);
- //tmy_cursor3(hdbc,hstmt);
+ /*tmy_cursor2(hdbc,hstmt);
+ tmy_cursor3(hdbc,hstmt); */
tmysql_setpos_add(hdbc,hstmt);

}

--- 1.2/test/mytest2.c Thu Sep 25 23:48:05 2003
+++ 1.3/test/mytest2.c Fri Oct 3 10:26:10 2003
[at] [at] -1512,8 +1512,8 [at] [at]

sprintf(sql,"UPDATE t_pos_updex4 SET name = 'venu' WHERE CURRENT OF venux");

- //rc = SQLExecDirect(hstmt1,sql,SQL_NTS);
- //mystmt(hstmt1,rc);
+ /*rc = SQLExecDirect(hstmt1,sql,SQL_NTS);
+ mystmt(hstmt1,rc);*/

rc = SQLSetPos(hstmt,1,SQL_UPDATE,SQL_LOCK_NO_CHANGE);
mystmt(hstmt,rc);
[at] [at] -3944,14 +3944,16 [at] [at]
tmysql_rowstatus(hdbc,hstmt);
t_alias_setpos_pkdel(hdbc,hstmt);
tmy_cursor1(hstmt);
- //tmy_cursor2(hdbc,hstmt);
- //tmy_cursor3(hdbc,hstmt);
+#if 0
+ tmy_cursor2(hdbc,hstmt);
+ tmy_cursor3(hdbc,hstmt);
+#endif
tmysql_setpos_add(hdbc,hstmt);

}
if( tno == 3 || tno == -1) /* positioned updates and deletes */
{
- //tmysql_pos_update_ex4(hdbc,hstmt);
+ /*tmysql_pos_update_ex4(hdbc,hstmt);*/
tmysql_pos_update_ex(hdbc,hstmt);
tmysql_pos_update_ex1(hdbc,hstmt);
tmysql_pos_update_ex2(hdbc,hstmt);

--- 1.1/test/mytest3.c Tue Sep 23 16:07:11 2003
+++ 1.2/test/mytest3.c Fri Oct 3 10:26:10 2003
[at] [at] -2402,7 +2402,7 [at] [at]
rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
mycon(hdbc,rc);

- rc = tmysql_exec(hstmt,"create table t_stmtstatus(id int, name text)");
+ rc = tmysql_exec(hstmt,"create table t_stmtstatus(id int, name char(20))");
mystmt(hstmt,rc);

rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
[at] [at] -2455,6 +2455,12 [at] [at]

rc = SQLFreeStmt(hstmt,SQL_CLOSE);
mystmt(hstmt,rc);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROWS_FETCHED_PTR,(SQLPOINTER)0 ,0);
+ mystmt(hstmt,rc);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_STATUS_PTR,(SQLPOINTER)0,0 );
+ mystmt(hstmt,rc);
}
static void t_max_rows(SQLHDBC hdbc,SQLHSTMT hstmt)
{
[at] [at] -5814,10 +5820,302 [at] [at]

SQLFreeStmt(hstmt, SQL_UNBIND);
SQLFreeStmt(hstmt, SQL_CLOSE);
+}
+
+/*
+ test for SQL_ATTR_ROW_ARRAY_SIZE
+*/
+void t_row_array_size(SQLHDBC hdbc,SQLHSTMT hstmt)
+{
+ SQLRETURN rc;
+ SQLINTEGER i,nrows,iarray[15];
+ const int max_rows=9;
+
+ myheader("t_row_array_size");
+
+ SQLExecDirect(hstmt,"drop table t_row_array_size",SQL_NTS);
+
+ rc = SQLExecDirect(hstmt,"create table t_row_array_size(id int)",SQL_NTS);
+ mystmt(hstmt,rc);
+
+ rc = SQLPrepare(hstmt,"insert into t_row_array_size values(?)",SQL_NTS);
+ mystmt(hstmt,rc);
+
+ rc = SQLBindParameter(hstmt,1,SQL_PARAM_INPUT, SQL_C_ULONG,
+ SQL_INTEGER,0,0,&i,0,NULL);
+ mystmt(hstmt,rc);
+
+ for( i = 1; i <= max_rows; i++ )
+ {
+ rc = SQLExecute(hstmt);
+ mystmt(hstmt,rc);
+ }
+
+ SQLFreeStmt(hstmt,SQL_RESET_PARAMS);
+ SQLFreeStmt(hstmt,SQL_CLOSE);
+
+ rc = SQLEndTran(SQL_HANDLE_DBC,hdbc,SQL_COMMIT);
+ mycon(hdbc,rc);
+
+ /* set row_size as 2 */
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)2,S QL_IS_UINTEGER);
+ mystmt(hstmt,rc);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROWS_FETCHED_PTR,&nrows,SQL_IS _POINTER);
+ mystmt(hstmt,rc);
+
+ rc = SQLExecDirect(hstmt,"select * from t_row_array_size",SQL_NTS);
+ mystmt(hstmt,rc);
+
+ rc = SQLBindCol(hstmt,1,SQL_C_LONG,&iarray,0,NULL);
+ mystmt(hstmt,rc);
+
+ /* row 1-2 */
+ rc = SQLFetch(hstmt);
+ mystmt(hstmt,rc);
+ my_assert(nrows == 2);
+ my_assert(iarray[0]==1);
+ my_assert(iarray[1]==2);
+
+ /* row 3-4 */
+ rc = SQLFetch(hstmt);
+ mystmt(hstmt,rc);
+ my_assert(nrows == 2);
+ my_assert(iarray[0]==3);
+ my_assert(iarray[1]==4);
+
+ /* row 5-6 */
+ rc = SQLFetchScroll(hstmt,SQL_FETCH_NEXT,1);/* 1 */
+ mystmt(hstmt,rc);
+ my_assert(nrows == 2);
+ my_assert(iarray[0]==5);
+ my_assert(iarray[1]==6);
+
+ /* row 7-8 */
+ rc = SQLFetch(hstmt);
+ mystmt(hstmt,rc);
+ my_assert(nrows == 2);
+ my_assert(iarray[0]==7);
+ my_assert(iarray[1]==8);
+
+ /* row 9 */
+ rc = SQLFetch(hstmt);
+ mystmt(hstmt,rc);
+ my_assert(nrows == 1);
+ my_assert(iarray[0]==9);
+
+ rc = SQLFetch(hstmt);/* end */
+ mystmt_err(hstmt,rc==SQL_NO_DATA_FOUND,rc);
+
+ SQLFreeStmt(hstmt,SQL_UNBIND);
+ SQLFreeStmt(hstmt,SQL_CLOSE);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0 );
+ mystmt(hstmt,rc);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROWS_FETCHED_PTR,(SQLPOINTER)0 ,SQL_IS_POINTER);
+ mystmt(hstmt,rc);
+}
+
+/*
+ Test for SQL_ATTR_ROWS_FETCHED_PTR
+*/
+static void t_rows_fetched_ptr(SQLHDBC hdbc, SQLHSTMT hstmt)
+{
+ SQLCHAR name[255];
+ SQLSMALLINT pccol;
+ SQLRETURN rc;
+ SQLINTEGER rows_fetched, data[4], pcb_value[4], i;
+ SQLUSMALLINT row_status[4];
+
+ myheader("t_rows_fetched_ptr");
+
+ SQLExecDirect(hstmt,"drop table t_rows_fetched_ptr",SQL_NTS);
+
+ rc = SQLExecDirect(hstmt,"create table t_rows_fetched_ptr(id int)",SQL_NTS);
+ mystmt(hstmt,rc);
+
+ rc = SQLPrepare(hstmt,"insert into t_rows_fetched_ptr values(?)",SQL_NTS);
+ mystmt(hstmt,rc);
+
+ rc = SQLBindParameter(hstmt,1,SQL_PARAM_INPUT, SQL_C_ULONG,
+ SQL_INTEGER,0,0,&i,0,NULL);
+ mystmt(hstmt,rc);
+
+ for( i = 1; i <= 3; i++ )
+ {
+ rc = SQLExecute(hstmt);
+ mystmt(hstmt,rc);
+ }
+
+ SQLFreeStmt(hstmt,SQL_RESET_PARAMS);
+ SQLFreeStmt(hstmt,SQL_CLOSE);
+
+ rc = SQLEndTran(SQL_HANDLE_DBC,hdbc,SQL_COMMIT);
+ mycon(hdbc,rc);
+
+ rc = SQLExecDirect(hstmt,"select * from t_rows_fetched_ptr",SQL_NTS);
+ mystmt(hstmt, rc);
+
+ rc = SQLNumResultCols(hstmt, &pccol);
+ mystmt(hstmt, rc);
+ fprintf(stdout,"\n total columns: %d", pccol);
+ myassert(pccol == 1);
+
+ pccol= 0;
+ rc = SQLColAttribute(hstmt, 1, SQL_DESC_COUNT, 0, 0, 0, &pccol);
+ mystmt(hstmt, rc);
+ fprintf(stdout,"\n desc count: %d", pccol);
+ myassert(pccol == 1);
+
+ rc = SQLColAttribute(hstmt, 1, SQL_DESC_NAME, &name, 255, 0, &pccol);
+ mystmt(hstmt, rc);
+ fprintf(stdout,"\n desc name: %s", name);
+ assert(strcmp(name,"id") ==0 || strcmp(name, "ID") == 0);
+
+ rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROWS_FETCHED_PTR, &rows_fetched, SQL_IS_POINTER);
+ mystmt(hstmt, rc);
+
+ rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER)2, SQL_IS_UINTEGER);
+ mystmt(hstmt, rc);
+
+ rc = SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_STATUS_PTR, &row_status, SQL_IS_POINTER);
+ mystmt(hstmt, rc);
+
+ rc = SQLBindCol(hstmt, 1, SQL_C_LONG, (SQLPOINTER)data, 0, (SQLINTEGER *)pcb_value);
+ mystmt(hstmt, rc);
+
+ rc = SQLFetch(hstmt);
+ mystmt(hstmt, rc);
+
+ fprintf(stdout,"\n fetched ptr: %d", rows_fetched);
+ myassert(rows_fetched == 2);
+
+ for( i = 0; i < rows_fetched; i++ )
+ {
+ fprintf(stdout,"\n row[%d]:", i);
+ fprintf(stdout,"\n\t value : %d (%d)", data[i], pcb_value[i]);
+ fprintf(stdout,"\n\t status: %d", row_status[i]);
+ myassert(row_status[i] == SQL_ROW_SUCCESS);
+ }
+
+ rc = SQLFetch(hstmt);
+ mystmt(hstmt, rc);
+
+ fprintf(stdout,"\n fetched ptr: %d", rows_fetched);
+ myassert(rows_fetched == 1);
+
+ for( i = 0; i < rows_fetched; i++ )
+ {
+ fprintf(stdout,"\n row[%d]:", i);
+ fprintf(stdout,"\n\t value : %d (%d)", data[i], pcb_value[i]);
+ fprintf(stdout,"\n\t status: %d", row_status[0]);
+ myassert(row_status[i] == SQL_ROW_SUCCESS);
+ }
+ myassert(row_status[1] == SQL_ROW_NOROW);
+
+ rc = SQLFetch(hstmt);
+ myassert(rc == SQL_NO_DATA);
+
+ SQLFreeStmt(hstmt, SQL_UNBIND);
+ SQLFreeStmt(hstmt, SQL_CLOSE);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_ARRAY_SIZE,(SQLPOINTER)1,0 );
+ mystmt(hstmt,rc);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROWS_FETCHED_PTR,(SQLPOINTER)0 ,SQL_IS_POINTER);
+ mystmt(hstmt,rc);
+
+ rc = SQLSetStmtAttr(hstmt,SQL_ATTR_ROW_STATUS_PTR,(SQLPOINTER)0,0 );
+ mystmt(hstmt,rc);
+}
+
+static void tempty_str_bug(SQLHDBC hdbc, SQLHSTMT hstmt)
+{
+ SQLRETURN rc;
+ SQLINTEGER id, name_len, desc_len;
+ SQLCHAR name[20], desc[20];
+
+ myheader("tempty_str_bug");
+
+ tmysql_exec(hstmt,"drop table tempty_str_bug");
+
+ rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
+ mycon(hdbc,rc);
+
+ rc = tmysql_exec(hstmt,"CREATE TABLE tempty_str_bug(Id int NOT NULL,\
+ Name varchar(10) default NULL, \
+ Description varchar(10) default NULL, \
+ PRIMARY KEY (Id))");
+ mystmt(hstmt,rc);
+
+ rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
+ mycon(hdbc,rc);
+
+ rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+ mystmt(hstmt,rc);
+
+ rc = SQLSetCursorName(hstmt,"venu",SQL_NTS);
+ mystmt(hstmt,rc);
+
+ rc = tmysql_exec(hstmt,"select * from tempty_str_bug");
+ mystmt(hstmt,rc);
+
+ rc = SQLBindCol(hstmt,1,SQL_C_LONG,&id,0,NULL);
+ mystmt(hstmt,rc);
+
+ rc = SQLBindCol(hstmt,2,SQL_C_CHAR,&name,100,&name_len);
+ mystmt(hstmt,rc);

+ rc = SQLBindCol(hstmt,3,SQL_C_CHAR,&desc,100,&desc_len);
+ mystmt(hstmt,rc);
+
+ rc = SQLExtendedFetch(hstmt,SQL_FETCH_NEXT,1,NULL,NULL);
+ myassert(rc == SQL_NO_DATA_FOUND);
+
+ id= 10;
+ strcpy(name,"MySQL AB");name_len= SQL_NTS;
+ strcpy(desc,"");desc_len= SQL_COLUMN_IGNORE;
+
+ rc = SQLSetPos(hstmt,1,SQL_ADD,SQL_LOCK_NO_CHANGE);
+ mystmt(hstmt,rc);
+
+ rc = SQLRowCount(hstmt,&name_len);
+ mystmt(hstmt,rc);
+
+ fprintf(stdout," rows affected:%d\n",name_len);
+ myassert(name_len == 1);

+ rc = SQLFreeStmt(hstmt,SQL_UNBIND);
+ mystmt(hstmt,rc);
+
+ rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+ mystmt(hstmt,rc);
+
+ rc = tmysql_exec(hstmt,"select * from tempty_str_bug");
+ mystmt(hstmt,rc);
+
+ my_assert( 1 == myresult(hstmt));
+
+ rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+ mystmt(hstmt,rc);
+
+ rc = tmysql_exec(hstmt,"select * from tempty_str_bug");
+ mystmt(hstmt,rc);
+
+ rc = SQLExtendedFetch(hstmt,SQL_FETCH_ABSOLUTE,1,NULL,NULL);
+ mystmt(hstmt,rc);
+
+ name[0]='\0';
+ my_assert(10 == my_fetch_int(hstmt,1));
+ my_assert(!strcmp((const char *)"MySQL AB",my_fetch_str(hstmt,name,2)));
+ my_assert(!strcmp((const char *)"MySQL AB",my_fetch_str(hstmt,name,3))); /* NULL */
+
+ rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+ mystmt(hstmt,rc);
}

+
/**
mytest rountine to control individual tests
*/
[at] [at] -5853,6 +6151,7 [at] [at]
t_pos_column_ignore(hdbc,hstmt);
t_setpos_del_all(hdbc,hstmt);
t_refresh(hdbc,hstmt);
+ tempty_str_bug(hdbc, hstmt);

#if DONT_WORK
t_alias_setpos_del(hdbc,hstmt); /* can't work until 4.1 supports aliases in FIELDS */
[at] [at] -5904,13 +6203,15 [at] [at]
t_getinfo(hdbc);
}
if( tno == 12 || tno == -1) /* myodbc3 tests */
- {
+ {
+#if 0
//t_time1(hdbc,hstmt);
+ //t_blob_bug(hdbc,hstmt); /* TO BE FIXED IN DEBUG MODE */
+#endif
t_putdata(hdbc,hstmt);
t_putdata1(hdbc,hstmt);
t_putdata2(hdbc,hstmt);
t_tables_bug(hdbc,hstmt); /* To be fixed in 3.52 */
- //t_blob_bug(hdbc,hstmt); /* TO BE FIXED IN DEBUG MODE */
t_convert_type(henv,hdbc,hstmt);
t_columns(hdbc,hstmt);
t_multistep(hdbc,hstmt);
[at] [at] -5937,6 +6238,8 [at] [at]
{
t_max_rows(hdbc,hstmt);
t_stmt_attr_status(hdbc,hstmt);
+ t_rows_fetched_ptr(hdbc, hstmt);
+ t_row_array_size(hdbc, hstmt);
}
if( tno == 11 || tno == -1) /* limit tests */
{

--- 1.1/test/mytest3.h Tue Sep 23 16:07:27 2003
+++ 1.2/test/mytest3.h Fri Oct 3 10:26:10 2003
[at] [at] -410,7 +410,8 [at] [at]
SQLCHAR ColName[MAX_NAME_LEN+1];
SQLCHAR Data[MAX_ROW_DATA_LEN+1];
SQLINTEGER size, pcbLength;
- SQLUSMALLINT nIndex, ncol;
+ SQLUSMALLINT nIndex;
+ SQLSMALLINT ncol;

rc = SQLNumResultCols(hstmt,&ncol);
mystmt(hstmt,rc);

--- 1.25/driver/handle.c Mon Sep 22 05:43:46 2003
+++ 1.26/driver/handle.c Fri Oct 3 10:26:10 2003
[at] [at] -293,6 +293,15 [at] [at]
}


+void odbc_reset_stmt_options(STMT_OPTIONS *options)
+{
+ reset_ptr(options->paramProcessedPtr);
+ reset_ptr(options->paramStatusPtr);
+ reset_ptr(options->rowOperationPtr);
+ reset_ptr(options->rowsFetchedPtr);
+ reset_ptr(options->rowStatusPtr);
+}
+
/*
[at] type : myodbc3 internal
[at] purpose : stops processing associated with a specific statement,
[at] [at] -369,9 +378,12 [at] [at]
x_free((gptr) stmt->query);
stmt->query= 0;
stmt->param_count= 0;
+
if (fOption == MYSQL_RESET)
DBUG_RETURN_STATUS(SQL_SUCCESS);
- stmt->stmt_options.rowStatusPtr= 0;
+
+ odbc_reset_stmt_options(&stmt->stmt_options);
+
x_free((gptr) stmt->cursor.name);
x_free((gptr) stmt->bind);
delete_dynamic(&stmt->params);

--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe: http://lists.mysql.com/myodbc?unsub=gcdmo-myodbc [at] m.gmane.org
Venu [ Fr, 03 Oktober 2003 19:26 ] [ ID #67398 ]
Datenbanken » gmane.comp.db.mysql.odbc » bk commit - MyODBC 3.51 (1.308)

Vorheriges Thema: Mysql Socket Error
Nächstes Thema: Access MySQL table from ASP page