|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-04-13 15:09 UTC] rhondle at hotmail dot com
The docs indicate that either the 'c' or 'n' modes can be used to create a dba database. When creating a CDB database, the 'n' mode produces a functional database, while the 'c' mode does not. No errors are reported; the database just does not work.
The database created using 'c' doesn't work:
<?php
$id = dba_open ("test.db", "c", "cdb_make");
dba_insert("test","12345",$id);
dba_close ($id);
?>
This will create a working database:
<?php
$id = dba_open ("test.db", "n", "cdb_make");
if (!$id) exit("dba_open failed\n");
dba_insert("test","12345",$id);
dba_close ($id);
?>
tested with:
<?php
$id = dba_open ("test.db", "r", "cdb");
if (!$id) exit("dba_open failed\n");
if (dba_exists("test", $id))
print dba_fetch("test", $id);
else
print "Key not found!!\n";
dba_close ($id);
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 07:00:01 2025 UTC |
dba_open does not return null, implying success. In fact, it *technically* does succeed; it's just that the resulting file is corrupt in some way. <?php $id = dba_open ("test.db", "c", "cdb_make"); if (!$id) exit("dba_open failed\n"); dba_insert("test","12345",$id); dba_close ($id); ?>