#19669 [Opn->Bgs]: Incomplete documentation for dba_replace
| From: | helly@php.net | Date: | Wed, 13 Nov 2002 02:23:08 +0000 |
| Subject: | #19669 [Opn->Bgs]: Incomplete documentation for dba_replace | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969349624@lists.php.net to get a copy of this message | ||
ID: 19669
Updated by: helly@php.net
Reported By: jelte.werkhoven@itfy.com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
-Operating System: linux
+Operating System: ANY
-PHP Version: 4.2.1
+PHP Version: ANY
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
That's the way such libraries work :-(
Previous Comments:
------------------------------------------------------------------------
[2002-10-15 09:06:02] jelte.werkhoven@itfy.com
I discoverd today that this problem is not actually a problem, but is
inherent to the way gdbm (and probably other dbm-style databases)
works. If the value of the new entry is longer or shorter than that of
the old one, gdbm will insert a new key/value pair, but will not delete
the old one, probably for the sake of performance. Only when an
optimize is done on the database file, the old key/value pair will be
deleted. Gdbm will return the correct value however, even if there seem
to be two entries (as seen with less filename.db).
------------------------------------------------------------------------
[2002-09-30 05:51:49] jelte.werkhoven@itfy.com
I'm using three gdbm databases which are read and written to by both a
C daemon and a php-script.
------------------------------------------------------------------------
[2002-09-30 05:45:05] hholzgra@php.net
which ext/dba backend are you refering to? gdbm, db2, db3?
------------------------------------------------------------------------
[2002-09-30 03:34:16] jelte.werkhoven@itfy.com
I think it might be worth mentioning in the documentation for the
dba_replace function that to actually replace an entry in a *DBM-type
database, you need to pad the value to the exact lenght of the value to
be replaced. This seems to go for both entries shorter and longer than
the replacing value. I also added a comment to the documention to this
extent but this is, in my opinion, cardinal to the differance between
dba_replace and dba_insert so it might be worth mentioning. Also, data
corruption and infinite growth of the data file will result if the
length is not padded.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19669&edit=1