PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old October 30th, 2007, 02:44 PM
golgot59 golgot59 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 4 golgot59 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 5 sec
Reputation Power: 0
MDB2 / OCI8 and "is null" in a query

Hello,

Is someone can help me ?
I have to make queries like:
&db->query(select name from people where name.name='' )
to be compatible on an ORACLE database.
It works with mysql.
Is there a way with mdb2/oci8 to automaticaly convert the query?
ie: the " ='' " become " is null " ?

thx a lot.

Reply With Quote
  #2  
Old October 30th, 2007, 05:09 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 153 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 29 m 35 sec
Reputation Power: 2
No, MDB2 doesn't abstract such semantical issues, it just abstracts the functions that PHP (like ...connect()) or the DBMS (like SUBSTR()) offers.

Can't you make your table schemes compatible in both DBMS, so that you can use "IS NULL" with both MySQL and Oracle?

Reply With Quote
  #3  
Old October 31st, 2007, 03:12 AM
golgot59 golgot59 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 4 golgot59 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 5 sec
Reputation Power: 0
thx for your answer !

I 'm not allowed to create databases, so i think i'd have to modify the MDB2_OCI8 driver (if possible).

In fact i've to work with (oracle and mysql and sqlserver),
so could you explain how could I modify the "table scheme" to be compatible with all theses databases?
ie: how to say mysql to understand the "is null" ?

thx.

Reply With Quote
  #4  
Old October 31st, 2007, 05:58 AM
golgot59 golgot59 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 4 golgot59 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 5 sec
Reputation Power: 0
I found a barbarian way to make it work !!

in the oci8.php :

in the modifyquery function:

$query=preg_replace('`= *\'\'`',' is null ', $query);

it seems to work !

Reply With Quote
  #5  
Old October 31st, 2007, 08:02 AM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 153 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 29 m 35 sec
Reputation Power: 2
Modifying the OCI8 driver from MDB2 might work, but you will lose your changes if you update MDB2 (or the driver).

MySQL knows "IS NULL" for comparisions, but IIRC there are some differences between MySQL and Oracle in regard of NULL values. (Sorry, I can't tell you more details about it, maybe Google or another forum member can help you.)

Reply With Quote
  #6  
Old October 31st, 2007, 12:30 PM
golgot59 golgot59 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2007
Posts: 4 golgot59 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 5 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
Modifying the OCI8 driver from MDB2 might work, but you will lose your changes if you update MDB2 (or the driver).

MySQL knows "IS NULL" for comparisions, but IIRC there are some differences between MySQL and Oracle in regard of NULL values. (Sorry, I can't tell you more details about it, maybe Google or another forum member can help you.)


Yes I know I'd always have to make my changes each time I update OCI PEAR Package...

thx.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > MDB2 / OCI8 and "is null" in a query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT