php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25286 dba_delete() cant delete record when key is null
Submitted: 2003-08-28 03:21 UTC Modified: 2003-09-01 05:01 UTC
From: audwox at jiran dot com Assigned: helly (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 4.3.3 OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: audwox at jiran dot com
New email:
PHP Version: OS:

 

 [2003-08-28 03:21 UTC] audwox at jiran dot com
Description:
------------
Hi.

dba_firstkey() return false when cant any key and also null key in data. But I can see some data in data file using db_dump(bdb management utility by sleeycat).

When I was use dba_delete() function like below with php 4.3.3, I cant delete record.

<?
dba_delete(null, $dbid);
?>

But When I use dba_delete() function with php 4.3.2, dba_delete() success.

Sorry for my english.
Thank you.

Reproduce code:
---------------
<?
/* with php 4.3.2 */
$dbid = dba_open("test.db", "w", "db3");
dba_insert(null, null, $dbid);
dba_close($dbid);

/* now, null data exists into test.db */

/* with php 4.3.3 */
$dbid = dba_open("test.db", "w", "db3");
dba_delete(null, $dbid);
dba_close($dbid);

/* but still exists null data into test.db. dba_delete() cant delete null data. And now, dba_firstkey() always fail to get first key. dab_firstkey() always return false. But with db_dump utility can see all data. */

?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-30 05:12 UTC] helly@php.net
It works in 4.3.3, 5.0 with at least handlers db3, db4 and flatfile. The insert/delete happens in generic code first and is then propagated to the handlers.

Anyway your problem is that you can't even insert data with key=NULL. Try var_dump(dba_insert(NULL,....)) and you will see that it returns false as 'action not taken'.
 [2003-08-31 20:10 UTC] audwox at jiran dot com
My problem is that dba_firstkey() always return false even if exists data when null key was inserted.

So, I did not earned any data.

Thank you.
 [2003-09-01 05:01 UTC] helly@php.net
To make this one clear: You can only insert/update/delete with NULL keys in versions before 4.3.3 and even there i am not really sure about problems.

So if you insert NULL keys with 4.3.2 you cannot handle the associated data with 4.3.3. Maybe you find that a bit anoying but well NULL keys don't belong into a db concept. And said this it will never change back.

And the problem you expirienced was one of the reasons for this change.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC