--- results.c 2010-10-28 11:33:18.000000000 -0700 +++ /cygdrive/c/3rdPartySource/trunk/mysql-connector-odbc-5.1.8/driver/results.c 2011-08-05 09:14:08.079877800 -0700 @@ -1122,9 +1122,9 @@ assert(irrec); /* catalog functions with "fake" results won't have lengths */ - length= irrec->row.datalen; - if (!length && stmt->current_values[ColumnNumber]) - length= strlen(stmt->current_values[ColumnNumber]); + length= irrec->row.datalen; + if (stmt->current_lengths) + length = stmt->current_lengths[ColumnNumber]; if (!stmt->dbc->ds->dont_use_set_locale) setlocale(LC_NUMERIC, "C"); @@ -1407,6 +1407,7 @@ max_row= (long) mysql_num_rows(stmt->result); reset_getdata_position(stmt); stmt->current_values= 0; /* For SQLGetData */ + stmt->current_lengths= 0; /* For SQLGetData */ switch ( fFetchType ) { @@ -1513,6 +1514,8 @@ save_position= mysql_row_tell(stmt->result); if ( !(values= mysql_fetch_row(stmt->result)) ) break; + if ( !(stmt->current_lengths= mysql_fetch_lengths(stmt->result)) ) + break; if ( stmt->fix_fields ) values= (*stmt->fix_fields)(stmt,values); stmt->current_values= values; --- handle.c 2010-10-28 11:33:18.000000000 -0700 +++ /cygdrive/c/3rdPartySource/trunk/mysql-connector-odbc-5.1.8/driver/handle.c 2011-07-28 10:01:01.884279400 -0700 @@ -453,6 +453,7 @@ stmt->result_array= 0; stmt->lengths= 0; stmt->current_values= 0; /* For SQLGetData */ + stmt->current_lengths= 0; /* For SQLGetData */ stmt->fix_fields= 0; stmt->affected_rows= 0; stmt->current_row= stmt->cursor_row= stmt->rows_found_in_set= 0; --- cursor.c 2010-10-28 11:33:18.000000000 -0700 +++ /cygdrive/c/3rdPartySource/trunk/mysql-connector-odbc-5.1.8/driver/cursor.c 2011-07-28 09:43:39.030479400 -0700 @@ -1343,6 +1343,7 @@ stmt->cursor_row= (long)(stmt->current_row+irow); mysql_data_seek(stmt->result,(my_ulonglong)stmt->cursor_row); stmt->current_values= mysql_fetch_row(stmt->result); + stmt->current_lengths= mysql_fetch_lengths(stmt->result); reset_getdata_position(stmt); if ( stmt->fix_fields ) stmt->current_values= (*stmt->fix_fields)(stmt,stmt->current_values); --- driver.h 2010-10-28 11:33:18.000000000 -0700 +++ /cygdrive/c/3rdPartySource/trunk/mysql-connector-odbc-5.1.8/driver/driver.h 2011-08-05 09:16:15.246677800 -0700 @@ -41,7 +41,6 @@ /* Needed for offsetof() CPP macro */ #include - #ifdef __cplusplus extern "C" { @@ -338,6 +337,7 @@ uint port; uint cursor_count; uint commit_flag; + #ifdef THREAD pthread_mutex_t lock; #endif @@ -385,6 +385,7 @@ MYSQL_RES *result; my_bool fake_result; MYSQL_ROW array,result_array,current_values; + unsigned long *current_lengths; MYSQL_ROW (*fix_fields)(struct tagSTMT FAR* stmt,MYSQL_ROW row); MYSQL_FIELD *fields; MYSQL_ROW_OFFSET end_of_set;