Req #6795 [NEW]: portability problem with case and alias
| From: | felix_ant at gva dot es | Date: | Thu, 16 Feb 2006 14:03:52 +0000 |
| Subject: | Req #6795 [NEW]: portability problem with case and alias | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-7530@lists.php.net to get a copy of this message | ||
From: felix_ant at gva dot es
Operating system: Linux
Package version:
PHP version: 4.3.9
Package: Documentation
Bug Type: Feature/Change Request
Bug description: portability problem with case and alias
Description:
------------
Hello!
We are developing an application that uses PEAR::DB. We are testing the
portability to different Databases. We are testing with Oracle and
PostgreSQL. We have found a problem: Oracle returns the result of a query
with the column names in upper case and PostgreSQL with lower case except
the columns that have column alias.
What we want is the returned result to be always in uppercase or in
lowercase (whatever the DB were) but always respecting the column alias
case mode if this alias exists.
Are there any type of portability option that can solve our problem?
Test script:
---------------
/*OPTION 1*/
$select = "select cpro,cmun as \"codigoMunicipio\", dmun as
\"descMunicipio\" from tcom_municipios";
$origen = DB::connect($dsn);
$res = $origen->getAll($select,DB_FETCHMODE_ASSOC);
/*OPTION 2*/
$select = "select cpro,cmun as \"codigoMunicipio\", dmun as
\"descMunicipio\" from tcom_municipios";
$origen = DB::connect($dsn);
$origen->setOption('portability', DB_PORTABILITY_LOWERCASE);
$res = $origen->getAll($select,DB_FETCHMODE_ASSOC);
Expected result:
----------------
Result:
In PostgreSQL:
Array ( [cpro] => 46 [codigoMunicipio] => 903 [descMunicipio] => SAN
ANTONIO)
In Oracle:
Array ( [cpro] => 46 [codigoMunicipio] => 903 [descMunicipio] => SAN
ANTONIO)
Actual result:
--------------
/*OPTION 1*/
In PostgreSQL:
Array ( [cpro] => 46 [codigoMunicipio] => 903 [descMunicipio] => SAN
ANTONIO)
In Oracle:
Array ( [CPRO] => 46 [codigoMunicipio] => 903 [descMunicipio] => SAN
ANTONIO)
The result is not correct in Oracle because our application was waiting
columns named cpro, codigoMunicipio and descMunicipio.
/*OPTION 2*/
In PostgreSQL:
Array ( [cpro] => 46 [codigomunicipio] => 903 [descmunicipio] => SAN
ANTONIO)
In Oracle:
Array ( [cpro] => 46 [codigomunicipio] => 903 [descmunicipio] => SAN
ANTONIO)
The result is not correct because our application was waiting columns
named cpro, codigoMunicipio and descMunicipio.
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=6795&edit=1
--