CodeIgniter Forums
Integrating CI with Pear DB class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Integrating CI with Pear DB class (/showthread.php?tid=4865)



Integrating CI with Pear DB class - El Forum - 12-20-2007

[eluser]Myles Wakeham[/eluser]
I'm trying to inherit some open source code from another developer to work with a MySQL database. My goal is to turn his class into a library function in CI so that I can use it in multiple CI projects I'm working on.

The code includes the Pear DB library, so either I have to go through his code line by line and re-write it to work with the CI database connection classes, or find a way to get Pear DB to work inside of CI. On first glance there seems to be some naming conflicts in there between CI's database classes and Pears.

Out of interest, has anyone had to do a similar thing with Pear DB and CI together before? I'm curious as to the level of effort that was involved in making classes written for Pear to work inside of CI.

Thanks in advance for any suggestions.

Myles


Integrating CI with Pear DB class - El Forum - 12-20-2007

[eluser]Vik[/eluser]
Perhaps someone else can answer the specific question about Pear DB. But, using CI's database stuff is really easy. It may not take much time to transfer the source code database calls, from Pear to CI.


Integrating CI with Pear DB class - El Forum - 12-20-2007

[eluser]maadmac[/eluser]
[quote author="Vik" date="1198206362"]Perhaps someone else can answer the specific question about Pear DB. But, using CI's database stuff is really easy. It may not take much time to transfer the source code database calls, from Pear to CI.[/quote]

Ditto. Honestly I think that's your best bet.


Integrating CI with Pear DB class - El Forum - 12-21-2007

[eluser]Rick Jolly[/eluser]
Stick with PEAR DB. If the existing code uses it, you shouldn't have to change anything except maybe the include path. I don't think you'll have any problem with naming conflicts since PEAR DB is object oriented.


Integrating CI with Pear DB class - El Forum - 12-21-2007

[eluser]danfreak[/eluser]
Try this solution:

- How to include external libraries

Or simply add the
Code:
//Windows
ini_set('include_path', ini_get('include_path').';'.BASEPATH.'application/my_classes/')

//Linux
ini_set('include_path', ini_get('include_path').':'.BASEPATH.'application/my_classes/')

in your root folder index.php file

In fact the index.php file works as a bootstrap.

Dan