Welcome Guest, Not a member yet? Register   Sign In
Database Class Hack
#1

[eluser]Gewa[/eluser]
Hi there. I am building up a multisite application,


and I need following


I need a small hack to the database class so that


On any Update, Delete Query will be added WHERE site_id=$this->config->line('site_id')

On every insert query will be added a column site_id=$this->config->line('site_id') somehow. So that I don't need to edit all the code.
Any ideas where and how I can do this?
#2

[eluser]WanWizard[/eluser]
You can download and install our version of DB.php, and place it in ./system/database.
This will allow you to extend the CI Active Record library.

Then extend the active record library the way you normally extend libraries, and modify the _compile_select(), insert(), update() and delete() methods.

I find this a dangerous thing to do BTW, and I wouldn't recommend you going this route. It can't be to difficult to modify queries in your models, even a large application doesn't have that many...
#3

[eluser]Gewa[/eluser]
You think better to edit application?




Theme © iAndrew 2016 - Forum software by © MyBB