php.sql.pdo\tutorials\PHP_Tutorial3.php
Now we will explore row/record locks using the FairCom DB PHP Interface and the PDO (PHP Data Objects) extension.
The functionality for this tutorial focuses on inserting/adding rows/records, then updating a single row/record in the customer master table under locking control. The application will pause after a LOCK is placed on a row/record. Another instance of this application should then be launched, which will block, waiting on the lock held by the first instance. Pressing the <Enter> key will enable the first instance to proceed. This will result in removing the lock thereby allowing the second instance to continue execution. Launching two processes provides a visual demonstration of the effects of locking and a basis for experimentation on your own.
As with all other examples in the c-tree tutorial series, this tutorial simplifies the creation and use of a database into four simple steps: Initialize(), Define(), Manage(), and you’re Done() !
Tutorial #3: Locking
Here we demonstrate the enforcement of data integrity by introducing record/row "locking".
Note our simple PHP script:
<?php
//
// Implementation of the concept of "init, define, manage and you're done..."
//
$session = Initialize();
Defines($session);
Manage($session);
Done($session);
//
// Other functions are defined in the next sections of this tutorial.
//
?>
</body>
</html>
We suggest opening the source code with your own editor.
Continue now to review these four steps.