bgultekin / laravel4-datatables-package

Server-side handler of DataTables Jquery Plugin for Laravel 4
267 stars 108 forks source link

Multiple Database compatibility #166

Open CaptainThunk opened 10 years ago

CaptainThunk commented 10 years ago

Package uses numerous DB::Raw() statements through datatables.php, this causes incompatibility with sites with more than one defined database. They should be DB::Connection($dbkey)->Raw() Where $dbkey is the defined name of the database.

This is sometimes done, as in the count() function, although there's still a DB::Raw statement that needs to be rectified.

nesl247 commented 10 years ago

I'm using multiple databases and raw without issue. Wouldn't raw just be returning a raw query anyways, and thus connection agnostic?

CaptainThunk commented 10 years ago

For me, I have 4 defined mysql databases, as it stands this plugin breaks because places in it where DB:Raw is used it looks for the default database (called 'mysql') which is not defined in my setup. When it's not specified, it falls back to the default.

nesl247 commented 10 years ago

Why not just change the default? Not disagreeing with any changes that need to be done, just offering an option.

CaptainThunk commented 10 years ago

Because it could be one of the four databases used, none of them are 'default'.