The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Databases
> Database Management
|
Database abstraction later - any hep?
Discuss Database abstraction later - any hep? in the Database Management forum on Dev Shed. Database abstraction later - any hep? Database Management forum discussing non-database specific SQL. Structured Query Language was designed to be a robust and standardized language for manipulating relational databases.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 10th, 2002, 08:49 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Location: Newfoundland, Canada
Posts: 138
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
Database abstraction later - any hep?
Hello - I need to use MS SQL 2000 on an IIS machine with PHP, we are used to developping on a Unix platform and want to be able to write SQL for MySQL and have it work on the MS SQL databse, i.e. we want to use a database abstraction to be able to transfer our code between the two platform.
Basically, what I want to know is will anyone recommend for or against AdoDB and ODBC as a database abstraction layer IIS / are there any benchmarks for MS SQL performance with these factors?
BTW - I can NOT use the php native database connection classes - sql code will be different between MySQL and MSSQL.
Thanks.
Steve
|

June 11th, 2002, 10:58 PM
|
 |
Big Endian
|
|
Join Date: May 2001
Location: Fly-over country
|
|
|
I do not have a good answer for your question but I thought I would throw out a couple of suggestions that might help you with your problem. If I wanted to develop MS SQL code on a Unix box and port it over IIS with the minimum amount of changes I might try:
1. Download the free version of Sybase for Linux. Sybase syntax and SQL Server syntax are very close to one another since they used to be the same product back at version 4.x. I have developed code on a laptop using the Microsoft MSDE and ported the other way (to a Sybase database) and it worked well.
2. Abstract your database by using stored procedures instead of straight SQL statements. If you had Sybase, Oracle or any other database that supported stored procedures running on a Unix box, as long as your stored procedures in SQL Server were named the same, accepted the same parameters and performed the same task, the code should be portable.
3. Have an IF-THEN-ELSE statement based on a global variable to pick the correct SQL statement. You would just toggle the variable depending on which machine you were running on:
if MySQL
sql = "SELECT CONCAT(FirstName, ' ', LastName) AS FullName FROM tablename"
else
sql = "SELECT FirstName + ' ' + LastName AS FullName FROM tablename"
4. Have all of your database specific SQL statements and connection routines defined in a seperate file. Include that file in your web pages. The file would be named the same on both the IIS and the Unix machine, but each one would have different content.
|

June 12th, 2002, 03:26 AM
|
 |
Modding: Oracle MsSQL Firebird
|
|
Join Date: Jun 2001
Location: Outside US
|
|
|

June 12th, 2002, 08:19 AM
|
 |
/(bb|[^b]{2})/
|
|
Join Date: Nov 2001
Location: Somewhere in the great unknown
|
|
|
Just as a note, when comparing ODBC to the native database functions in php, ODBC is slow.
|

June 12th, 2002, 08:34 AM
|
 |
11
|
|
Join Date: Jul 2001
Location: Lynn, MA
|
|
|
If you're not bound to PHP, then I suggest checking out perl and DBI, which is a true database abstraction layer.
It's very, very mature and allows you to use databases with the exact same interface- if you don't use database specific functions, you can actually switch seamlessly between different RDBMS's.
And Perl, run under mod_perl, is just as fast as PHP. (there is also mod_perl similar modules for IIS, I believe activestate has them.)
|

June 12th, 2002, 08:56 AM
|
|
Contributing User
|
|
Join Date: Feb 2001
Location: Newfoundland, Canada
Posts: 138
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
I am tied to php for now, and also to microsoft sql server 2000. AdoDB seems like a possibility for now. Anyone have a reason why not or any REAL benchmarks (the ones on their site suck).
Thanks again
|

July 8th, 2002, 02:26 PM
|
|
Junior Member
|
|
Join Date: Jul 2002
Location: London/Stockholm
Posts: 4
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Excuse a newbie for interrupting a discussion above my head, but I am very curious to know if there is any special reason PEAR is not mentioned here? (URL)
It's the only database-abstraction-something that I knew before I read this thread, and since I'm working on an application that must connect to all kinds of places I use it. And it's free - are they all? I only tried it with MySQL so far, though.
Kindly, Beetrader
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|