本文整理汇总了PHP中XDB::field方法的典型用法代码示例。如果您正苦于以下问题:PHP XDB::field方法的具体用法?PHP XDB::field怎么用?PHP XDB::field使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XDB
的用法示例。
在下文中一共展示了XDB::field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_by_threadtableid
public function update_by_threadtableid($threadtableid, $data, $unbuffered = false, $low_priority = false)
{
if (empty($data)) {
return false;
}
return XDB::update($this->_table, $data, XDB::field('threadtableid', $threadtableid), $unbuffered, $low_priority);
}
示例2: fetch_all_by_name
public function fetch_all_by_name($name)
{
if (!empty($name)) {
return XDB::fetch_all('SELECT * FROM %t WHERE ' . XDB::field('name', $name), array($this->_table));
}
return array();
}
示例3: delete_by_variable
public function delete_by_variable($pluginid, $variable)
{
if (!$pluginid || !$variable) {
return;
}
XDB::delete($this->_table, XDB::field('pluginid', $pluginid) . ' AND ' . XDB::field('variable', $variable));
}
示例4: delete_by_tid
public function delete_by_tid($tids)
{
$tids = dintval($tids, true);
if ($tids) {
return XDB::delete($this->_table, XDB::field('tid', $tids));
}
return 0;
}
示例5: check_moderator_for_uid
public function check_moderator_for_uid($fid, $uid, $accessmasks = 0)
{
if (!intval($fid) || !intval($uid)) {
return false;
}
if ($accessmasks) {
$accessadd1 = ', a.allowview, a.allowpost, a.allowreply, a.allowgetattach, a.allowgetimage, a.allowpostattach';
$accessadd2 = "LEFT JOIN " . XDB::table('forum_access') . " a ON a." . XDB::field('uid', $uid) . " AND a." . XDB::field('fid', $fid);
}
return XDB::fetch_first("SELECT ff.postperm, m.uid AS istargetmod {$accessadd1}\n\t\t\t\tFROM " . XDB::table($this->_table) . " ff\n\t\t\t\t{$accessadd2}\n\t\t\t\tLEFT JOIN " . XDB::table('forum_moderator') . " m ON m.fid=%d AND m.uid=%d\n\t\t\t\tWHERE ff.fid=%d", array($fid, $uid, $fid));
}
示例6: clear
public function clear()
{
require_once libfile('function/forum');
$delaids = array();
$query = XDB::query("SELECT aid, attachment, thumb FROM %t WHERE %i", array($this->_table, XDB::field('dateline', TIMESTAMP - 86400)));
while ($attach = XDB::fetch($query)) {
dunlink($attach);
$delaids[] = $attach['aid'];
}
if ($delaids) {
XDB::query("DELETE FROM %t WHERE %i", array('forum_attachment', XDB::field('aid', $delaids)), false, true);
XDB::query("DELETE FROM %t WHERE %i", array($this->_table, XDB::field('dateline', TIMESTAMP - 86400)), false, true);
}
}
示例7: srdelete
public function srdelete($val, $condition = '', $unbuffered = false)
{
$ret = false;
if (isset($val)) {
$this->checkpk();
$where = '';
if (empty($condition)) {
$where = XDB::field($this->_pk, $val);
} elseif (is_array($condition)) {
$where = XDB::field($this->_pk, $val) . ' AND ' . self::implode($condition, ' AND ');
} else {
$where = XDB::field($this->_pk, $val) . ' AND ' . $condition;
}
$ret = XDB::delete($this->_table, $where, null, $unbuffered);
$this->clear_cache($val);
}
return $ret;
}
示例8: update_by_bid
public function update_by_bid($bid, $data)
{
return XDB::update($this->_table, $data, XDB::field('bid', $bid));
}
示例9: update_by_groupid
public function update_by_groupid($groupid, $data)
{
return XDB::update($this->_table, $data, XDB::field('groupid', $groupid));
}
示例10: fetch_first_by_name
public function fetch_first_by_name($name, $upid)
{
return XDB::fetch_first("SELECT * FROM %t WHERE " . XDB::field('name', $name) . " and upid=%d", array($this->_table, $upid));
}
示例11: fetch_all_prune_by_search
public function fetch_all_prune_by_search($tableid, $isgroup = null, $keywords = null, $message_length = null, $fid = null, $authorid = null, $starttime = null, $endtime = null, $useip = null, $outmsg = true, $start = null, $limit = null)
{
$sql = '';
$sql .= $fid ? ' AND p.' . XDB::field('fid', $fid) : '';
$sql .= $isgroup ? ' AND t.' . XDB::field('isgroup', $isgroup) : '';
$sql .= $authorid !== null ? ' AND p.' . XDB::field('authorid', $authorid) : '';
$sql .= $starttime ? ' AND p.' . XDB::field('dateline', $starttime, '>=') : '';
$sql .= $endtime ? ' AND p.' . XDB::field('dateline', $endtime, '<') : '';
$sql .= $useip ? ' AND p.' . XDB::field('useip', $useip, 'like') : '';
$sql .= $message_length !== null ? ' AND LENGTH(p.message) < ' . intval($message_length) : '';
$postlist = array();
if (trim($keywords)) {
$sqlkeywords = '';
$or = '';
$keywords = explode(',', str_replace(' ', '', $keywords));
for ($i = 0; $i < count($keywords); $i++) {
if (preg_match("/\\{(\\d+)\\}/", $keywords[$i])) {
$keywords[$i] = preg_replace("/\\\\{(\\d+)\\\\}/", ".{0,\\1}", preg_quote($keywords[$i], '/'));
$sqlkeywords .= " {$or} p.subject REGEXP '" . $keywords[$i] . "' OR p.message REGEXP '" . $keywords[$i] . "'";
} else {
$keywords[$i] = addslashes($keywords[$i]);
$sqlkeywords .= " {$or} p.subject LIKE '%" . $keywords[$i] . "%' OR p.message LIKE '%" . $keywords[$i] . "%'";
}
$or = 'OR';
}
$sql .= " AND ({$sqlkeywords})";
}
if ($sql) {
if ($isgroup) {
$query = XDB::query('SELECT p.*, t.*
FROM %t p LEFT JOIN %t t USING(tid)
WHERE 1 %i %i', array(self::get_tablename($tableid), 'forum_thread', $sql, XDB::limit($start, $limit)));
} else {
$query = XDB::query('SELECT *
FROM %t p
WHERE 1 %i %i', array(self::get_tablename($tableid), $sql, XDB::limit($start, $limit)));
}
while ($post = XDB::fetch($query)) {
if (!$outmsg) {
unset($post['message']);
}
$postlist[$post[$this->_pk]] = $post;
}
}
return $postlist;
}
示例12: fixalbum
function fixalbum($bid, $data)
{
if (!is_array($data) || empty($data)) {
return null;
}
$condition = array();
$bid = dintval($bid, true);
$condition[] = XDB::field('bid', $bid);
return XDB::update($this->_table, $data, implode(' AND ', $condition));
}
示例13: fetch_all
public function fetch_all($ids, $force_from_db = false)
{
$data = array();
if (!empty($ids)) {
if ($force_from_db || ($data = $this->fetch_cache($ids)) === false || count($ids) != count($data)) {
if (is_array($data) && !empty($data)) {
$ids = array_diff($ids, array_keys($data));
}
if ($data === false) {
$data = array();
}
if (!empty($ids)) {
$query = XDB::query('SELECT * FROM ' . XDB::table($this->_table) . ' WHERE ' . XDB::field($this->_pk, $ids));
while ($value = XDB::fetch($query)) {
$data[$value[$this->_pk]] = $value;
$this->store_cache($value[$this->_pk], $value);
}
}
}
}
return $data;
}
示例14: delete_by_module
public function delete_by_module($module)
{
XDB::delete($this->_table, XDB::field('module', $module));
}
示例15: delete_by_tid
public function delete_by_tid($tids)
{
return !empty($tids) ? XDB::delete($this->_table, XDB::field('tid', $tids)) : false;
}