Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #6573 Patch to support quoted table names in DB_oci8::tableInfo
Submitted: 2006-01-24 23:15 UTC
From: aaron at 100-acre dot com Assigned: danielc
Status: Closed Package: MDB2_Driver_oci8
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2006-01-24 23:15 UTC] aaron at 100-acre dot com
Description: ------------ The following small change in the oci8.php driver should fix this. Sorry for not including a proper diff. In... $Id: oci8.php,v 1.103 2005/04/11 15:10:22 danielc Exp $ Insert the following *replacing line 1004*. //quoted table names should be passed through unchanged (expect for removing the quotes themselves if (strstr($result, '"')) { $result = str_replace('"','',$result); } else { $result = strtoupper($result); } Test script: --------------- /* in oracle: create table "Test" ( testcolumn int not null ) */ $db = DB::connect('oci8://user:pwd@tcp(hostspec)'); print_r($db->tableInfo('"Test"')); Expected result: ---------------- Array ( [0] => Array ( [table] => Test [name] => TESTCOLUMN [type] => NUMBER [len] => 22 [flags] => not_null ) ) Actual result: -------------- Array ( )

Comments

 [2006-01-25 13:49 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-01-25 19:01 UTC] aaron at 100-acre dot com
As is often the case, the delimited identifiers are there for "historical" reasons (namely that the database in question was ported from MSSQL where mixed case table names are allowed and tons of code uses this convention). The quotes need to be striped because the user_* views list quoted-identfiers without the quotes (at least in 10g). Oracle says [1] that quoted indentifers cannot contain a the (") character so str_replace should be safe to remove the quotes at the start and end of the $result. [1] http://oracleheva1.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements008.htm (Rule 6)
 [2006-01-25 19:08 UTC] aaron at 100-acre dot com
Forgot to mention what may or may not be obivous: while user_* views don't include the quotes they do store the rest of the tablename in it's original form and that it is possible (if painful) to have "TestTable", "Testtable" and "TestTABLE" as three different tables in the same schema so we do need to perserve the case when looking up quoted table names.
 [2006-02-07 19:13 UTC] aaron at 100-acre dot com
Also related to quotedIdentifiers.... class DB_oci8 should override getSequenceName to allow the quote (") character. Like so perhaps... function getSequenceName($sqn) { return sprintf($this->getOption('seqname_format'), preg_replace('/[^a-z0-9_".]/i', '_', $sqn)); }
 [2006-03-11 10:23 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-03-23 12:30 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-03-23 18:12 UTC] aaron at 100-acre dot com
The problem is that it is impossible to access tableInfo on mixed case named tables currently. If you can find a better way to support that then I'm all ears.
 [2006-03-24 07:52 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-04-19 08:27 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!