f2s_esql_commit_transaction¶

Applies to: Oracle, MS SQL, MySql/MariaDB, PostgreSQL Drivers

Syntax

f2s_esql_commit_transaction

Description

This command is used to commit a SQL transaction. After the f2s_esql_commit_transaction, all of the data modifications made during the SQL transaction are committed and become a permanent part of the database.

Example

f2s_esql_commit_transaction Command using SQL Server
     String sSQL
     String sCustName
     String sCustAddress
     String sCustCity
     String sCustState
     String sCustZip
     String sCustPhone_Number
     Number nCreditLimit nMaximumAllowedCreditLimit
     Move 250.00 to nMaximumAllowedCreditLimit
     Move "Test Name" to sCustName
     Move "123 Test Address" to sCustAddress
     Move "Miami" to sCustCity
     Move "FL" to sCustState
     Move "33308" to sCustZip
     Move "305 555-5555" to sCustPhone_Number
     Move 1000.00 to nCreditLimit
     Move "Insert into CUSTOMER ([Name], [Address], [City], [State], [Zip], [Phone_Number],[Credit_Limit]) Values(?,?,?,?,?,?,?)" to sSQL

     //Start a Transaction
     f2s_esql_start_transaction

     //Create the SQL Statement
     f2s_esql_create_stmt sSQL

     // Prepare the SQL Statement
     f2s_esql_prepare_stmt

     // Set the parameter values for the SQL Statement
     f2s_esql_set_param 1 to sCustName
     f2s_esql_set_param 2 to sCustAddress
     f2s_esql_set_param 3 to sCustCity
     f2s_esql_set_param 4 to sCustState
     f2s_esql_set_param 5 to sCustZip
     f2s_esql_set_param 6 to sCustPhone_Number
     f2s_esql_set_param 7 to nCreditLimit

     //Execute the SQL Statement
     f2s_esql_execute_stmt

     //Check  Business rule for new customers with a high Credit Limit
     If (nCreditLimit > nMaximumAllowedCreditLimit) Begin
         Showln "Credit Limit is too high!  Rolling back the transaction."
         f2s_esql_rollback_transaction
     End
     Else Begin
         Showln "Successful - Committing the Transaction"
         f2s_esql_commit_transaction
     End
     f2s_esql_close_stmt
     inkey WindowIndex

Related Commands

  • f2s_esql_start_transaction

  • f2s_esql_rollback_transaction

Replaces: Command SQL_COMMIT_STMT