PHP and DBA (db3)
| From: | Dietmar Hilke | Date: | Fri, 11 Jun 2004 10:52:23 +0000 |
| Subject: | PHP and DBA (db3) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-34735@lists.php.net to get a copy of this message | ||
Hello!
Trying to bring that code to work on win32.
---
<h1>dba_perf_test.php</h1>
<?php
$handlers = dba_handlers(true);
print "<pre>";
print_r($handlers);
print "</pre>";
$dbtype = "db3";
$dbfile = "C:/dbfile";
$nrecs = 100;
echo "using datafile: $dbfile.$dbtype<br>\n";
$id = dba_open($dbfile.".".$dbtype, "c", $dbtype);
if (!$id) { die("\n<br>dhi: could not open dbfile"); }
for ($i=0; $i<$nrecs; $i++) {
$key = rand(1, $nrecs);
$value = date("D M j G:i:s T Y");
if(!dba_exists($key, $id)) {
$ins = dba_insert($key, $value, $id);
echo "inserted $key:$value in $dbfile.$dbtype<br>\n";
}
}
dba_close($id);
/// Finds in db
$success = 0;
$id = dba_open($dbfile.".".$dbtype, "r", $dbtype);
if (!$id) { die("could not open dbfile"); }
$success = 0;
for ($i=0; $i<$nrecs; $i++) {
$key = rand(1, $nrecs);
if(dba_exists($key, $id)) {
$success++;
}
}
dba_close($id);
?>
---
Result:
Warning: dba_open(C:/dbfile.db3,c): Driver initialization failed for handler: db3: Permission denied in e:\data\dhidata\meddictool2\dba_news.php on line 18
Any Ideas? Thanks!
dhi