RE: [PHP-DB] Re: OCI_ASSOC returns key with upper case string
hi all , i'm quite new to this mailing list i d like you to test with lowercase object names in Oracle but i don't recommend to use it in general for example (1) create table test1 ( b number ) ; is different from (2) create table "test1" ( "a" number ) ; in oracle , if you don't quote your object names in oracle they will always be uppercase desc test1 only works for (1) desc "test1" works for (2) case (2) will have all objects in lowercase ( table and column name ) and in sqlplus MUST be enclosed with " > Francois RENAULT > DBA Oracle > > e-TF1 Technologie -Message d'origine- De : Manuel Lemos [mailto:[EMAIL PROTECTED] Envoyé : samedi 5 juillet 2003 04:24 À : [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Objet : [PHP-DB] Re: OCI_ASSOC returns key with upper case string Hello, On 07/04/2003 08:38 PM, Reuben D. Budiardja wrote: > First let me say that I am not sure if this is PHP problem or Oracle. I posted > this earlier in php-general, but after looking at the available mailing lists > again, I thought this forum would be more appropriate. Sorry if someone get > double post. > > I have a class that contains API for using postgresql, mysql, or oracle > database so switching database should be "in theory" just changing an > argument for me. > To make this sort, let just say that the return of a SELECT statement is > always in associative array, using either : > "pg_fetch_assoc" for pgsql > "mysql_fetch_assoc" for mysql > "ocifetchinto" with OCI_ASSOC flag for Oracle 9 > > Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the > key in lower case. But ocifetchinto returns the key in UPPER case. So this > discrepancy makes my code not as portable as I would like it. > Furthermore, the example here: > http://us2.php.net/manual/en/function.ocifetchinto.php > > doesn't even work, because it uses lower case as the associative array key. > > Why is this the case? Is this PHP problem or Oracle config problem? Either > way, can anyone suggest a solutions? Of course I can do all kind of array > manipulation in my API to make the key lower case, but that wouldn't be very > elegant and efficient No, that is just the way Oracle returns column names. It is not possible to provide a portable solution to return row in associative arrays because not only the column names case may be mapped, removed the table names or even have the column names truncated. That is the reason why Metabase never provided a function to return rows as associative arrays, as Metabase is focused on real database application portability. http://www.phpclasses.org/metabase -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: OCI_ASSOC returns key with upper case string
Hello, On 07/05/2003 04:25 PM, Reuben D. Budiardja wrote: First let me say that I am not sure if this is PHP problem or Oracle. I posted this earlier in php-general, but after looking at the available mailing lists again, I thought this forum would be more appropriate. Sorry if someone get double post. > Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the key in lower case. But ocifetchinto returns the key in UPPER case. So this discrepancy makes my code not as portable as I would like it. Is this PHP problem or Oracle config problem? No, that is just the way Oracle returns column names. Thanks for your reply. Do you or anyone know if there is something in the configuration of Oracle that can be changed for it to return lower case column? I read in the book Oracle 9i Complete Reference that oracle can use mixed case column and table name, but haven't found the "how to do it" yet. I'd rather do that than converting all my apps. The problem is we're supposed to write for mysql, but then client change their mind and use Oracle. Not that I know. I think you need to convert your applications soon or later to use numeric indexes. Meanwhile you may want to try do the case conversion in your database abstraction. That is what Metabase does. It is not possible to provide a portable solution to return row in associative arrays because not only the column names case may be mapped, removed the table names or even have the column names truncated. That is the reason why Metabase never provided a function to return rows as associative arrays, as Metabase is focused on real database application portability. http://www.phpclasses.org/metabase -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: OCI_ASSOC returns key with upper case string
On Friday 04 July 2003 10:23 pm, Manuel Lemos wrote: > Hello, > > On 07/04/2003 08:38 PM, Reuben D. Budiardja wrote: > > First let me say that I am not sure if this is PHP problem or Oracle. I > > posted this earlier in php-general, but after looking at the available > > mailing lists again, I thought this forum would be more appropriate. > > Sorry if someone get double post. > > > Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with > > the key in lower case. But ocifetchinto returns the key in UPPER case. So > > this discrepancy makes my code not as portable as I would like it. > > Is this PHP problem or Oracle config problem? > > No, that is just the way Oracle returns column names. Thanks for your reply. Do you or anyone know if there is something in the configuration of Oracle that can be changed for it to return lower case column? I read in the book Oracle 9i Complete Reference that oracle can use mixed case column and table name, but haven't found the "how to do it" yet. I'd rather do that than converting all my apps. The problem is we're supposed to write for mysql, but then client change their mind and use Oracle. Sorry if this is a bit OT. Thanks for any help. RDB > It is not possible > to provide a portable solution to return row in associative arrays > because not only the column names case may be mapped, removed the table > names or even have the column names truncated. > > That is the reason why Metabase never provided a function to return rows > as associative arrays, as Metabase is focused on real database > application portability. > > http://www.phpclasses.org/metabase -- Reuben D. Budiardja Department of Physics and Astronomy The University of Tennessee, Knoxville, TN - /"\ ASCII Ribbon Campaign against HTML \ / email and proprietary format X attachments. / \ - Have you been used by Microsoft today? Choose your life. Choose freedom. Choose LINUX. - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: OCI_ASSOC returns key with upper case string
Hello, On 07/04/2003 08:38 PM, Reuben D. Budiardja wrote: First let me say that I am not sure if this is PHP problem or Oracle. I posted this earlier in php-general, but after looking at the available mailing lists again, I thought this forum would be more appropriate. Sorry if someone get double post. I have a class that contains API for using postgresql, mysql, or oracle database so switching database should be "in theory" just changing an argument for me. To make this sort, let just say that the return of a SELECT statement is always in associative array, using either : "pg_fetch_assoc" for pgsql "mysql_fetch_assoc" for mysql "ocifetchinto" with OCI_ASSOC flag for Oracle 9 Now, pg_fetch_assoc and mysql_fetch_assoc return the associate array with the key in lower case. But ocifetchinto returns the key in UPPER case. So this discrepancy makes my code not as portable as I would like it. Furthermore, the example here: http://us2.php.net/manual/en/function.ocifetchinto.php doesn't even work, because it uses lower case as the associative array key. Why is this the case? Is this PHP problem or Oracle config problem? Either way, can anyone suggest a solutions? Of course I can do all kind of array manipulation in my API to make the key lower case, but that wouldn't be very elegant and efficient No, that is just the way Oracle returns column names. It is not possible to provide a portable solution to return row in associative arrays because not only the column names case may be mapped, removed the table names or even have the column names truncated. That is the reason why Metabase never provided a function to return rows as associative arrays, as Metabase is focused on real database application portability. http://www.phpclasses.org/metabase -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php