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

SQL Anywhere 11.0.0 » MobiLink - Server Administration » MobiLink Server APIs » Writing synchronization scripts in Java » MobiLink server API for Java Reference

 

InOutString interface

Syntax
public ianywhere.ml.script.InOutString
Remarks

Passed into methods to enable the functionality of an in/out parameter passed to a SQL script.

Members

All members of ianywhere.ml.script.InOutString, including all inherited members.

Example

The following call to a MobiLink system procedure registers a Java method called modifyUser as the script for the modify_user connection event when synchronizing the script version ver1.

CALL ml_add_java_connection_script(
   'ver1',
   'modify_user',
   'ExamplePackage.ExampleClass.modifyUser' )

Following is the sample Java method modifyUser. It gets the user ID from the database and then uses it to set the user name.

public String modifyUser( 
  InOutString io_user_name )
  throws SQLException {
  Statement uid_select = curConn.createStatement();
  ResultSet uid_result = uid_select.executeQuery(
   "SELECT rep_id FROM SalesRep WHERE name = '" +
   io_user_name.getValue() + "' " );
  uid_result.next();
  io_user_name.setValue(
   java.lang.Integer.toString(uid_result.getInt( 1 ));
   uid_result.close();
   uid_select.close();
  return ( null );
}

getValue method
setValue method