public java.sql.ResultSetMetaData getMetaData( )
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.
The metadata for the UploadedTableData instance.
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.
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |