Welcome Guest, Not a member yet? Register   Sign In
Extending \CodeIgniter\Database\MySQLi\Builder possible?
#8

First - extending database classes doesn't work, unfortunately. It's gets messy really fast due to the way the classes are found, so you'd have to basically extend ALL of the MySQLi classes and make it a separate driver. Probably not what you're looking for.

More importantly, though, by default the database connection is shared so no matter how times you call db_connect(), or go directly through CodeIgniter\Database\Config::connect(), you'll get the same instance of the database connection. You always have the option of getting a new instance but the default is to share the connection.

Also, you can always get the last query ran, with

Code:
$query = db_connect()->getLastQuery();

That will return a Query object that you can get the query string and check if a where is in it. You can cast that object as a string to get the final query, or call $query->getQuery();
Reply


Messages In This Thread
RE: Extending \CodeIgniter\Database\MySQLi\Builder possible? - by kilishan - 08-11-2019, 08:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB