Hello all!
I'have read tons of posts that say that dba_open() open and locks the file at the same time, but I can't say that:
Please try this
First process:
tries to fetch the key "firstkey" thinking the value is "Good morning!".
$id = dba_open ("mydba.db", "r", "db3");
if (!$id) {
die("dba_open failed\n") ;
exit;
}
sleep(10) ;
$data=dba_fetch("firstkey",$id) or die("Cant'fetch") ; ;
dba_close($id) ;
echo($data) ;
Second process:
While "mydba.db" is open from first process
second process opens the file too, and replaces the key "firstkey" with value "Good evening!".
Result:
First process reads "Good evening!".....
Can anybody tell me how to lock a dba file in a reliable way,please?
Thanks