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

SQL Anywhere 11.0.1 (日本語) » Mobile Link - サーバ管理 » Mobile Link サーバ API » Java による同期スクリプトの作成 » Java 用 Mobile Link サーバ API リファレンス

 

InOutString インタフェース

構文
public ianywhere.ml.script.InOutString
備考

SQL スクリプトに渡される in/out パラメータの機能を有効にするために、メソッドに渡されます。

メンバ

ianywhere.ml.script.InOutString のすべてのメンバ (継承されたメンバも含みます) を以下に示します。

次の Mobile Link システム・プロシージャ・コールは、スクリプト・バージョン ver1 を同期するときに、modifyUser という Java メソッドを modify_user 接続イベント用のスクリプトとして登録します。

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

次に示すのは、サンプルの Java メソッド modifyUser です。このメソッドは、データベースからユーザ ID を取得し、それを使用してユーザ名を設定します。

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 メソッド
setValue メソッド