summaryrefslogtreecommitdiff
path: root/ext/dbx
diff options
context:
space:
mode:
authorMarc Boeren <mboeren@php.net>2002-10-24 14:16:28 +0000
committerMarc Boeren <mboeren@php.net>2002-10-24 14:16:28 +0000
commitb5783184ea0fd46aaa07503373b71680baa822e6 (patch)
tree335304a5863424ee1e4e15fb54a684d6cf2aa30d /ext/dbx
parente95fa639d6915697c581808bfd7d88a8920d1597 (diff)
downloadphp-git-b5783184ea0fd46aaa07503373b71680baa822e6.tar.gz
Not happy with the hack to handle the uppercase fieldnames that oracle
returns. Changed the dbx_oci8 behaviour to return lowercase instead, which is also a hack but at least it makes it much easier for users to create portable apps (Mc). # also, I prefer lowercase :-)
Diffstat (limited to 'ext/dbx')
-rw-r--r--ext/dbx/tests/005.phpt10
-rw-r--r--ext/dbx/tests/007.phpt9
-rw-r--r--ext/dbx/tests/008.phpt48
-rw-r--r--ext/dbx/tests/dbx_test.p16
4 files changed, 30 insertions, 53 deletions
diff --git a/ext/dbx/tests/005.phpt b/ext/dbx/tests/005.phpt
index 6c78e7717c..993d9a9ada 100644
--- a/ext/dbx/tests/005.phpt
+++ b/ext/dbx/tests/005.phpt
@@ -30,9 +30,9 @@ else {
// select query
if ($dro=dbx_query($dlo, $sql_statement)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".$dro->data[$i][$fieldname_case_function('field1')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".$dro->data[$i]['field1'].".".strlen($dro->data[$i]['field2'])."\n");
}
- $dro->data[0][$fieldname_case_function('id')]='changed_value';
+ $dro->data[0]['id']='changed_value';
print($dro->data[0][0]."\n");
}
// insert query
@@ -40,7 +40,7 @@ else {
print('insert-query: dbx_query works ok'."\n");
if ($dro=dbx_query($dlo, $sql_select_statement)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
}
}
}
@@ -49,7 +49,7 @@ else {
print('update-query: dbx_query works ok'."\n");
if ($dro=dbx_query($dlo, $sql_select_statement)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
}
}
}
@@ -58,7 +58,7 @@ else {
print('delete-query: dbx_query works ok'."\n");
if ($dro=dbx_query($dlo, $sql_select_statement)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')].".".strlen($dro->data[$i][$fieldname_case_function('field2')])."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description'].".".strlen($dro->data[$i]['field2'])."\n");
}
}
}
diff --git a/ext/dbx/tests/007.phpt b/ext/dbx/tests/007.phpt
index 2983db409b..534a792b87 100644
--- a/ext/dbx/tests/007.phpt
+++ b/ext/dbx/tests/007.phpt
@@ -22,9 +22,8 @@ function invalid_cmp() {
return "blabla";
}
function cmp($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"));
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
+ $rv = dbx_compare($a, $b, "description");
+ if (!$rv) $rv = dbx_compare($a, $b, "id");
return $rv;
}
if (!$dlo) {
@@ -36,11 +35,11 @@ else {
print('this won\'t work'."\n");
}
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
if (dbx_sort($dro, $compare_function)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
if (!@dbx_sort(0, $compare_function)) {
diff --git a/ext/dbx/tests/008.phpt b/ext/dbx/tests/008.phpt
index a750335d4e..8553671f20 100644
--- a/ext/dbx/tests/008.phpt
+++ b/ext/dbx/tests/008.phpt
@@ -22,39 +22,33 @@ $compare_function_5 = "cmp_description_txt_id";
$compare_function_6 = "cmp_description_number_id";
$dlo = dbx_connect($module, $host, $database, $username, $password);
function cmp_description_id($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"));
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
+ $rv = dbx_compare($a, $b, "description");
+ if (!$rv) $rv = dbx_compare($a, $b, "id");
return $rv;
}
function cmp_description_desc_id($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"), DBX_CMP_DESC);
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
+ $rv = dbx_compare($a, $b, "description", DBX_CMP_DESC);
+ if (!$rv) $rv = dbx_compare($a, $b, "id");
return $rv;
}
function cmp_description_id_desc($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"));
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"), DBX_CMP_DESC);
+ $rv = dbx_compare($a, $b, "description");
+ if (!$rv) $rv = dbx_compare($a, $b, "id", DBX_CMP_DESC);
return $rv;
}
function cmp_description_desc_id_desc($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"), DBX_CMP_DESC);
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"), DBX_CMP_DESC);
+ $rv = dbx_compare($a, $b, "description", DBX_CMP_DESC);
+ if (!$rv) $rv = dbx_compare($a, $b, "id", DBX_CMP_DESC);
return $rv;
}
function cmp_description_txt_id($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"), DBX_CMP_TEXT);
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
+ $rv = dbx_compare($a, $b, "description", DBX_CMP_TEXT);
+ if (!$rv) $rv = dbx_compare($a, $b, "id");
return $rv;
}
function cmp_description_number_id($a, $b) {
- $fieldname_case_function = $GLOBALS['fieldname_case_function'];
- $rv = dbx_compare($a, $b, $fieldname_case_function("description"), DBX_CMP_NUMBER);
- if (!$rv) $rv = dbx_compare($a, $b, $fieldname_case_function("id"));
+ $rv = dbx_compare($a, $b, "description", DBX_CMP_NUMBER);
+ if (!$rv) $rv = dbx_compare($a, $b, "id");
return $rv;
}
if (!$dlo) {
@@ -66,42 +60,42 @@ else {
print('this won\'t work'."\n");
}
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
if (dbx_sort($dro, $compare_function_1)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
if (dbx_sort($dro, $compare_function_2)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
if (dbx_sort($dro, $compare_function_3)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
if (dbx_sort($dro, $compare_function_4)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
if (dbx_sort($dro, $compare_function_5)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
if (dbx_sort($dro, $compare_function_6)) {
for ($i=0; $i<$dro->rows; ++$i) {
- print($dro->data[$i][$fieldname_case_function('id')].".".$dro->data[$i][$fieldname_case_function('description')]."\n");
+ print($dro->data[$i]['id'].".".$dro->data[$i]['description']."\n");
}
}
- if (!@dbx_compare($a, $b, $fieldname_case_function("fieldname"))) {
+ if (!@dbx_compare($a, $b, "fieldname")) {
print('wrong parameters: dbx_compare failure works ok'."\n");
}
- if (!@dbx_compare($a, $b, $fieldname_case_function("fieldname"), DBX_CMP_NATIVE, "12many")) {
+ if (!@dbx_compare($a, $b, "fieldname", DBX_CMP_NATIVE, "12many")) {
print('too many parameters: dbx_compare failure works ok'."\n");
}
if (!@dbx_compare($a, $b)) {
diff --git a/ext/dbx/tests/dbx_test.p b/ext/dbx/tests/dbx_test.p
index f6cc9ee16a..67f2546b24 100644
--- a/ext/dbx/tests/dbx_test.p
+++ b/ext/dbx/tests/dbx_test.p
@@ -1,8 +1,6 @@
<?php
// set the $connection to match your test-database setup
// (possibly change the rest of the settings too)
-// $fieldname_case_function was introduced for oci8, as oracle returns
-// the fieldnames in uppercase
// e.g. $connection = DBX_MYSQL;
$connection = NULL;
switch ($connection) {
@@ -13,7 +11,6 @@ switch ($connection) {
$username="dbx_testuser";
$password="dbx_testpassword";
$module_name="mysql";
- $fieldname_case_function="dbx_unchangedcase";
break;
case DBX_MSSQL:
$module=DBX_MSSQL;
@@ -22,7 +19,6 @@ switch ($connection) {
$username="";
$password="";
$module_name="mssql";
- $fieldname_case_function="dbx_unchangedcase";
break;
case DBX_ODBC:
$module=DBX_ODBC;
@@ -31,7 +27,6 @@ switch ($connection) {
$username="dbx_testuser";
$password="dbx_testpassword";
$module_name="odbc";
- $fieldname_case_function="dbx_unchangedcase";
break;
case DBX_PGSQL:
$module=DBX_PGSQL;
@@ -40,7 +35,6 @@ switch ($connection) {
$username="dbx_testuser";
$password="dbx_testpassword";
$module_name="pgsql";
- $fieldname_case_function="dbx_unchangedcase";
break;
case DBX_FBSQL:
$module=DBX_FBSQL;
@@ -49,7 +43,6 @@ switch ($connection) {
$username="dbx_testuser";
$password="dbx_testpassword";
$module_name="fbsql";
- $fieldname_case_function="dbx_unchangedcase";
break;
case DBX_OCI8:
$module=DBX_OCI8;
@@ -58,7 +51,6 @@ switch ($connection) {
$username="dbx_testuser";
$password="dbx_testpassword";
$module_name="oci8";
- $fieldname_case_function="dbx_uppercase";
break;
case DBX_SYBASECT:
$module=DBX_SYBASECT;
@@ -67,15 +59,7 @@ switch ($connection) {
$username="dbx_testuser";
$password="dbx_testpassword";
$module_name="sybase_ct";
- $fieldname_case_function="dbx_unchangedcase";
break;
}
-function dbx_uppercase($sz) {
- return strtoupper($sz);
- }
-function dbx_unchangedcase($sz) {
- return $sz;
- }
-
?> \ No newline at end of file