Question

how can I get currently used database name in Kohana 3.2?

I've got app(store) with multiple db's and I need to debug whole app if it's working properly.

Kind regards Mark

Was it helpful?

Solution

When you debug Database::$instances or Database::$instances you'll see all instances and the protected property _current_databases, maybe this helps

Database::$instances;
Database_MySQL::$instances;

If this doesn't work, you chould execute a query directly to the DB with the MySQL command

SELECT DATABASE();

OTHER TIPS

Another solution worked for me:

Kohana::config('database')

just in case, someone is still looking:

Kohana::$config->load('database')->get('default')['connection']['database'];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top