I need to use table locks for a class to maintain data integrity. Problem is I've never used them before. I've read and understand the MySQL documentation. My problem is how to incorporate them into my PHP class.
For example:
I wrote a class to create and maintain a hierarchical recursion tree. When the function CreateCategory is called I need to lock the category table and the correlation table to ensure no other category with the same name exists on that level of the tree.
The CreateCategory function uses several other functions to perform checks and whatnot. So do I simply lock the needed tables at the beginning of the Create function and unlock at the end?
Note: I cannot use transactions with my version of MySQL, and cannot upgrade...
For example:
I wrote a class to create and maintain a hierarchical recursion tree. When the function CreateCategory is called I need to lock the category table and the correlation table to ensure no other category with the same name exists on that level of the tree.
The CreateCategory function uses several other functions to perform checks and whatnot. So do I simply lock the needed tables at the beginning of the Create function and unlock at the end?
Note: I cannot use transactions with my version of MySQL, and cannot upgrade...