本文整理汇总了PHP中DBAdapter::lastQueryType方法的典型用法代码示例。如果您正苦于以下问题:PHP DBAdapter::lastQueryType方法的具体用法?PHP DBAdapter::lastQueryType怎么用?PHP DBAdapter::lastQueryType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBAdapter
的用法示例。
在下文中一共展示了DBAdapter::lastQueryType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queryCount
public static function queryCount($query)
{
$count = 0;
$query = trim($query);
if ($result = self::query($query)) {
$operation = strtolower(substr($query, 0, 6));
self::$lastQueryType = $operation;
switch ($operation) {
case 'select':
$count = cubrid_num_rows($result);
cubrid_close_request($result);
break;
case 'insert':
case 'update':
case 'delete':
case 'replac':
default:
$count = cubrid_affected_rows($result);
break;
}
}
return $count;
}
示例2: query
public static function query($query)
{
if (function_exists('__tcSqlLogBegin')) {
__tcSqlLogBegin($query);
$result = self::$db->query($query);
__tcSqlLogEnd($result, 0);
} else {
$result = self::$db->query($query);
}
self::$lastQueryType = strtolower(substr($query, 0, 6));
if (stristr($query, 'update ') || stristr($query, 'insert ') || stristr($query, 'delete ') || stristr($query, 'replace ')) {
self::clearCache();
}
return $result;
}
示例3: query
public static function query($query, $compatibility = true)
{
// var_dump($query);
if ($compatibility) {
$query = str_replace('UNIX_TIMESTAMP()', Timestamp::getUNIXtime(), $query);
// compatibility issue.
$query = str_replace('RAND()', 'RANDOM()', $query);
// compatibility issue.
$origPagingInst = array('/CHAR_LENGTH(.*) /si', '/IF\\(([A-Za-z0-9]+),([A-Za-z0-9]+),([A-Za-z0-9]+)\\)/si');
$descPagingInst = array('LENGTH($1) ', 'CASE WHEN $1 THEN $2 ELSE $3 END');
$query = preg_replace($origPagingInst, $descPagingInst, $query);
}
if (function_exists('__tcSqlLogBegin')) {
__tcSqlLogBegin($query);
$result = self::$db->query($query);
__tcSqlLogEnd($result, 0);
} else {
$result = self::$db->query($query);
}
self::$lastQueryType = strtolower(substr($query, 0, 6));
if (stristr($query, 'update ') || stristr($query, 'insert ') || stristr($query, 'delete ') || stristr($query, 'replace ')) {
self::clearCache();
}
return $result;
}