CodeIgniter Forums
Can I replace the system/database directory of version 3.1 into version 2.2? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: Can I replace the system/database directory of version 3.1 into version 2.2? (/thread-66202.html)



Can I replace the system/database directory of version 3.1 into version 2.2? - afon - 09-20-2016

One of my projects is using CI 2.2.
And I want to use the PDO driver.
But I don't want to upgrade to 3.1.
If I only replace the system/database directory using 3.1, can it work well?

Thanks.

ps: replace the whole system/database directory


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - ciadmin - 09-20-2016

Sorry, but that won't work. There are too many other differences in the database driver structure between CI2 and CI3.


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - afon - 09-20-2016

(09-20-2016, 07:57 AM)ciadmin Wrote: Sorry, but that won't work. There are too many other differences in the database driver structure between CI2 and CI3.

I tried it.
It seems work. 
mysqli and pdo both works.

Huh Exclamation

I think I should check the source codes in system/database carefully.


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - ciadmin - 09-20-2016

Hmm - that is unexpected. The database drivers could be more decoupled from the other CI3 components than I thought!


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - mwhitney - 09-26-2016

The most significant changes to the database library were internal or in the form of additions to the API, so most things will probably work. The big issue is that it's an untested combination, and you'll probably find that any issues you do have will be difficult to troubleshoot, hard to track down, and definitely unsupported. You'll also still have most of the security issues in CI2 to worry about.

It's actually pretty amazing how many of the CI3 components can be swapped into CI2 with very few issues, but it requires a lot more attention to detail than just upgrading the whole thing at once.


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - afon - 09-26-2016

(09-26-2016, 01:14 PM)mwhitney Wrote: The most significant changes to the database library were internal or in the form of additions to the API, so most things will probably work. The big issue is that it's an untested combination, and you'll probably find that any issues you do have will be difficult to troubleshoot, hard to track down, and definitely unsupported. You'll also still have most of the security issues in CI2 to worry about.

It's actually pretty amazing how many of the CI3 components can be swapped into CI2 with very few issues, but it requires a lot more attention to detail than just upgrading the whole thing at once.

Thanks for your reply.


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - Narf - 09-27-2016

Here's a question: Why?


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - davidgv88 - 09-27-2016

You are a cowboy! Smile


RE: Can I replace the system/database directory of version 3.1 into version 2.2? - mwhitney - 09-28-2016

(09-27-2016, 12:21 AM)Narf Wrote: Here's a question: Why?

When I was running 2.x, it was helpful to use pieces of 3.x to patch the system, since a lot of things weren't back-ported. However, that was when 2.x was still somewhat supported.

Now, I'd say it's good if the intention is to move the site to 3.x. However, if it's just to pull some features from 3.x, it's definitely a bad idea. This long after end of life, anyone working on a 2.x site should be spending most of their development time on that site moving it to 3.x.