This callback provides script execution progress (status) during SQL passthrough script execution.
void ul_sql_passthrough_observer_fn( ul_sql_passthrough_status * status );
ul_sql_passthrough_status Provides the current status of script execution, including state, number of scripts to be executed, the current script being executed and any user data provided in the register call.
The progress observer callback is defined as follows:
typedef void(UL_CALLBACK_FN * ul_sql_passthrough_observer_fn) (ul_sql_passthrough_status * status); |
The ul_sql_passthrough_status structure is defined as follows:
typedef struct { ul_sql_passthrough_state state; // current state ul_u_long script_count; // total number of scripts to execute ul_u_long cur_script; // current script being executed (1-based) ul_bool stop; // set to true to stop script execution // can only be set in the starting state ul_void * user_data; // user data provided in register call SQLCA * sqlca; } ul_sql_passthrough_status; |
The progress observer callback is registered via the following method:
UL_FN_SPEC ul_ret_void UL_FN_MOD ULRegisterSQLPassthroughCallback( SQLCA * sqlca, ul_sql_passthrough_observer_fn callback, ul_void * user_data ); |
Here is a sample callback and code to invoke ULRegisterSQLPassthroughCallback:
static void UL_GENNED_FN_MOD passthroughCallback(ul_sql_passthrough_status * status) { switch( status->state ) { case UL_SQL_PASSTHROUGH_STATE_STARTING: printf( "SQL Passthrough script execution starting\n" ); break; case UL_SQL_PASSTHROUGH_STATE_RUNNING_SCRIPT: printf( "Executing script %d of %d\n", status->cur_script, status->script_count ); break; case UL_SQL_PASSTHROUGH_STATE_DONE: printf( "Finished executing SQL Passthrough scripts\n" ); break; default: printf( "SQL Passthrough script execution has failed\n" ); break; } } int main() { ULSqlca sqlca; sqlca.Initialize(); ULRegisterSQLPassthroughCallback( sqlca.GetCA(), passthroughCallback, NULL ); DatabaseManager * dm = ULInitDatabaseManager( sqlca ); ... } |
Returns one of the following actions *** Are these valid? ***):
UL_ERROR_ACTION_CANCEL Cancel the operation that raised the error.
UL_ERROR_ACTION_CONTINUE Continue execution, ignoring the operation that raised the error.
UL_ERROR_ACTION_DEFAULT Behave as if there is no error callback.
UL_ERROR_ACTION_TRY_AGAIN Retry the operation that raised the error.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |