Database wrapper for Codeigniter 3

DaniWeb is built on top of the Codeigniter 3.1.x PHP framework. Although I probably should have built it as a CI model, here is the database library that we are using. You can see it mainly serves as a wrapper for CodeIgniter's built-in database class.

You can see we use a master-slave database setup. Some of the functionality includes logging if a slow query takes more than 1s. We also group all queries that are the result of a single POST request (e.g. submitting a form, etc.) in a transaction. If a query fails, we retry it, and if it fails multiple times, we roll back the transaction.

I hope this helps you with your own project, and even if it doesn't, perhaps you'll find it interesting.