To ensure stabilty when processing update data from an ESL application to an ODBC database, you should manually control the transactions:
1.After connecting to the database, use autocommit, set the commit mode to manual using the "off" option.
2. Perform the changes using standard SQL commands; INSERT, UPDATE or DELETE, either directly or via the batch commands.
3. Once the transaction is complete, issue commit or rollback to action or back-out the transaction.
4.Repeat steps 2 and 3 as required.
Example
subroutine ProcessSQLCommand(string: Command_SV) is
begin guarded
response to start
send Command_SV to SQL
response to "SQL>"
leave block
end
response to Logon
copy "login " DataSource " " UserId " " Password "\n" to SQLCommand_ASV
call ProcessSQLCommand(SQLCommand_ASV)
copy "autocommit off\n" to SQLCommand_ASV
call ProcessSQLCommand(SQLCommand_ASV)
response to BeginInsert
copy "insert into emp ( ename, enum) values (" Name_SV ", "Number_IV" )\n" to SQLCommand_ASV
call ProcessSQLCommand(SQLCommand_ASV)
copy "update dept set employcount = " Count_IV " where id = '" Dept_SV "'\n" to SQLCommand_ASV
call ProcessSQLCommand(SQLCommand_ASV)
response to Action
copy "commit\n" to SQLCommand_ASV
call ProcessSQLCommand(SQLCommand_ASV)
response to BackOut
copy "rollback\n" to SQLCommand_ASV
call ProcessSQLCommand(SQLCommand_ASV)
In this example:
•The commit mode is set to manual, immediately after login.
•Multiple tables are changed during the insert.
•The User can decide whether to Action the changes or Back them out.