CodeIgniter Forums
Extended the DB - 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: Extended the DB (/showthread.php?tid=12556)



Extended the DB - El Forum - 10-23-2008

[eluser]Unknown[/eluser]
I need to overload the insert, query, update, delete functions....can't figure out what to extend or that to do to get it to work...basically I want to do something then pass it off to the internal query/insert/update/delete functions

I'm not sure what to extend....

I want to basically add 1 variable to the methods at the end to use memcache if set to true....and then run the parent query, insert, update, delete to do the action....

Thank you


Extended the DB - El Forum - 10-23-2008

[eluser]Dready[/eluser]
Hello,

after having read the code, it's not that easy to extend CI database classes. For your own problem, the simplest seems to be to overwrite the file "system/database/DB_active_rec.php", or to extend it and add your extended class in the loading logic inside "system/database/DB.php".

Good luck !


Extended the DB - El Forum - 10-23-2008

[eluser]Derek Allard[/eluser]
In fact, "Note: At this time the Database classes can not be replaced with your own versions." (Creating Libraries). Sorry. Couldn't you just put code in your controller that run additional tasks after the insert is completed?