CodeIgniter Forums
Writing a New Database Driver (or more?) - 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: Writing a New Database Driver (or more?) (/showthread.php?tid=12030)



Writing a New Database Driver (or more?) - El Forum - 10-02-2008

[eluser]Unknown[/eluser]
Hey igniters, I'm developing an application with CodeIgniter, but the app won't be using any of the standard drivers. Instead, it will be using CouchDB.

CouchDB strays quite far from the traditional SQL structure. I would like to write a new database driver/plugin/class that can be used in place of the original database object. I like how the current db is integrated in CodeIgniter's code flow; where would I begin to write to achieve this same integration?


Writing a New Database Driver (or more?) - El Forum - 10-02-2008

[eluser]Derek Allard[/eluser]
Welcome to CI Tapwater. Start by opening up system/database and see what's in there. Drivers are essentially self contained in their own folders. Start by duplicating one of them and adding your code in and see where it leads you. I don't know much about couchDB unfortunately, so I can't offer much more specific guidance then that.


Writing a New Database Driver (or more?) - El Forum - 10-03-2008

[eluser]xwero[/eluser]
If you are going to create a driver for the CI database class you should set AR to false in the config/database.php as it is based on sql to query the database it's connected with.

For the couchdb/couchdb_result.php file you will have to convert the json responses to an object or an array depending on the expected output.