#49352 [NEW]: dba_open DB4 DB_HASH format can not be choosen to create a database
| From: | VJTD3 at VJTD3 dot com | Date: | Tue, 25 Aug 2009 00:33:33 +0000 |
| Subject: | #49352 [NEW]: dba_open DB4 DB_HASH format can not be choosen to create a database | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-141459@lists.php.net to get a copy of this message | ||
From: VJTD3 at VJTD3 dot com
Operating system: Linux
PHP version: 5.3.0
PHP Bug Type: dBase related
Bug description: dba_open DB4 DB_HASH format can not be choosen to create a database
Description:
------------
dba_open DB4 DB_HASH format can not be choosen to create a database
dba_open when used with the "driver" db4 defaults to btree but hash is
also needed. DB_HASH is not defined and isn't passed when defined to the
creation environment.
example showing DB_HASH not defined
<?php
echo (defined('DB_HASH') ? 1 : 0);
?>
there are 2 types of database structures, hash and btree.
db.h
typedef enum {
DB_BTREE=1,
DB_HASH=2,
DB_RECNO=3,
DB_QUEUE=4,
DB_UNKNOWN=5
} DBTYPE;
is from the source files...
http://download.oracle.com/berkeley-db/db-4.7.25.NC.tar.gz
db-4.7.25.NC/build_brew/db.h
by default php uses btree to create but hash is needed too. there is no
way to change the flags to use hash.
http://us3.php.net/manual/en/function.dba-open.php
resource dba_open ( string $path , string $mode [, string $handler [,
mixed $... ]] )
php-5.2.9/dba_db4.c line 74-76
type = info->mode == DBA_READER ? DB_UNKNOWN :
info->mode == DBA_TRUNC ? DB_BTREE :
s ? DB_BTREE : DB_UNKNOWN;
php-5.2.9/dba_db4.c line 100 - 104
#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
(err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0)
{
#else
(err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0)
{
#endif
http://www.oracle.com/technology/documentation/berkeley-db/db/ref/upgrade.4.1/fop.html
if ((ret = dbp->open(dbp, "file", NULL, DB_BTREE, DB_CREATE, 0664)) != 0)
{
(void)dbp->close(dbp);
goto err_handler;
}
(btree example, hash would be DB_HASH)
Reproduce code:
---------------
<?php
echo (defined('DB_HASH') ? 1 : 0);
?>
Expected result:
----------------
1 and databases to be created in hash format
Actual result:
--------------
0 and database format is only btree with no way to change to hash
--
Edit bug report at http://bugs.php.net/?id=49352&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49352&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49352&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49352&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49352&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49352&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49352&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49352&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49352&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49352&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49352&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49352&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49352&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49352&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49352&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49352&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49352&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49352&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49352&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49352&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49352&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49352&r=mysqlcfg