ID: 19669 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Documentation problem Operating System: linux PHP Version: 4.2.1 New Comment:
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). Previous Comments: ------------------------------------------------------------------------ [2002-09-30 05:51:49] [EMAIL PROTECTED] 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] [EMAIL PROTECTED] which ext/dba backend are you refering to? gdbm, db2, db3? ------------------------------------------------------------------------ [2002-09-30 03:34:16] [EMAIL PROTECTED] 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 -- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php