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( c );
if (c < md.getColumnCount()) {
columnHeading += ", ";
}
}
//...
}
In this case, a method called HandleUpload handles the handle_UploadData synchronization event.