• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extending \CodeIgniter\Database\MySQLi\Builder possible?

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

$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();
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.