i'm trying run following code:
sqlsmallint** column_types = new sqlsmallint*[*columncount]; void** columnsdata = new void*[*columncount]; sqlinteger** rowlengths = new sqlinteger*[*columncount]; int limit = *columncount; for(int i=0;i<limit;i++) { column_types[i] = new sqlsmallint(); sqlcolattribute(hstmt,i+1,sql_desc_type,null,null,null,(sqlpointer)column_types[i]); sqlsmallint type = *column_types[i]; switch(type) { case sql_char: columnsdata[i] = new sqlchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlchar**)columnsdata[i])[l] = new sqlchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_char,columnsdata[i],512,rowlengths[i]); break; //<<<<<<<<<<<<<<<<<<<<<<<<<<< case sql_varchar: columnsdata[i] = new sqlchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlchar**)columnsdata[i])[l] = new sqlchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_varchar,columnsdata[i],512,rowlengths[i]); break; case sql_longvarchar: columnsdata[i] = new sqlchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlchar**)columnsdata[i])[l] = new sqlchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_longvarchar,columnsdata[i],512,rowlengths[i]); break; case sql_wchar: columnsdata[i] = new sqlwchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlwchar**)columnsdata[i])[l] = new sqlwchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_wchar,columnsdata[i],512,rowlengths[i]); break; case sql_wvarchar: columnsdata[i] = new sqlwchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlwchar**)columnsdata[i])[l] = new sqlwchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_wvarchar,columnsdata[i],512,rowlengths[i]); break; case sql_wlongvarchar: columnsdata[i] = new sqlwchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlwchar**)columnsdata[i])[l] = new sqlwchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_wlongvarchar,columnsdata[i],512,rowlengths[i]); break; case sql_decimal: columnsdata[i] = new sql_numeric_struct[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_decimal,columnsdata[i],512,rowlengths[i]); break; case sql_numeric: columnsdata[i] = new sql_numeric_struct[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_numeric,columnsdata[i],512,rowlengths[i]); break; case sql_smallint: columnsdata[i] = new sqlsmallint[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_smallint,columnsdata[i],512,rowlengths[i]); break; case sql_integer: columnsdata[i] = new sqlinteger[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_integer,columnsdata[i],512,rowlengths[i]); break; case sql_real: columnsdata[i] = new sqlreal[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_real,columnsdata[i],512,rowlengths[i]); break; case sql_float: columnsdata[i] = new sqlreal[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_float,columnsdata[i],512,rowlengths[i]); break; case sql_double: columnsdata[i] = new sqldouble[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_double,columnsdata[i],512,rowlengths[i]); break; case sql_bit: columnsdata[i] = new sqlchar[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_bit,columnsdata[i],512,rowlengths[i]); break; case sql_tinyint: columnsdata[i] = new sqlschar[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_tinyint,columnsdata[i],512,rowlengths[i]); break; case sql_bigint: columnsdata[i] = new sqlbigint[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_bigint,columnsdata[i],512,rowlengths[i]); break; case sql_binary: columnsdata[i] = new sqlchar**[*rowcount]; for(int l=0;l<*rowcount;l++) { ((sqlchar**)columnsdata[i])[l] = new sqlchar[512]; } rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_binary,columnsdata[i],512,rowlengths[i]); break; case sql_type_date: columnsdata[i] = new sql_date_struct[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; //>>>>>>>>>>>>>>> sqlbindcol(hstmt,i+1,sql_type_date,columnsdata[i],512,rowlengths[i]); break; case sql_type_time: columnsdata[i] = new sql_time_struct[*rowcount]; rowlengths[i] = new sqlinteger[*rowcount]; sqlbindcol(hstmt,i+1,sql_type_time,columnsdata[i],512,rowlengths[i]); break; default: break; } }
when gets case sql_char , gets break jumps case sql_type_date before sqlbindcol call, how possible, malfunction or doing wrong here since break supposed exit switch
i suggest commenting out of other switch cases apart sql_char
, seeing happens. if debugger steps commented out code must have optimisation on. if behaves, add other cases 1 @ time , see when problem re-appears. narrow down cause of problem.
Comments
Post a Comment