UltraLite User's Guide
UltraLite Reference
Synchronization parameters
Set a structure to hold communications error reporting information.
The parameter has no default value, and must be explicitly set.
The stream_error field is a structure of type ul_stream_error.
typedef struct ss_error { ss_stream_id stream_id; ss_stream_context stream_context; ss_error_code stream_error_code; asa_uint32 system_error_code; rp_char *error_string; asa_uint32 error_string_length; } ss_error, *p_ss_error;
The structure is defined in sserror.h, in the h subdirectory of your SQL Anywhere directory.
The ul_stream_error fields are as follows:
stream_id The network layer reporting the error. This enumeration has the following constants:
STREAM_ID_TCPIP STREAM_ID_HTTP STREAM_ID_CERTICOM_TLS STREAM_ID_PALM_CONDUIT STREAM_ID_ACTIVESYNC
stream_context The basic network operation being performed, such as open, read, or write. For details, see sserror.h.
stream_error_code The error reported by the stream itself. The stream_error_code is of type ss_error_code. The stream error codes are all prefixed with STREAM_ERROR_. A write error, for example, is STREAM_ERROR_WRITE.
For a listing of error numbers, see MobiLink Communication Error Messages. For the error code suffixes, see sserror.h.
In this version, to find the constant associated with each number you must count down the number of lines prefixed by DO_STREAM_Error in sserror.h. For example, to find the constant for error number 10, you use the tenth DO_STREAM_ERROR entry in sserror.h, which is as follows:
DO_STREAM_ERROR( WRITE )
The constant associated with this error is therefore STREAM_ERROR_WRITE.
stream_error The network operation being performed (the context) and the error itself as an enumeration constant.
system_error_code A system-specific error code.
error_string An application-provided error message
For embedded SQL, check for SQLE_COMMUNICATIONS_ERROR as follows:
ul_char error_buff[ 100 ]; ul_synch_info info; ... ULInitSynchInfo( &info ); info.stream_error.error_string = error_buff; info.stream_error.error_string_length = sizeof( error_buff ); ... ULSynchronize( &sqlca, &info ) if( SQLCODE == SQLE_COMMUNICATIONS_ERROR ){ printf( error_buff ); ...// more error handling here
C++ API usage is as follows:
Connection conn; auto ul_synch_info info; ... conn.InitSynchInfo( &info ); info.stream_error.error_string = error_buff; info.stream_error.error_string_length = sizeof( error_buff ); if( !conn.Synchronize( &synch_info ) ){ if( SQLCODE == SQLE_COMMUNICATIONS_ERROR ){ printf( error_buff ); // more error handline here
This feature is not available for Java applications.