ORM::get_last_query PHP 메소드

get_last_query() 공개 정적인 메소드

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
리턴 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

예제 #1
0
 public function find($tag, $key = "tags")
 {
     // search pages table with pages that has a certain tag
     $r = \ORM::for_table('cms_page')->distinct()->select('cms_page.*')->join('cms_page_meta', array('cms_page.id', '=', 'cms_page_meta.page_id'))->join('cms_page_meta_translation', array('cms_page_meta.id', '=', 'cms_page_meta_translation.meta_id'))->where_equal('cms_page_meta.key', $key)->where_raw("FIND_IN_SET({$tag}, cms_page_meta_translation.value)")->find_many();
     print_r($r);
     print_r(\ORM::get_last_query());
 }
All Usage Examples Of ORM::get_last_query
ORM