本文整理汇总了PHP中MDB2::query方法的典型用法代码示例。如果您正苦于以下问题:PHP MDB2::query方法的具体用法?PHP MDB2::query怎么用?PHP MDB2::query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDB2
的用法示例。
在下文中一共展示了MDB2::query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isAvailable
/**
* Returns true if this storage mechanism is ready to be used. false otherwise.
*/
public function isAvailable()
{
$qry = 'SHOW TABLES LIKE "config_alt"';
$result = $this->db->query($qry);
if (I2CE::pearError($result, "Cannot access database")) {
return false;
}
if ($result->numRows() == 0) {
I2CE::raiseError("No config_alt");
return false;
}
if (count($this->db_statements) != 5) {
I2CE::raiseError("No prep stmts:" . count($this->db_statements));
return false;
}
return true;
}
示例2: dataArticles
/**
* Return list of articles
*
* @param integer $start
* @param integer $max
* @param string $order_field
* @param string $order_dir
* @param string $filter
*/
private function dataArticles($start = 0, $max = 10, $order_field = "date", $order_dir = "desc", $filter = '')
{
$order_by = " ORDER BY";
if ($filter != '') {
$filter = ' WHERE ' . $filter;
}
switch ($order_field) {
case 'id':
$order_by = $order_by . " Article_ID";
break;
case 'url':
$order_by = $order_by . " Article_URL_Name";
break;
case 'date':
default:
$order_by = $order_by . " Article_Date";
break;
}
switch ($order_dir) {
case 'asc':
$order_by = $order_by . " ASC";
break;
case 'desc':
default:
$order_by = $order_by . " DESC";
break;
}
if ($max != 0) {
$limit = "LIMIT {$start}, {$max}";
} else {
$limit = "";
}
$querySearch = "SELECT `article_id` FROM articles {$filter} {$order_by} {$limit}";
$querySearchResults = $this->_db->query($querySearch);
$data = $querySearchResults->fetchAll(MDB2_FETCHMODE_ASSOC);
$querySearchResults->free();
return $data;
}
示例3: query
public function query($sql)
{
$startTime = microtime(true);
$ret = parent::query($sql);
$costTime = sprintf('%01.4f', microtime(true) - $startTime);
if ($costTime > 1) {
$this->_log("SLOW QUERY:\t{$sql}");
}
return $ret;
}
示例4: qImageId
/**
* Return array of list of images ids
*
* @param integer $start
* @param integer $max
* @param array $filters
* @param string $order
* @param boolean $all
*
* @return array
*/
private function qImageId($start, $max, $filters, $order, $all = false)
{
$data = array();
$where = $this->filterSQL($filters);
if ($all) {
$querySearch = "SELECT im.`Image_ID` FROM `photo_images` im " . $where . " ORDER BY im.`Image_ID` {$order}";
} else {
$querySearch = "SELECT im.`Image_ID` FROM `photo_images` im " . $where . " ORDER BY im.`Image_ID` {$order} LIMIT {$start}, {$max}";
}
$querySearchResults = $this->_db->query($querySearch);
$data = $querySearchResults->fetchAll();
$querySearchResults->free();
return $data;
}