Merge branch 'PHP-5.5'

This commit is contained in:
Lars Strojny 2013-01-15 09:35:47 +01:00
commit 9d88c8d904
16 changed files with 78 additions and 21 deletions

View File

@ -88,14 +88,15 @@ DBA_UPDATE_FUNC(flatfile)
gval.dsize = vallen; gval.dsize = vallen;
switch(flatfile_store(dba, gkey, gval, mode==1 ? FLATFILE_INSERT : FLATFILE_REPLACE TSRMLS_CC)) { switch(flatfile_store(dba, gkey, gval, mode==1 ? FLATFILE_INSERT : FLATFILE_REPLACE TSRMLS_CC)) {
case 0:
return SUCCESS;
case 1:
return FAILURE;
case -1: case -1:
php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Operation not possible"); php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Operation not possible");
return FAILURE; return FAILURE;
default: default:
case 0: php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "Unknown return value");
return SUCCESS;
case 1:
php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Key already exists");
return FAILURE; return FAILURE;
} }
} }

View File

@ -104,11 +104,18 @@ DBA_UPDATE_FUNC(gdbm)
gval.dptr = (char *) val; gval.dptr = (char *) val;
gval.dsize = vallen; gval.dsize = vallen;
if(gdbm_store(dba->dbf, gkey, gval, switch (gdbm_store(dba->dbf, gkey, gval, mode == 1 ? GDBM_INSERT : GDBM_REPLACE)) {
mode == 1 ? GDBM_INSERT : GDBM_REPLACE) == 0) case 0:
return SUCCESS; return SUCCESS;
case 1:
return FAILURE;
case -1:
php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "%s", gdbm_strerror(gdbm_errno)); php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "%s", gdbm_strerror(gdbm_errno));
return FAILURE; return FAILURE;
default:
php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "Unknown return value");
return FAILURE;
}
} }
DBA_EXISTS_FUNC(gdbm) DBA_EXISTS_FUNC(gdbm)

View File

@ -101,7 +101,6 @@ DBA_UPDATE_FUNC(inifile)
case 0: case 0:
return SUCCESS; return SUCCESS;
case 1: case 1:
php_error_docref1(NULL TSRMLS_CC, key, E_WARNING, "Key already exists");
return FAILURE; return FAILURE;
} }
} }

View File

@ -96,13 +96,15 @@ DBA_FETCH_FUNC(qdbm)
DBA_UPDATE_FUNC(qdbm) DBA_UPDATE_FUNC(qdbm)
{ {
QDBM_DATA; QDBM_DATA;
int result;
result = dpput(dba->dbf, key, keylen, val, vallen, mode == 1 ? DP_DKEEP : DP_DOVER); if (dpput(dba->dbf, key, keylen, val, vallen, mode == 1 ? DP_DKEEP : DP_DOVER)) {
if (result)
return SUCCESS; return SUCCESS;
}
if (dpecode != DP_EKEEP) {
php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "%s", dperrmsg(dpecode)); php_error_docref2(NULL TSRMLS_CC, key, val, E_WARNING, "%s", dperrmsg(dpecode));
}
return FAILURE; return FAILURE;
} }

View File

@ -18,6 +18,8 @@ database handler: db1
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -33,6 +35,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -18,6 +18,8 @@ database handler: db2
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -33,6 +35,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -18,6 +18,8 @@ database handler: db3
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -33,6 +35,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -22,6 +22,8 @@ database handler: db4
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -37,6 +39,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -18,6 +18,8 @@ database handler: dbm
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -33,6 +35,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -22,6 +22,8 @@ database handler: flatfile
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -37,6 +39,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -21,6 +21,8 @@ database handler: gdbm
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write:%sallowed Read during write:%sallowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -46,8 +46,16 @@ do {
echo "Read during write: allowed\n"; echo "Read during write: allowed\n";
} }
if ($db_writer!==FALSE) { if ($db_writer!==FALSE) {
dba_insert("key number 6", "The 6th value", $db_writer); if (dba_insert("key number 6", "The 6th value", $db_writer)) {
@dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer); echo '"key number 6" written' . "\n";
} else {
echo 'Failed to write "key number 6"' . "\n";
}
if (dba_insert("key number 6", "The 6th value inserted again would be an error", $db_writer)) {
echo '"key number 6" written 2nd time' . "\n";
} else {
echo 'Failed to write "key number 6" 2nd time' . "\n";
}
dba_replace("key2", "Content 2 replaced 2nd time", $db_writer); dba_replace("key2", "Content 2 replaced 2nd time", $db_writer);
dba_delete("key4", $db_writer); dba_delete("key4", $db_writer);
echo dba_fetch("key2", $db_writer)."\n"; echo dba_fetch("key2", $db_writer)."\n";

View File

@ -18,6 +18,8 @@ database handler: inifile
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -33,6 +35,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -18,6 +18,8 @@ database handler: ndbm
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -33,6 +35,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -19,6 +19,8 @@ database handler: qdbm
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write:%sallowed Read during write:%sallowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {

View File

@ -22,6 +22,8 @@ database handler: tcadb
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {
@ -37,6 +39,8 @@ array(3) {
Content String 2 Content String 2
Content 2 replaced Content 2 replaced
Read during write: not allowed Read during write: not allowed
"key number 6" written
Failed to write "key number 6" 2nd time
Content 2 replaced 2nd time Content 2 replaced 2nd time
The 6th value The 6th value
array(3) { array(3) {