CodeIgniter Forums

Full Version: Writing a New Database Driver (or more?)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

[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.

El Forum

[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.