Granada\ORM::get_last_query PHP Méthode

get_last_query() public static méthode

Get the last query executed. Only works if the 'logging' config option is set to true. Otherwise this will return null. Returns last query from all connections if no connection_name is specified
public static get_last_query ( null | string $connection_name = null ) : string
$connection_name null | string Which connection to use
Résultat string
    public static function get_last_query($connection_name = null)
    {
        if ($connection_name === null) {
            return self::$_last_query;
        }
        if (!isset(self::$_query_log[$connection_name])) {
            return '';
        }
        return end(self::$_query_log[$connection_name]);
    }

Usage Example

Exemple #1
0
 public function testInstanceIdColumnThree()
 {
     $this->setUpIdColumnOverrides();
     ORM::for_table('widget_nozzle')->use_id_column('new_id')->find_one(5);
     $expected = "SELECT * FROM `widget_nozzle` WHERE `new_id` = '5' LIMIT 1";
     $this->assertEquals($expected, ORM::get_last_query());
     $this->tearDownIdColumnOverrides();
 }
All Usage Examples Of Granada\ORM::get_last_query
ORM