#23188 [Opn->Csd]: CDB databases created with "c" mode do not work.

From: Date: Mon, 14 Apr 2003 21:57:36 +0000
Subject: #23188 [Opn->Csd]: CDB databases created with "c" mode do not work.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37669@lists.php.net to get a copy of this message
ID: 23188 Updated by: helly@php.net Reported By: rhondle at hotmail dot com -Status: Open +Status: Closed Bug Type: DBM/DBA related -Operating System: FreeBSD, Windows +Operating System: ANY PHP Version: 4.3.0 Assigned To: helly New Comment: This bug has been fixed in CVS. In case this was a PHP problem, snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. In case this was a documentation problem, the fix will show up soon at http://www.php.net/manual/. In case this was a PHP.net website problem, the change will show up on the PHP.net site and on the mirror sites in short time. Thank you for the report, and for helping us make PHP better. CDB_MAKE can handle only NEW and READ. Therefore allowing "C" was an error. Thanks for the mail and time. Previous Comments: ------------------------------------------------------------------------ [2003-04-13 15:40:13] rhondle at hotmail dot com 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); ?> ------------------------------------------------------------------------ [2003-04-13 15:20:52] helly@php.net Check again: "c" should return NULL in case an error happend and you don not check for that. ------------------------------------------------------------------------ [2003-04-13 15:09:39] 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); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23188&edit=1

« previous php.bugs (#37669) next »