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

SQL Anywhere 11.0.1 » MobiLink - Server Administration » MobiLink Server APIs » Writing synchronization scripts in Java » MobiLink server API for Java reference » UploadedTableData interface

 

getMetaData method

Syntax
public java.sql.ResultSetMetaData getMetaData( )
Remarks

Gets the metadata for the UploadedTableData instance. The metadata is a standard java.sql.ResultSetMetaData instance.

If you want the ResultSetMetaData to contain column name information, you must specify the client option to send column names.

Consult your Java SDK documentation for more information about java.sql.ResultSetMetaData.

Returns

The metadata for the UploadedTableData instance.

See also
Example

The following example obtains a java.sql.ResultSetMetaData instance for an uploaded table called remoteOrders. The code uses the ResultSetMetaData.getColumnCount and getColumnLabel methods to compile a list of column names.

import ianywhere.ml.script.*;
import java.sql.*;

// The method used for the handle_UploadData event.
public void HandleUpload(UploadData ut) {
    throws SQLException, IOException
{
    // Get an UploadedTableData instance representing the remoteOrders table.
    UploadedTableData remoteOrdersTable = ut.getUploadedTableByName("remoteOrders");
 
    // get inserts uploaded by the MobiLink client
    java.sql.ResultSet rs = remoteOrdersTable.getInserts();

    // Obtain the result set metadata.
    java.sql.ResultSetMetaData md = rs.getMetaData();
    String columnHeading = "";

    // Compile a list of column names.
    for (int c=1; c <= md.getColumnCount(); c += 1) {
        columnHeading += md.getColumnLabel();  
   
        if (c < md.getColumnCount()) {
            columnHeading += ", ";
        }
    }
    //...
}

In this case, a method called HandleUpload handles the handle_UploadData synchronization event.

See also