MobiLink Synchronization Reference
Synchronization Events
Receives non-table data that is sent from the remote.
In the following table, the description provides the SQL data type. If you are writing your script in Java or .NET, you should use the appropriate corresponding data type. See SQL-Java data types and SQL-.NET data types.
Item | Parameter | Description |
---|---|---|
1 | auth_status | INTEGER. This is an INOUT parameter. |
2 | ml_username | VARCHAR(128). |
3... | remote_parameters (one or more) | VARCHAR(128). |
You can send strings or parameters in the form of strings from both Adaptive Server Anywhere and UltraLite remotes. This allows you to have authentication beyond a user ID and password. It also means that you can customize your synchronization based on the value of parameters, and do this in a pre-synchronization phase, during authentication.
For UltraLite remote databases, pass the parameters using the num_auth_parms and auth_parms fields in the ul_synch_info struct. num_auth_parms is a count of the number of parameters, from 0 to 255. auth_parms is a pointer to a list of strings. To prevent the strings being viewed as plain text, the strings are sent in the same way as passwords. If num_auth_parms is 0, set auth_parms to NULL.
Following is an example of passing parameters in UltraLite:
ul_char * Params[ 3 ] = { UL_TEXT( "parm1" ), UL_TEXT( "parm2" ), UL_TEXT( "parm3" ) }; ... info.num_auth_parms = 3; info.auth_parms = Params;
For Adaptive Server Anywhere remote databases, you pass parameters using the dbmlsync -ap option, in a comma-separated list. For example,
dbmlsync -ap "parm1,parm2,parm3"
The MobiLink synchronization server executes this event upon starting each synchronization. It is executed before, and in the same transaction as, the begin_synchronization event.
You can use this event to replace the built-in MobiLink authentication mechanism with a custom mechanism. You may want to call into the authentication mechanism of your DBMS, or you may wish to implement features not present in the MobiLink built-in mechanism.
The number of remote parameters must match the number expected or an error will result. For example, if three parameters are sent, the event must expect five, because there is auth_status and ml_username plus the three parameters. An error will also occur if parameters are sent from the client and there is no event.
If the authenticate_user or authenticate_user_hashed scripts are invoked and return an error, this event is not called.
SQL scripts for the authenticate_parameters event must be implemented as stored procedures.
authenticate_user connection event
authenticate_user_hashed connection event
begin_synchronization connection event
Authentication Parameters synchronization parameter