本文整理汇总了PHP中DBManager::countQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::countQuery方法的具体用法?PHP DBManager::countQuery怎么用?PHP DBManager::countQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::countQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $keepResult = false)
{
if (is_array($sql)) {
return $this->queryArray($sql, $dieOnError, $msg, $suppress);
}
parent::countQuery($sql);
$this->log->info('Query: ' . $sql);
$this->checkConnection();
$db = $this->getDatabase();
$result = false;
$stmt = $suppress ? @db2_prepare($db, $sql) : db2_prepare($db, $sql);
if ($stmt) {
$sp_msg = null;
if ($this->bindPreparedSqlParams($sql, $suppress, $stmt, $sp_msg)) {
$this->query_time = microtime(true);
$rc = $suppress ? @db2_execute($stmt) : db2_execute($stmt);
$this->query_time = microtime(true) - $this->query_time;
$this->log->info('Query Execution Time: ' . $this->query_time);
if (!$rc) {
$this->log->error("Query Failed: {$sql}");
$stmt = false;
// Making sure we don't use the statement resource for error reporting
} else {
$result = $stmt;
if (isset($sp_msg) && $sp_msg != '') {
$this->log->info("Return message from stored procedure call '{$sql}': {$sp_msg}");
}
if ($this->dump_slow_queries($sql)) {
$this->track_slow_queries($sql);
}
}
} else {
$this->log->error("Failed to bind parameter for query : {$sql}");
}
}
if ($keepResult) {
$this->lastResult = $result;
}
if ($this->checkError($msg . ' Query Failed: ' . $sql, $dieOnError)) {
return false;
}
$matches = array();
if (preg_match('/^\\W*alter\\W+table\\W+(\\w+)/mi', $sql, $matches)) {
if ($this->tableExists($matches[1])) {
$this->reorgTable($matches[1]);
}
}
return $result;
}
示例2: prepareStatementData
/**
* Fill in data for prepated statement
* @param array $data
* @param string $msg Error message
* @return boolean
*/
protected function prepareStatementData(array $data, $param_count, $msg)
{
if (!$this->stmt) {
$this->DBM->registerError($msg, "No prepared statement to execute");
return false;
}
$this->DBM->countQuery($this->parsedSQL);
$GLOBALS['log']->info("Executing Query: {$this->parsedSQL} with " . var_export($data, true));
$this->DBM->query_time = microtime(true);
if ($param_count > count($data)) {
$this->DBM->registerError($msg, "Incorrect number of elements. Expected {$param_count} but got " . count($data));
return false;
}
if (!empty($data)) {
reset($data);
// bind the variables
for ($i = 0; $i < $param_count; $i++) {
$this->bound_vars[$i] = current($data);
next($data);
}
}
return true;
}
示例3: query
/**
* Parses and runs queries
*
* @param string $sql SQL Statement to execute
* @param bool $dieOnError True if we want to call die if the query returns errors
* @param string $msg Message to log if error occurs
* @param bool $suppress Flag to suppress all error output unless in debug logging mode.
* @param bool $autofree True if we want to push this result into the $lastResult array.
* @return resource result set
*/
public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $autofree = false)
{
parent::countQuery($sql);
$GLOBALS['log']->info('Query:' . $sql);
$this->checkConnection();
//$this->freeResult();
$this->query_time = microtime(true);
$this->lastsql = $sql;
if ($suppress == true) {
} else {
$result = mysql_query($sql, $this->database);
}
$this->lastmysqlrow = -1;
$this->query_time = microtime(true) - $this->query_time;
$GLOBALS['log']->info('Query Execution Time:' . $this->query_time);
$this->checkError($msg . ' Query Failed:' . $sql . '::', $dieOnError);
if ($autofree) {
$this->lastResult[] =& $result;
}
return $result;
}
示例4: query
/**
* Parses and runs queries
*
* @param string $sql SQL Statement to execute
* @param bool $dieOnError True if we want to call die if the query returns errors
* @param string $msg Message to log if error occurs
* @param bool $suppress Flag to suppress all error output unless in debug logging mode.
* @param bool $keepResult True if we want to push this result into the $lastResult array.
* @return resource result set
*/
public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $keepResult = false)
{
if (is_array($sql)) {
return $this->queryArray($sql, $dieOnError, $msg, $suppress);
}
parent::countQuery($sql);
$GLOBALS['log']->info('Query:' . $sql);
$this->checkConnection();
$this->query_time = microtime(true);
$this->lastsql = $sql;
$result = $suppress ? @mysql_query($sql, $this->database) : mysql_query($sql, $this->database);
$this->query_time = microtime(true) - $this->query_time;
$GLOBALS['log']->info('Query Execution Time:' . $this->query_time);
if ($keepResult) {
$this->lastResult = $result;
}
$this->checkError($msg . ' Query Failed:' . $sql . '::', $dieOnError);
return $result;
}
示例5: query
/**
* Parses and runs queries
*
* @param string $sql SQL Statement to execute
* @param bool $dieOnError True if we want to call die if the query returns errors
* @param string $msg Message to log if error occurs
* @param bool $suppress Flag to suppress all error output unless in debug logging mode.
* @param bool $keepResult True if we want to push this result into the $lastResult var.
* @return resource result set
*/
public function query($sql, $dieOnError = false, $msg = '', $suppress = false, $keepResult = false)
{
if (is_array($sql)) {
return $this->queryArray($sql, $dieOnError, $msg, $suppress);
}
parent::countQuery($sql);
$GLOBALS['log']->info('Query: ' . $sql);
$this->checkConnection();
$this->query_time = microtime(true);
$db = $this->getDatabase();
$result = false;
$stmt = $suppress ? @oci_parse($db, $sql) : oci_parse($db, $sql);
if (!$this->checkError("{$msg} Parse Failed: {$sql}", $dieOnError)) {
$exec_result = $suppress ? @oci_execute($stmt) : oci_execute($stmt);
$this->query_time = microtime(true) - $this->query_time;
$GLOBALS['log']->info('Query Execution Time: ' . $this->query_time);
if ($this->dump_slow_queries($sql)) {
$this->track_slow_queries($sql);
}
if ($exec_result) {
$result = $stmt;
}
}
$this->lastQuery = $sql;
if ($keepResult) {
$this->lastResult = $result;
}
if ($this->checkError($msg . ' Query Failed: ' . $sql, $dieOnError, $stmt)) {
return false;
}
return $result;
}