Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » MobiLink - Server Administration » Writing Synchronization Scripts » Script parameters

User-defined named parameters Next Page

Authentication parameters


In MobiLink scripts, authentication parameters are named parameters that are prefaced with the letter a, such as {ml a.1}. The parameters must be numbers starting at 1, with a limit of 255. The values are sent up from MobiLink clients.

When used in the authenticate_* scripts, authentication parameters pass authentication information.

Authentication parameters can be used in all other events (except begin_connection and end_connection) to pass information from MobiLink clients. This technique is a convenient way to do something that you could otherwise do by creating and populating a table.

On SQL Anywhere remotes, you pass the information with the dbmlsync -ap option. On UltraLite remotes, you pass the information with auth_parms and num_auth_parms.

See also
Example

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 an array of strings. To prevent the strings from 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( "param1" ), 
   UL_TEXT( "param2" ), UL_TEXT( "param3" ) };

...
info.num_auth_parms = 3;
info.auth_parms = Params;

For SQL Anywhere remote databases, you pass authentication parameters using the dbmlsync -ap option, in a comma-separated list. For example, the following command line passes three parameters:

dbmlsync -ap "param1,param2,param3"

On the server, you reference the scripts in the order in which they were sent up. In this example, the authenticate_parameters script could be:

{CALL my_auth_parm( {
   s.auth.status,
   s.remote_id,
   s.username,
   a.1,
   a.2,
   a.3 } ) }