Scripts that directly handle row data are called data scripts. All other scripts are non-data scripts. The distinction between a data script and a non-data script is sometimes important. For example, only data scripts can reference the named parameters for column values.
The following events have data scripts associated with them:
download_cursor table event
download_delete_cursor table event
handle_UploadData connection event
handle_DownloadData connection event
upload_delete table event
upload_fetch table event
upload_fetch_column_conflict table event
upload_insert table event
upload_new_row_insert table event
upload_old_row_insert table event
upload_update table event
Starting in version 16, the ability for Java and .NET scripting logic to return strings that are interpreted by MobiLink server as SQL scripts has been removed in all scripts. If your non-data scripts need to cause changes in the consolidated database, they should do so directly from Java or .NET.
Following is an example of how a script can be updated. The first example uses SQL and the second example does not.
public String beginDownloadConnection( Timestamp ts, String user ) throws java.sql.SQLException { doSomeWork( ts, user ); return( "CALL do_some_sql( {ml s.last_download}, {ml s.username} )" ); }
public void beginDownloadConnection( Timestamp ts, String user ) throws java.sql.SQLException { doSomeWork( ts, user ); Connection conn = DBConnectionContext.getConnection(); PreparedStatement stmt = conn.prepareStatement( "CALL do_some_sql( ?,? )" ); stmt.setTimestamp( 1, ts ); stmt.setString( 2, user ); stmt.executeUpdate(); }
For data scripts, in order to upload and download table row data values, all of the Java and .NET events need to be re-written using direct row handling via the handle_UploadData and handle_DownloadData events.