0
votes

This my situation recently i am facing as a challenge,

My client website developed using Codeigniter framework on Windows platform using MSSQL database. So every file has a direct MSSQL queries to handle data.

Now they want to do a migration from MSSQL and Windows server to MySQL and Linux server. I knew, i need to do lot of work for the database migration.

But in that case (my assumption), if they would have used PDO previously as a Database layer, then i do not need to change query in each file to move MSSQL to MySQL.

Is that right?

My assumption about PDO may be stupid. But please your suggestion would be great in this scenario.

2
In my experience there are a lot of statement differences so changing how it connects (via PDO) wouldn't have made it easier on you. You'd likely still have a big broken website to fix. - Rasclatt

2 Answers

1
votes

Your assumption is wrong. PDO is not a database abstraction layer, but just an interface to database. It doesn't create SQL for you, like Doctrine does. So, every query, that is using different dialect, needs to be rewritten.

I see no point in such lamentations though. Does it matter what has or would have been done? What is done that is done, you have to bear with it.

1
votes

No, CodeIgniter doesn't require PDO. In fact, PDO support in CodeIgniter 2.x had an "experimental" status.

However, if your client has used custom-written SQL queries instead of CI's query builder methods, no abstraction layer would be able to help you with the migration.
PDO is a low-level abstraction that provides common function/method names for different database drivers (i.e. PDOStatement::fetch() instead of a different function name for every database); it doesn't deal with differences in SQL syntax.