views:

43

answers:

1

I set up a site on my local system using PDO and a MySQL Database. I used PDO because when the site goes on the live server I have to user SQL Server and I was hoping PDO would take care of all my query conflicts.

Now that I'm up on the live server I get an error whenever the application uses the "LIMIT" function. I realize this is a MySQL specific function but shouldn't PDO take care of the conflict? How do I fix it so that site will work on MySQL and SQLSRV?

Thanks in advance.

A: 

Never develop in one technology expecting to use a different technology in prod.

It fails because there is no SQL Server equivalent for LIMIT so it can't convert.

If you expect different backends to be possible, use ANSII standard SQL not database specific things. If you expect to use only SQL Server in prod, develop in SQL Server (there is a free version).

HLGEM
Well ultimately I want it to work on both. And yes, I expect it to. Isn't that what PDO is all about??
jwerre
"it doesn't rewrite SQL or emulate missing features" fromhttp://www.php.net/manual/en/intro.pdo.php
HLGEM
@jwerre: no, PDO is about being able to use the same _interface_ (so you don't need to alter actual function/object declarations, names, and calls). However, it has NO control over the strings you send to it, and those should be ANSII as HLGEM said.
Wrikken