SQLRETURN SQLCancel( SQLHSTMT statement_handle ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p", statement ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLSetParam( SQLHSTMT statement_handle, SQLUSMALLINT parameter_number, SQLSMALLINT value_type, SQLSMALLINT parameter_type, SQLULEN length_precision, SQLSMALLINT parameter_scale, SQLPOINTER parameter_value, SQLLEN *strlen_or_ind ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tParam Number = %d\ \n\t\t\tValue Type = %d %s\ \n\t\t\tParameter Type = %d %s\ \n\t\t\tLength Precision = %d\ \n\t\t\tParameter Scale = %d\ \n\t\t\tParameter Value = %p\ \n\t\t\tStrLen Or Ind = %p", statement, parameter_number, value_type, __c_as_text( value_type ), parameter_type, __sql_as_text( parameter_type ), (int)length_precision, (int)parameter_scale, (void*)parameter_value, (void*)strlen_or_ind ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLSpecialColumns( SQLHSTMT statement_handle, SQLUSMALLINT identifier_type, SQLCHAR *catalog_name, SQLSMALLINT name_length1, SQLCHAR *schema_name, SQLSMALLINT name_length2, SQLCHAR *table_name, SQLSMALLINT name_length3, SQLUSMALLINT scope, SQLUSMALLINT nullable ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tIdentifier Type = %d\ \n\t\t\tCatalog Name = %s\ \n\t\t\tSchema Name = %s\ \n\t\t\tTable Name = %s\ \n\t\t\tScope = %d\ \n\t\t\tNullable = %d", statement, identifier_type, __string_with_length( s1, catalog_name, name_length1 ), __string_with_length( s2, schema_name, name_length2 ), __string_with_length( s3, table_name, name_length3 ), scope, nullable ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLGetData( SQLHSTMT statement_handle, SQLUSMALLINT column_number, SQLSMALLINT target_type, SQLPOINTER target_value, SQLLEN buffer_length, SQLLEN *strlen_or_ind ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ]; int unicode_switch = 0; SQLLEN ind_value; SQLCHAR *as1 = NULL; SQLCHAR s3[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tColumn Number = %d\ \n\t\t\tTarget Type = %d %s\ \n\t\t\tBuffer Length = %d\ \n\t\t\tTarget Value = %p\ \n\t\t\tStrLen Or Ind = %p", statement, column_number, target_type, __sql_as_text( target_type ), (int)buffer_length, target_value, (void*)strlen_or_ind ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLColumnPrivileges( SQLHSTMT statement_handle, SQLCHAR *catalog_name, SQLSMALLINT name_length1, SQLCHAR *schema_name, SQLSMALLINT name_length2, SQLCHAR *table_name, SQLSMALLINT name_length3, SQLCHAR *column_name, SQLSMALLINT name_length4 ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ], s4[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tCatalog Name = %s\ \n\t\t\tSchema Name = %s\ \n\t\t\tTable Name = %s\ \n\t\t\tColumn Name = %s", statement, __string_with_length( s1, catalog_name, name_length1 ), __string_with_length( s2, schema_name, name_length2 ), __string_with_length( s3, table_name, name_length3 ), __string_with_length( s4, column_name, name_length4 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLColAttribute ( SQLHSTMT statement_handle, SQLUSMALLINT column_number, SQLUSMALLINT field_identifier, SQLPOINTER character_attribute, SQLSMALLINT buffer_length, SQLSMALLINT *string_length, SQLPOINTER numeric_attribute ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret = 0; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tColumn Number = %d\ \n\t\t\tField Identifier = %s\ \n\t\t\tCharacter Attr = %p\ \n\t\t\tBuffer Length = %d\ \n\t\t\tString Length = %p\ \n\t\t\tNumeric Attribute = %p", statement, column_number, __col_attr_as_string( s1, field_identifier ), character_attribute, buffer_length, string_length, numeric_attribute ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLDescribeParam( SQLHSTMT statement_handle, SQLUSMALLINT ipar, SQLSMALLINT *pf_sql_type, SQLULEN *pcb_param_def, SQLSMALLINT *pib_scale, SQLSMALLINT *pf_nullable ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ], s4[ 100 + LOG_MESSAGE_LEN ]; SQLCHAR s6[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tParameter Number = %d\ \n\t\t\tSQL Type = %p\ \n\t\t\tParam Def = %p\ \n\t\t\tScale = %p\ \n\t\t\tNullable = %p", statement, ipar, pf_sql_type, pcb_param_def, pib_scale, pf_nullable ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLProcedures( SQLHSTMT statement_handle, SQLCHAR *sz_catalog_name, SQLSMALLINT cb_catalog_name, SQLCHAR *sz_schema_name, SQLSMALLINT cb_schema_name, SQLCHAR *sz_proc_name, SQLSMALLINT cb_proc_name ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tCatalog Name = %s\ \n\t\t\tSchema Name = %s\ \n\t\t\tProc Name = %s", statement, __string_with_length( s1, sz_catalog_name, cb_catalog_name ), __string_with_length( s2, sz_schema_name, cb_schema_name ), __string_with_length( s3, sz_proc_name, cb_proc_name )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLSetPos( SQLHSTMT statement_handle, SQLSETPOSIROW irow, SQLUSMALLINT foption, SQLUSMALLINT flock ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tIrow = %ld\ \n\t\t\tFoption = %d\ \n\t\t\tFlock = %d", statement, (long int)irow, foption, flock ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLSetScrollOptions( SQLHSTMT statement_handle, SQLUSMALLINT f_concurrency, SQLLEN crow_keyset, SQLUSMALLINT crow_rowset ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tConcurrency = %d\ \n\t\t\tKeyset = %d\ \n\t\t\tRowset = %d", statement, f_concurrency, (int)crow_keyset, crow_rowset ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLGetCursorNameW( SQLHSTMT statement_handle, SQLWCHAR *cursor_name, SQLSMALLINT buffer_length, SQLSMALLINT *name_length ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tCursor Name = %p\ \n\t\t\tBuffer Length = %d\ \n\t\t\tName Length= %p", statement, cursor_name, buffer_length, name_length ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLParamOptions( SQLHSTMT statement_handle, SQLULEN crow, SQLULEN *pirow ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tCrow = %d\ \n\t\t\tPirow = %p", statement, (int)crow, (void*)pirow ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLSetStmtOptionW( SQLHSTMT statement_handle, SQLUSMALLINT option, SQLROWCOUNT value ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; SQLWCHAR buffer[ 512 ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tOption = %s\ \n\t\t\tValue = %d", statement, __stmt_attr_as_string( s1, option ), (int)value ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLFetchScroll( SQLHSTMT statement_handle, SQLSMALLINT fetch_orientation, SQLLEN fetch_offset ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tFetch Orentation = %d\ \n\t\t\tFetch Offset = %d", statement, fetch_orientation, (int)fetch_offset ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLGetTypeInfo( SQLHSTMT statement_handle, SQLSMALLINT data_type ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tData Type = %s", statement, __type_as_string( s1, data_type )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLPrepareW( SQLHSTMT statement_handle, SQLWCHAR *statement_text, SQLINTEGER text_length ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR *s1; SQLCHAR s2[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { /* * allocate some space for the buffer */ if ( statement_text && text_length == SQL_NTS ) { s1 = malloc( wide_strlen( statement_text ) + 100 ); } else if ( statement_text ) { s1 = malloc( text_length + 100 ); } else { s1 = malloc( 101 ); } sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tSQL = %s", statement, __wstring_with_length( s1, statement_text, text_length )); free( s1 ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } thread_protect( SQL_HANDLE_STMT, statement ); if ( !statement_text ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY009" ); __post_internal_error( &statement -> error, ERROR_HY009, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } if ( text_length <= 0 && text_length != SQL_NTS ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY090" ); __post_internal_error( &statement -> error, ERROR_HY090, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } /* * check states */ #ifdef NR_PROBE if ( statement -> state == STATE_S5 || statement -> state == STATE_S6 || statement -> state == STATE_S7 ) #else if ( statement -> state == STATE_S6 || statement -> state == STATE_S7 ) #endif { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: 24000" ); __post_internal_error( &statement -> error, ERROR_24000, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } else if ( statement -> state == STATE_S8 || statement -> state == STATE_S9 || statement -> state == STATE_S10 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &statement -> error, ERROR_HY010, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } if ( statement -> state == STATE_S11 || statement -> state == STATE_S12 ) { if ( statement -> interupted_func != SQL_API_SQLPREPARE ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &statement -> error, ERROR_HY010, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } } if ( statement -> connection -> unicode_driver ) { if ( !CHECK_SQLPREPAREW( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } ret = SQLPREPAREW( statement -> connection , statement -> driver_stmt, statement_text, text_length ); } else { SQLCHAR *as1; if ( !CHECK_SQLPREPARE( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } as1 = (SQLCHAR*) unicode_to_ansi_alloc( statement_text, text_length, statement -> connection ); ret = SQLPREPARE( statement -> connection , statement -> driver_stmt, as1, text_length ); if ( as1 ) free( as1 ); } if ( SQL_SUCCEEDED( ret )) { statement -> hascols = 0; statement -> state = STATE_S3; statement -> prepared = 1; } else if ( ret == SQL_STILL_EXECUTING ) { statement -> interupted_func = SQL_API_SQLPREPARE; if ( statement -> state != STATE_S11 && statement -> state != STATE_S12 ) statement -> state = STATE_S11; } else { statement -> state = STATE_S1; } if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s2 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } return function_return( SQL_HANDLE_STMT, statement, ret ); }
SQLRETURN SQLPrimaryKeysW( SQLHSTMT statement_handle, SQLWCHAR *sz_catalog_name, SQLSMALLINT cb_catalog_name, SQLWCHAR *sz_schema_name, SQLSMALLINT cb_schema_name, SQLWCHAR *sz_table_name, SQLSMALLINT cb_table_name ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLPRIMARYKEYSW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLPRIMARYKEYSW( parent_statement -> connection, statement_handle, sz_catalog_name, cb_catalog_name, sz_schema_name, cb_schema_name, sz_table_name, cb_table_name ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tCatalog Name = %s\ \n\t\t\tSchema Name = %s\ \n\t\t\tTable Type = %s", statement, __wstring_with_length( s1, sz_catalog_name, cb_catalog_name ), __wstring_with_length( s2, sz_schema_name, cb_schema_name ), __wstring_with_length( s3, sz_table_name, cb_table_name )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLGetTypeInfoW( SQLHSTMT statement_handle, SQLSMALLINT data_type ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLGETTYPEINFOW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLGETTYPEINFOW( parent_statement -> connection, statement_handle, data_type ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tData Type = %s", statement, __type_as_string( s1, data_type )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLSetStmtOptionW( SQLHSTMT statement_handle, SQLUSMALLINT option, SQLULEN value ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; SQLWCHAR buffer[ 512 ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLSETSTMTOPTIONW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLSETSTMTOPTIONW( parent_statement -> connection, statement_handle, option, value ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tOption = %s\ \n\t\t\tValue = %d", statement, __stmt_attr_as_string( s1, option ), (int)value ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLExecDirectW( SQLHSTMT statement_handle, SQLWCHAR *statement_text, SQLINTEGER text_length ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR *s1; SQLCHAR s2[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLEXECDIRECTW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLEXECDIRECTW( parent_statement -> connection, statement, statement_text, text_length ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { /* * allocate some space for the buffer */ if ( statement_text && text_length == SQL_NTS ) { s1 = malloc( wide_strlen( statement_text ) * 2 + LOG_MESSAGE_LEN * 2 ); } else if ( statement_text ) { s1 = malloc( text_length + LOG_MESSAGE_LEN * 2 ); } else { s1 = malloc( LOG_MESSAGE_LEN * 2 ); } sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tSQL = %s", statement, __wstring_with_length( s1, statement_text, text_length )); free( s1 ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } thread_protect( SQL_HANDLE_STMT, statement ); if ( !statement_text ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY009" ); __post_internal_error( &statement -> error, ERROR_HY009, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } if ( text_length <= 0 && text_length != SQL_NTS ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY090" ); __post_internal_error( &statement -> error, ERROR_HY090, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } /* * check states */ #ifdef NR_PROBE if ( statement -> state == STATE_S5 || statement -> state == STATE_S6 || statement -> state == STATE_S7 ) #else if (( statement -> state == STATE_S6 && statement -> eod == 0 ) || statement -> state == STATE_S7 ) #endif { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: 24000" ); __post_internal_error( &statement -> error, ERROR_24000, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } else if ( statement -> state == STATE_S8 || statement -> state == STATE_S9 || statement -> state == STATE_S10 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &statement -> error, ERROR_HY010, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } if ( statement -> state == STATE_S11 || statement -> state == STATE_S12 ) { if ( statement -> interupted_func != SQL_API_SQLEXECDIRECT ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &statement -> error, ERROR_HY010, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } } if ( statement -> connection -> unicode_driver || CHECK_SQLEXECDIRECTW( statement -> connection )) { #ifdef NR_PROBE if ( !CHECK_SQLEXECDIRECTW( statement -> connection ) || !CHECK_SQLNUMRESULTCOLS( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } #else if ( !CHECK_SQLEXECDIRECTW( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } #endif ret = SQLEXECDIRECTW( statement -> connection, statement -> driver_stmt, statement_text, text_length ); } else { SQLCHAR *as1 = NULL; int clen; #ifdef NR_PROBE if ( !CHECK_SQLEXECDIRECT( statement -> connection ) || !CHECK_SQLNUMRESULTCOLS( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } #else if ( !CHECK_SQLEXECDIRECT( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } #endif as1 = (SQLCHAR*) unicode_to_ansi_alloc( statement_text, text_length, statement -> connection, &clen ); text_length = clen; ret = SQLEXECDIRECT( statement -> connection, statement -> driver_stmt, as1, text_length ); if ( as1 ) free( as1 ); } if ( SQL_SUCCEEDED( ret )) { #ifdef NR_PROBE SQLRETURN local_ret; /* * grab any errors */ if ( ret == SQL_SUCCESS_WITH_INFO ) { function_return_ex( IGNORE_THREAD, statement, ret, TRUE ); } local_ret = SQLNUMRESULTCOLS( statement -> connection, statement -> driver_stmt, &statement -> numcols ); if ( statement -> numcols > 0 ) { statement -> state = STATE_S5; } else { statement -> state = STATE_S4; } #else /* * We don't know for sure */ statement -> hascols = 1; statement -> state = STATE_S5; #endif statement -> prepared = 0; /* * there is a issue here with transactions, but for the * moment * statement -> connection -> state = STATE_C6; */ } else if ( ret == SQL_NEED_DATA ) { statement -> interupted_func = SQL_API_SQLEXECDIRECT; statement -> interupted_state = statement -> state; statement -> state = STATE_S8; statement -> prepared = 0; } else if ( ret == SQL_PARAM_DATA_AVAILABLE ) { statement -> interupted_func = SQL_API_SQLEXECDIRECT; statement -> interupted_state = statement -> state; statement -> state = STATE_S13; } else if ( ret == SQL_STILL_EXECUTING ) { statement -> interupted_func = SQL_API_SQLEXECDIRECT; if ( statement -> state != STATE_S11 && statement -> state != STATE_S12 ) statement -> state = STATE_S11; statement -> prepared = 0; } else { statement -> state = STATE_S1; } if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s2 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } return function_return( SQL_HANDLE_STMT, statement, ret ); }
SQLRETURN SQLCancelHandle( SQLSMALLINT HandleType, SQLHANDLE Handle ) { SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; switch ( HandleType ) { case SQL_HANDLE_STMT: { DMHSTMT statement = (DMHSTMT) Handle; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\n\t\t\tStatement = %p", statement ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } #if defined( HAVE_LIBPTH ) || defined( HAVE_LIBPTHREAD ) || defined( HAVE_LIBTHREAD ) /* * Allow this past the thread checks if the driver is at all thread safe, as SQLCancel can * be called across threads */ if ( statement -> connection -> protection_level == 3 ) { thread_protect( SQL_HANDLE_STMT, statement ); } #endif /* * check states */ if ( !CHECK_SQLCANCEL( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); #if defined( HAVE_LIBPTH ) || defined( HAVE_LIBPTHREAD ) || defined( HAVE_LIBTHREAD ) if ( statement -> connection -> protection_level == 3 ) { return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } else { return function_return( IGNORE_THREAD, statement, SQL_ERROR ); } #else return function_return( IGNORE_THREAD, statement, SQL_ERROR ); #endif } ret = SQLCANCEL( statement -> connection, statement -> driver_stmt ); if ( SQL_SUCCEEDED( ret )) { if ( statement -> state == STATE_S8 || statement -> state == STATE_S9 || statement -> state == STATE_S10 || statement -> state == STATE_S13 || statement -> state == STATE_S14 || statement -> state == STATE_S10 ) { if ( statement -> interupted_func == SQL_API_SQLEXECDIRECT ) { statement -> state = STATE_S1; } else if ( statement -> interupted_func == SQL_API_SQLEXECUTE ) { if ( statement -> hascols ) { statement -> state = STATE_S3; } else { statement -> state = STATE_S2; } } else if ( statement -> interupted_func == SQL_API_SQLBULKOPERATIONS ) { if ( statement -> interupted_state == STATE_S5 || statement -> interupted_state == STATE_S6 || statement -> interupted_state == STATE_S7 ) { statement -> state = STATE_S6; statement -> eod = 0; } else { statement -> state = STATE_S6; statement -> eod = 0; } } else if ( statement -> interupted_func == SQL_API_SQLSETPOS ) { if ( statement -> interupted_state == STATE_S5 || statement -> interupted_state == STATE_S6 ) { statement -> state = STATE_S6; statement -> eod = 0; } else if ( statement -> interupted_state == STATE_S7 ) { statement -> state = STATE_S7; } } } else if ( statement -> state == STATE_S11 || statement -> state == STATE_S12 ) { statement -> state = STATE_S12; } else { /* Same action as SQLFreeStmt( SQL_CLOSE ) */ if ( statement -> state == STATE_S4 ) { if ( statement -> prepared ) statement -> state = STATE_S2; else statement -> state = STATE_S1; } else { if ( statement -> prepared ) statement -> state = STATE_S3; else statement -> state = STATE_S1; } statement -> hascols = 0; } } if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s1 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } #if defined( HAVE_LIBPTH ) || defined( HAVE_LIBPTHREAD ) || defined( HAVE_LIBTHREAD ) if ( statement -> connection -> protection_level == 3 ) { return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } else { return function_return( IGNORE_THREAD, statement, ret ); } #else return function_return( IGNORE_THREAD, statement, ret ); #endif } break; case SQL_HANDLE_DBC: { DMHDBC connection = (DMHDBC) Handle; /* * check connection */ if ( !__validate_dbc( connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( connection ); if ( log_info.log_flag ) { sprintf( connection -> msg, "\n\t\tEntry:\n\t\t\tConnection = %p", connection ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, connection -> msg ); } /* * check states */ if ( !CHECK_SQLCANCELHANDLE( connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &connection -> error, ERROR_IM001, NULL, connection -> environment -> requested_version ); return function_return( IGNORE_THREAD, connection, SQL_ERROR ); } ret = SQLCANCELHANDLE( connection, SQL_HANDLE_DBC, connection -> driver_dbc ); /* * The effect this has on connection states is not defined AFAIKS */ if ( log_info.log_flag ) { sprintf( connection -> msg, "\n\t\tExit:[%s]", __get_return_status( ret, s1 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, connection -> msg ); } return function_return( IGNORE_THREAD, connection, ret ); } break; default: return SQL_INVALID_HANDLE; break; } }
SQLRETURN SQLDescribeColW( SQLHSTMT statement_handle, SQLUSMALLINT column_number, SQLWCHAR *column_name, SQLSMALLINT buffer_length, SQLSMALLINT *name_length, SQLSMALLINT *data_type, SQLULEN *column_size, SQLSMALLINT *decimal_digits, SQLSMALLINT *nullable ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ], s4[ 100 + LOG_MESSAGE_LEN ]; SQLCHAR s5[ 100 + LOG_MESSAGE_LEN ]; SQLCHAR s6[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tColumn Number = %d\ \n\t\t\tColumn Name = %p\ \n\t\t\tBuffer Length = %d\ \n\t\t\tName Length = %p\ \n\t\t\tData Type = %p\ \n\t\t\tColumn Size = %p\ \n\t\t\tDecimal Digits = %p\ \n\t\t\tNullable = %p", statement, column_number, column_name, buffer_length, name_length, data_type, column_size, decimal_digits, nullable ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLEndTran( SQLSMALLINT handle_type, SQLHANDLE handle, SQLSMALLINT completion_type ) { SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; if ( handle_type != SQL_HANDLE_ENV && handle_type != SQL_HANDLE_DBC ) { DMHSTMT statement; DMHDESC descriptor; if ( handle_type == SQL_HANDLE_STMT ) { if ( !__validate_stmt(( DMHSTMT ) handle )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } statement = (DMHSTMT) handle; function_entry( statement ); thread_protect( SQL_HANDLE_STMT, statement ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY092" ); __post_internal_error( &statement -> error, ERROR_HY092, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } else if ( handle_type == SQL_HANDLE_DESC ) { if ( !__validate_desc(( DMHDESC ) handle )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } descriptor = (DMHDESC) handle; function_entry( descriptor ); thread_protect( SQL_HANDLE_DESC, descriptor ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY092" ); __post_internal_error( &descriptor -> error, ERROR_HY092, NULL, descriptor -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } else { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } } if ( handle_type == SQL_HANDLE_ENV ) { DMHENV environment = (DMHENV) handle; DMHDBC connection; SQLRETURN ret; if ( !__validate_env( environment )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( environment ); if ( log_info.log_flag ) { sprintf( environment -> msg, "\n\t\tEntry:\ \n\t\t\tEnvironment = %p\ \n\t\t\tCompletion Type = %d", (void*)environment, (int)completion_type ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, environment -> msg ); }
SQLRETURN SQLSpecialColumnsW( SQLHSTMT statement_handle, SQLUSMALLINT identifier_type, SQLWCHAR *catalog_name, SQLSMALLINT name_length1, SQLWCHAR *schema_name, SQLSMALLINT name_length2, SQLWCHAR *table_name, SQLSMALLINT name_length3, SQLUSMALLINT scope, SQLUSMALLINT nullable ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLSPECIALCOLUMNSW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLSPECIALCOLUMNSW( parent_statement -> connection, statement_handle, identifier_type, catalog_name, name_length1, schema_name, name_length2, table_name, name_length3, scope, nullable ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tIdentifier Type = %d\ \n\t\t\tCatalog Name = %s\ \n\t\t\tSchema Name = %s\ \n\t\t\tTable Name = %s\ \n\t\t\tScope = %d\ \n\t\t\tNullable = %d", statement, identifier_type, __wstring_with_length( s1, catalog_name, name_length1 ), __wstring_with_length( s2, schema_name, name_length2 ), __wstring_with_length( s3, table_name, name_length3 ), scope, nullable ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLBindParameter( SQLHSTMT statement_handle, SQLUSMALLINT ipar, SQLSMALLINT f_param_type, SQLSMALLINT f_c_type, SQLSMALLINT f_sql_type, SQLULEN cb_col_def, SQLSMALLINT ib_scale, SQLPOINTER rgb_value, SQLLEN cb_value_max, SQLLEN *pcb_value ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tParam Number = %d\ \n\t\t\tParam Type = %d\ \n\t\t\tC Type = %d %s\ \n\t\t\tSQL Type = %d %s\ \n\t\t\tCol Def = %d\ \n\t\t\tScale = %d\ \n\t\t\tRgb Value = %p\ \n\t\t\tValue Max = %d\ \n\t\t\tStrLen Or Ind = %p", statement, ipar, f_param_type, f_c_type, __c_as_text( f_c_type ), f_sql_type, __sql_as_text( f_sql_type ), (int)cb_col_def, (int)ib_scale, (void*)rgb_value, (int)cb_value_max, (void*)pcb_value ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN __SQLGetInfo( SQLHDBC connection_handle, SQLUSMALLINT info_type, SQLPOINTER info_value, SQLSMALLINT buffer_length, SQLSMALLINT *string_length ) { DMHDBC connection = (DMHDBC)connection_handle; SQLRETURN ret = SQL_SUCCESS; int type; SQLUSMALLINT sval; char txt[ 30 ], *cptr; SQLPOINTER *ptr; switch ( info_type ) { case SQL_DATA_SOURCE_NAME: type = 1; cptr = connection -> dsn; break; case SQL_DM_VER: type = 1; sprintf( txt, "%02d.%02d.%04d.%04d", SQL_SPEC_MAJOR, SQL_SPEC_MINOR, atoi( VERSION ), atoi( VERSION + 2 )); cptr = txt; break; case SQL_ODBC_VER: type = 1; sprintf( txt, "%02d.%02d", SQL_SPEC_MAJOR, SQL_SPEC_MINOR ); cptr = txt; break; case SQL_DRIVER_HDBC: type = 2; ptr = (SQLPOINTER) connection -> driver_dbc; break; case SQL_DRIVER_HENV: type = 2; ptr = (SQLPOINTER) connection -> driver_env; break; case SQL_DRIVER_HDESC: { if ( info_value ) { DMHDESC hdesc = *((DMHDESC*) info_value); type = 2; if ( __validate_desc( hdesc )) { ptr = (SQLPOINTER) hdesc -> driver_desc; } else { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY024" ); __post_internal_error( &connection -> error, ERROR_HY024, NULL, connection -> environment -> requested_version ); return SQL_ERROR; } } } break; case SQL_DRIVER_HLIB: type = 2; ptr = connection -> dl_handle; break; case SQL_DRIVER_HSTMT: { if ( info_value ) { DMHSTMT hstmt = *((DMHSTMT*) info_value); type = 2; if ( __validate_stmt( hstmt )) { ptr = (SQLPOINTER) hstmt -> driver_stmt; } else { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY024" ); __post_internal_error( &connection -> error, ERROR_HY024, NULL, connection -> environment -> requested_version ); return SQL_ERROR; } } } break; case SQL_XOPEN_CLI_YEAR: type = 1; cptr = connection -> cli_year; break; case SQL_ATTR_DRIVER_THREADING: type = 3; sval = connection -> threading_level; break; default: /* * pass all the others on */ if ( connection -> unicode_driver ) { SQLWCHAR *s1 = NULL; if ( !CHECK_SQLGETINFOW( connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &connection -> error, ERROR_IM001, NULL, connection -> environment -> requested_version ); return SQL_ERROR; } switch( info_type ) { case SQL_ACCESSIBLE_PROCEDURES: case SQL_ACCESSIBLE_TABLES: case SQL_CATALOG_NAME: case SQL_CATALOG_NAME_SEPARATOR: case SQL_CATALOG_TERM: case SQL_COLLATION_SEQ: case SQL_COLUMN_ALIAS: case SQL_DATA_SOURCE_NAME: case SQL_DATA_SOURCE_READ_ONLY: case SQL_DATABASE_NAME: case SQL_DBMS_NAME: case SQL_DBMS_VER: case SQL_DESCRIBE_PARAMETER: case SQL_DRIVER_NAME: case SQL_DRIVER_ODBC_VER: case SQL_DRIVER_VER: case SQL_ODBC_VER: case SQL_EXPRESSIONS_IN_ORDERBY: case SQL_IDENTIFIER_QUOTE_CHAR: case SQL_INTEGRITY: case SQL_KEYWORDS: case SQL_LIKE_ESCAPE_CLAUSE: case SQL_MAX_ROW_SIZE_INCLUDES_LONG: case SQL_MULT_RESULT_SETS: case SQL_MULTIPLE_ACTIVE_TXN: case SQL_NEED_LONG_DATA_LEN: case SQL_ORDER_BY_COLUMNS_IN_SELECT: case SQL_PROCEDURE_TERM: case SQL_PROCEDURES: case SQL_ROW_UPDATES: case SQL_SCHEMA_TERM: case SQL_SEARCH_PATTERN_ESCAPE: case SQL_SERVER_NAME: case SQL_SPECIAL_CHARACTERS: case SQL_TABLE_TERM: case SQL_USER_NAME: case SQL_XOPEN_CLI_YEAR: case SQL_OUTER_JOINS: if ( info_value && buffer_length > 0 ) { buffer_length = sizeof( SQLWCHAR ) * ( buffer_length + 1 ); s1 = malloc( buffer_length ); } break; } ret = SQLGETINFOW( connection, connection -> driver_dbc, info_type, s1 ? s1 : info_value, buffer_length, string_length ); switch( info_type ) { case SQL_ACCESSIBLE_PROCEDURES: case SQL_ACCESSIBLE_TABLES: case SQL_CATALOG_NAME: case SQL_CATALOG_NAME_SEPARATOR: case SQL_CATALOG_TERM: case SQL_COLLATION_SEQ: case SQL_COLUMN_ALIAS: case SQL_DATA_SOURCE_NAME: case SQL_DATA_SOURCE_READ_ONLY: case SQL_DATABASE_NAME: case SQL_DBMS_NAME: case SQL_DBMS_VER: case SQL_DESCRIBE_PARAMETER: case SQL_DRIVER_NAME: case SQL_DRIVER_ODBC_VER: case SQL_DRIVER_VER: case SQL_ODBC_VER: case SQL_EXPRESSIONS_IN_ORDERBY: case SQL_IDENTIFIER_QUOTE_CHAR: case SQL_INTEGRITY: case SQL_KEYWORDS: case SQL_LIKE_ESCAPE_CLAUSE: case SQL_MAX_ROW_SIZE_INCLUDES_LONG: case SQL_MULT_RESULT_SETS: case SQL_MULTIPLE_ACTIVE_TXN: case SQL_NEED_LONG_DATA_LEN: case SQL_ORDER_BY_COLUMNS_IN_SELECT: case SQL_PROCEDURE_TERM: case SQL_PROCEDURES: case SQL_ROW_UPDATES: case SQL_SCHEMA_TERM: case SQL_SEARCH_PATTERN_ESCAPE: case SQL_SERVER_NAME: case SQL_SPECIAL_CHARACTERS: case SQL_TABLE_TERM: case SQL_USER_NAME: case SQL_XOPEN_CLI_YEAR: case SQL_OUTER_JOINS: if ( SQL_SUCCEEDED( ret ) && info_value && s1 ) { unicode_to_ansi_copy( info_value, buffer_length, s1, SQL_NTS, connection, NULL ); } if ( SQL_SUCCEEDED( ret ) && string_length && info_value ) { *string_length = strlen(info_value); } break; } if ( s1 ) { free( s1 ); } } else { if ( !CHECK_SQLGETINFO( connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &connection -> error, ERROR_IM001, NULL, connection -> environment -> requested_version ); return SQL_ERROR; } ret = SQLGETINFO( connection, connection -> driver_dbc, info_type, info_value, buffer_length, string_length ); } return ret; } if ( type == 1 ) { if ( string_length ) *string_length = strlen( cptr ); if ( info_value ) { if ( buffer_length > strlen( cptr ) + 1 ) { strcpy( info_value, cptr ); } else { memcpy( info_value, cptr, buffer_length - 1 ); ((char*)info_value)[ buffer_length - 1 ] = '\0'; ret = SQL_SUCCESS_WITH_INFO; } } } else if ( type == 2 ) { if ( info_value ) *((void **)info_value) = ptr; if ( string_length ) *string_length = sizeof( SQLPOINTER ); } else if ( type == 3 ) { if ( info_value ) *((SQLUSMALLINT *)info_value) = sval; if ( string_length ) *string_length = sizeof( SQLUSMALLINT ); } return ret; }
SQLRETURN SQLGetStmtAttrW( SQLHSTMT statement_handle, SQLINTEGER attribute, SQLPOINTER value, SQLINTEGER buffer_length, SQLINTEGER *string_length ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLGETSTMTATTRW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLGETSTMTATTRW( parent_statement -> connection, statement_handle, attribute, value, buffer_length, string_length ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tAttribute = %s\ \n\t\t\tValue = %p\ \n\t\t\tBuffer Length = %d\ \n\t\t\tStrLen = %p", statement, __stmt_attr_as_string( s1, attribute ), value, (int)buffer_length, (void*)string_length ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN __SQLFreeHandle( SQLSMALLINT handle_type, SQLHANDLE handle ) { switch( handle_type ) { case SQL_HANDLE_ENV: { DMHENV environment = (DMHENV)handle; /* * check environment */ if ( !__validate_env( environment )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( environment ); if ( log_info.log_flag ) { sprintf( environment -> msg, "\n\t\tEntry:\n\t\t\tHandle Type = %d\n\t\t\tInput Handle = %p", handle_type, (void*)handle ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, environment -> msg ); } thread_protect( SQL_HANDLE_ENV, environment ); /* * check states */ if ( environment -> state != STATE_E1 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &environment -> error, ERROR_HY010, NULL, environment -> requested_version ); return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR ); } thread_release( SQL_HANDLE_ENV, environment ); __release_env( environment ); return SQL_SUCCESS; } break; case SQL_HANDLE_DBC: { DMHDBC connection = (DMHDBC)handle; DMHENV environment; /* * check connection */ if ( !__validate_dbc( connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( connection ); environment = connection -> environment; if ( log_info.log_flag ) { sprintf( connection -> msg, "\n\t\tEntry:\n\t\t\tHandle Type = %d\n\t\t\tInput Handle = %p", handle_type, (void*)handle ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, connection -> msg ); } thread_protect( SQL_HANDLE_ENV, environment ); /* * check states */ if ( connection -> state != STATE_C2 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &connection -> error, ERROR_HY010, NULL, connection -> environment -> requested_version ); return function_return( SQL_HANDLE_ENV, environment, SQL_ERROR ); } environment -> connection_count --; if ( environment -> connection_count == 0 ) { environment -> state = STATE_E1; } environment = connection -> environment; __release_attr_str( &connection -> env_attribute ); __release_attr_str( &connection -> dbc_attribute ); __release_attr_str( &connection -> stmt_attribute ); __disconnect_part_one( connection ); __release_dbc( connection ); if ( log_info.log_flag ) { sprintf( environment -> msg, "\n\t\tExit:[SQL_SUCCESS]" ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, environment -> msg ); } #if defined ( COLLECT_STATS ) && defined( HAVE_SYS_SEM_H ) uodbc_update_stats(environment->sh, UODBC_STATS_TYPE_HDBC, (void *)-1); #endif thread_release( SQL_HANDLE_ENV, environment ); return SQL_SUCCESS; } break; case SQL_HANDLE_STMT: { DMHSTMT statement = (DMHSTMT)handle; DMHDBC connection; SQLRETURN ret; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); connection = statement -> connection; if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\n\t\t\tHandle Type = %d\n\t\t\tInput Handle = %p", handle_type, (void*)handle ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); } thread_protect( SQL_HANDLE_STMT, statement ); /* * check states */ if ( statement -> state == STATE_S8 || statement -> state == STATE_S9 || statement -> state == STATE_S10 || statement -> state == STATE_S11 || statement -> state == STATE_S12 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &statement -> error, ERROR_HY010, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } if ( !CHECK_SQLFREEHANDLE( statement -> connection )) { if ( !CHECK_SQLFREESTMT( statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &statement -> error, ERROR_IM001, NULL, statement -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_STMT, statement, SQL_ERROR ); } else { ret = SQLFREESTMT( statement -> connection, statement -> driver_stmt, SQL_DROP ); } } else { ret = SQLFREEHANDLE( statement -> connection, handle_type, statement -> driver_stmt ); } if ( SQL_SUCCEEDED( ret )) { /* * break any association */ if ( statement -> ard ) { statement -> ard -> associated_with = NULL; } if ( statement -> apd ) { statement -> apd -> associated_with = NULL; } /* * release the implicit descriptors, * this matches the tests in SQLAllocHandle */ if (( statement -> connection -> driver_act_ver == 3 && CHECK_SQLGETSTMTATTR( connection )) || CHECK_SQLGETSTMTATTRW( connection )) { if ( statement -> implicit_ard ) __release_desc( statement -> implicit_ard ); if ( statement -> implicit_apd ) __release_desc( statement -> implicit_apd ); if ( statement -> implicit_ird ) __release_desc( statement -> implicit_ird ); if ( statement -> implicit_ipd ) __release_desc( statement -> implicit_ipd ); } statement -> connection -> statement_count --; thread_release( SQL_HANDLE_STMT, statement ); #if defined ( COLLECT_STATS ) && defined( HAVE_SYS_SEM_H ) uodbc_update_stats(connection->environment->sh, UODBC_STATS_TYPE_HSTMT, (void *)-1); #endif __release_stmt( statement ); } else { thread_release( SQL_HANDLE_STMT, statement ); } if ( log_info.log_flag ) { sprintf( connection -> msg, "\n\t\tExit:[SQL_SUCCESS]" ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, connection -> msg ); } return function_return( IGNORE_THREAD, connection, ret ); } break; case SQL_HANDLE_DESC: { DMHDESC descriptor = (DMHDESC)handle; DMHDBC connection; SQLRETURN ret; /* * check descriptor */ if ( !__validate_desc( descriptor )) { return SQL_INVALID_HANDLE; } function_entry( descriptor ); connection = descriptor -> connection; if ( log_info.log_flag ) { sprintf( descriptor -> msg, "\n\t\tEntry:\n\t\t\tHandle Type = %d\n\t\t\tInput Handle = %p", handle_type, (void*)handle ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } if ( descriptor -> implicit ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY017" ); __post_internal_error( &descriptor -> error, ERROR_HY017, NULL, connection -> environment -> requested_version ); return function_return( IGNORE_THREAD, descriptor, SQL_ERROR ); } thread_protect( SQL_HANDLE_DESC, descriptor ); if ( !CHECK_SQLFREEHANDLE( connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: IM001" ); __post_internal_error( &descriptor -> error, ERROR_IM001, NULL, connection -> environment -> requested_version ); return function_return( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } else { ret = SQLFREEHANDLE( connection, handle_type, descriptor -> driver_desc ); } /* * check status of statements associated with this descriptor */ if( __check_stmt_from_desc( descriptor, STATE_S8 ) || __check_stmt_from_desc( descriptor, STATE_S9 ) || __check_stmt_from_desc( descriptor, STATE_S10 ) || __check_stmt_from_desc( descriptor, STATE_S11 ) || __check_stmt_from_desc( descriptor, STATE_S12 )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: HY010" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } thread_release( SQL_HANDLE_DESC, descriptor ); __release_desc( descriptor ); if ( log_info.log_flag ) { sprintf( connection -> msg, "\n\t\tExit:[SQL_SUCCESS]" ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, connection -> msg ); } #if defined ( COLLECT_STATS ) && defined( HAVE_SYS_SEM_H ) uodbc_update_stats(connection->environment->sh, UODBC_STATS_TYPE_HDESC, (void *)-1); #endif return function_return( IGNORE_THREAD, connection, SQL_SUCCESS ); } break; default: /* * there is nothing to report a error on */ return SQL_ERROR; } }
SQLRETURN SQLForeignKeys( SQLHSTMT statement_handle, SQLCHAR *szpk_catalog_name, SQLSMALLINT cbpk_catalog_name, SQLCHAR *szpk_schema_name, SQLSMALLINT cbpk_schema_name, SQLCHAR *szpk_table_name, SQLSMALLINT cbpk_table_name, SQLCHAR *szfk_catalog_name, SQLSMALLINT cbfk_catalog_name, SQLCHAR *szfk_schema_name, SQLSMALLINT cbfk_schema_name, SQLCHAR *szfk_table_name, SQLSMALLINT cbfk_table_name ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ], s4[ 100 + LOG_MESSAGE_LEN ]; SQLCHAR s5[ 100 + LOG_MESSAGE_LEN ], s6[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tPK Catalog Name = %s\ \n\t\t\tPK Schema Name = %s\ \n\t\t\tPK Table Name = %s\ \n\t\t\tFK Catalog Name = %s\ \n\t\t\tFK Schema Name = %s\ \n\t\t\tFK Table Name = %s", statement, __string_with_length( s1, szpk_catalog_name, cbpk_catalog_name ), __string_with_length( s2, szpk_schema_name, cbpk_schema_name ), __string_with_length( s3, szpk_table_name, cbpk_table_name ), __string_with_length( s4, szfk_catalog_name, cbfk_catalog_name ), __string_with_length( s5, szfk_schema_name, cbfk_schema_name ), __string_with_length( s6, szfk_table_name, cbfk_table_name )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }
SQLRETURN SQLDescribeColW( SQLHSTMT statement_handle, SQLUSMALLINT column_number, SQLWCHAR *column_name, SQLSMALLINT buffer_length, SQLSMALLINT *name_length, SQLSMALLINT *data_type, SQLULEN *column_size, SQLSMALLINT *decimal_digits, SQLSMALLINT *nullable ) { DMHSTMT statement = (DMHSTMT) statement_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ], s2[ 100 + LOG_MESSAGE_LEN ], s3[ 100 + LOG_MESSAGE_LEN ], s4[ 100 + LOG_MESSAGE_LEN ]; SQLCHAR s5[ 100 + LOG_MESSAGE_LEN ]; SQLCHAR s6[ 100 + LOG_MESSAGE_LEN ]; /* * check statement */ if ( !__validate_stmt( statement )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Error: SQL_INVALID_HANDLE" ); #ifdef WITH_HANDLE_REDIRECT { DMHSTMT parent_statement; parent_statement = find_parent_handle( statement, SQL_HANDLE_STMT ); if ( parent_statement ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: found parent handle" ); if ( CHECK_SQLDESCRIBECOLW( parent_statement -> connection )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, "Info: calling redirected driver function" ); return SQLDESCRIBECOLW( parent_statement -> connection, statement_handle, column_number, column_name, buffer_length, name_length, data_type, column_size, decimal_digits, nullable ); } } } #endif return SQL_INVALID_HANDLE; } function_entry( statement ); if ( log_info.log_flag ) { sprintf( statement -> msg, "\n\t\tEntry:\ \n\t\t\tStatement = %p\ \n\t\t\tColumn Number = %d\ \n\t\t\tColumn Name = %p\ \n\t\t\tBuffer Length = %d\ \n\t\t\tName Length = %p\ \n\t\t\tData Type = %p\ \n\t\t\tColumn Size = %p\ \n\t\t\tDecimal Digits = %p\ \n\t\t\tNullable = %p", statement, column_number, column_name, buffer_length, name_length, data_type, column_size, decimal_digits, nullable ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, statement -> msg ); }