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 » DownloadTableData interface

 

getDeletePreparedStatement method

Syntax
public java.sql.PreparedStatement getDeletePreparedStatement( ) throws SQLException
Remarks

Returns a java.sql.PreparedStatement instance that allows the user to add delete operations to the download. The prepared statement applies to the download table and contains a parameter for each primary key column in the table.

The prepared statement applies to the DownloadTableData instance and contains a parameter for each primary key column in the table.

To include a delete operation in the download, set all columns in your java.sql.PreparedStatement and then call the java.sql.PreparedStatement.executeUpdate method.

Note

You must set all primary key values for download delete operations.

Returns

A java.sql.PreparedStatement instance for adding delete operations to the download.

Exceptions
  • SQLException   Thrown if there is a problem retrieving the delete java.sql.PreparedStatement instance.

See also
Example

In the following example, the setDownloadDeletes method uses the DownloadTableData.getDeletePreparedStatement to obtain a prepared statement for rows you want to delete. The java.sql.PreparedStatement.setInt method sets the primary key values for rows you want to delete in the remote database and the java.sql.PreparedStatement.executeUpdate method sets the row values in the download.

void setDownloadDeletes(DownloadTableData td) { 
    java.sql.PreparedStatement delete_ps = td.getDeletePreparedStatement();
    // This is the same as executing the following SQL statement:
    // DELETE FROM remoteOrders  where pk=2300;
    delete_ps.setInt(1, 2300); 
    delete_ps.executeUpdate();
    delete_ps.close();
 }