本文整理汇总了PHP中DBC::query方法的典型用法代码示例。如果您正苦于以下问题:PHP DBC::query方法的具体用法?PHP DBC::query怎么用?PHP DBC::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBC
的用法示例。
在下文中一共展示了DBC::query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sanitizeShowData
public static function sanitizeShowData($d)
{
if ($d['syn_need_mission'] == 0) {
$d['m_subject'] = '無';
}
if (in_array($d['d_type'], array(5, 6))) {
$d['d_name'] .= '*' . $d['syn_num'];
}
$tmplist = explode(',', $d['syn_element']);
$itemlist = $listmap = [];
$listmap = [];
$result = array();
foreach ($tmplist as $v) {
$v = explode('*', $v);
$itemlist[] = $v[0];
$listmap[$v[0]] = $v[1];
}
$query = DBC::query('
SELECT d_id, d_name
FROM wog_df
WHERE d_id IN (' . implode(',', $itemlist) . ')
');
while ($item = $query->fetchAssoc()) {
$result[] = $item['d_name'] . '*' . $listmap[$item['d_id']];
}
$d['syn_name'] = implode(', ', $result);
unset($d['d_type']);
return $d;
}
示例2: getMasteryName
public final function getMasteryName()
{
//抓取職業列表
$query = DBC::query('SHOW COLUMNS FROM wog_ch_exp');
$list = array();
while ($d = $query->fetchAssoc()) {
if (preg_match('/[\\w]+_([\\d]+)/i', $d['Field'], $match)) {
$list[] = $match[1];
}
}
$result = array();
$query = DBC::query('SELECT ch_id, ch_name FROM wog_character WHERE ch_id IN (' . implode(',', array_unique($list)) . ')');
while ($d = $query->fetchAssoc()) {
$result[$d['ch_id']] = $d['ch_name'];
}
return $result;
}
示例3: getJQGridGridData
public function getJQGridGridData($filters, $options = array())
{
if (isset($options['idName'])) {
$pk = $options['idName'];
} else {
$pk = DBC::getPrimaryKey($this->table);
if (count($pk) == 1) {
$pk = $pk[0];
}
}
$params = self::getJQGridPagerParams($this->getTotal($filters));
$result = array('columns' => array(), 'page' => $params['page'], 'rows' => array(), 'total' => $params['pages'], 'records' => $params['total']);
//提供兩種覆蓋SQL的方式: 覆蓋整個SQL或覆蓋部分條件
$options = array_merge(array('SQL_SELECT' => property_exists(get_class($this), 'fields') ? implode(',', $this->fields) : '*', 'SQL_FROM' => $this->table, 'SQL_WHERE' => $filters, 'SQL_ORDERBY' => $params['sidx'] . ' ' . $params['sord'], 'SQL_LIMIT' => $params['start'] . ', ' . $params['limit']), $options);
//若其中的參數為陣列,則視為call_user_func_array的參數
if (is_array($options['SQL_ORDERBY'])) {
$options['SQL_ORDERBY'] = call_user_func_array($options['SQL_ORDERBY'], array($params['sidx'], $params['sord']));
}
$sql = isset($options['SQL']) ? $options['SQL'] : '
SELECT ' . $options['SQL_SELECT'] . '
FROM ' . $options['SQL_FROM'] . '
WHERE ' . $options['SQL_WHERE'] . '
ORDER BY ' . $options['SQL_ORDERBY'] . '
LIMIT ' . $options['SQL_LIMIT'] . '
';
$query = DBC::query($sql);
$func = array('self', 'buildID');
while ($d = $query->fetchAssoc()) {
if (isset($options['sanitize']) && is_array($options['sanitize'])) {
$d = call_user_func_array($options['sanitize'], array($d));
}
//var_export(array($pk, $d, $this->separator));
if (!$result['columns']) {
$result['columns'] = array_keys($d);
}
$result['rows'][] = array_values($d);
// $result['rows'][] = array(
// 'id' => is_array($pk) ? call_user_func_array($func, array($pk, $d, $this->separator)) : $d[$pk],
// 'cell' => array_values($d)
// );
}
return $result;
}
示例4: update
public function update($data = null)
{
if (is_null($data) || !is_array($data)) {
$data = $this->dumpChanged();
} else {
$param = self::getParams(get_called_class());
$this->updateData($data, $param);
$data = $this->dumpChanged();
}
// $filter = array();
// foreach($data as $k=>$v) {
// if(!isset($param[$k])) {
// alert("未知的欄位資訊:".$key);
// }
// $filter[$k] = $param[$k];
// }
// $changed = filter_var_array($changed, $filter);
// if(in_array(null, $changed, true)) {
// $key = array_search(null, $changed, true);
// alert("缺乏欄位資訊:".$key);
// }
$this->validate($data, true);
$this->sanitize($data);
DBC::query(DBC::wrapUpdateSQL($this->tablename, $data, $this->pk));
}