ads_commit

Advantage PHP Extension

  Previous topic Next topic  

Commits the active transaction on the specified connection.

Syntax

boolean ads_commit( int connection_id )

Parameters

connection_id (I)

ID of a connection to the Advantage Database Server.

Remarks

Calling ads_commit when the Advantage PHP Extension is not in auto-commit mode commits the active transaction on the given connection and begins a new transaction. If the Advantage PHP Extension is in auto-commit mode, calling ads_commit has no effect and returns True. If the active transaction is successfully committed, True is returned. False is returned in the event of an error.

Example

<?

echo "Connecting to Server<br>\n";

$rConn = ads_connect( "DataDirectory=\\\\server1\\share1\\data\\;ServerTypes=2", "", "" );

echo "Connected<br>\n";

 

echo "Turning off auto-commit. Starts a transactions.<br>\n";

ads_autocommit( $rConn, False );

 

echo "Updating the customer’s credit limit.<br>\n";

$rResult = ads_do( $rConn, "UPDATE customers SET credit_limit = ( credit_limit * 2 )" );

 

echo "Committing the changes.<br>\n";

ads_commit( $rConn );

 

echo "Closing the connection<br>\n";

ads_close( $rConn );

echo "Disconnected<br>\n";

?>

See Also

ads_autocommit

ads_rollback

ads_connect