本文整理汇总了PHP中rcube_db::quoteIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP rcube_db::quoteIdentifier方法的具体用法?PHP rcube_db::quoteIdentifier怎么用?PHP rcube_db::quoteIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rcube_db
的用法示例。
在下文中一共展示了rcube_db::quoteIdentifier方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update a specific contact record
*
* @param mixed Record identifier
* @param array Assoziative array with save data
* @return boolean True on success, False on error
*/
function update($id, $save_cols)
{
$updated = false;
$write_sql = array();
$record = $this->get_record($id, true);
$save_cols = $this->convert_save_data($save_cols, $record);
foreach ($save_cols as $col => $value) {
$write_sql[] = sprintf("%s=%s", $this->db->quoteIdentifier($col), $this->db->quote($value));
}
if (!empty($write_sql)) {
$this->db->query("UPDATE " . $this->db->table_name($this->db_name) . " SET changed=" . $this->db->now() . ", " . join(', ', $write_sql) . " WHERE contact_id=?" . " AND user_id=?" . " AND del<>1", $id, $this->user_id);
$updated = $this->db->affected_rows();
$this->result = null;
// clear current result (from get_record())
}
return $updated;
}
示例2: serialize
/**
* Create a new saved search record linked with this user
*
* @param array $data Hash array with col->value pairs to save
*
* @return int The inserted search ID or false on error
*/
function insert_search($data)
{
if (!$this->ID) {
return false;
}
$insert_cols[] = 'user_id';
$insert_values[] = (int) $this->ID;
$insert_cols[] = $this->db->quoteIdentifier('type');
$insert_values[] = (int) $data['type'];
$insert_cols[] = $this->db->quoteIdentifier('name');
$insert_values[] = $data['name'];
$insert_cols[] = $this->db->quoteIdentifier('data');
$insert_values[] = serialize($data['data']);
$sql = "INSERT INTO " . $this->db->table_name('searches') . " (" . join(', ', $insert_cols) . ")" . " VALUES (" . join(', ', array_pad(array(), sizeof($insert_values), '?')) . ")";
call_user_func_array(array($this->db, 'query'), array_merge(array($sql), $insert_values));
return $this->db->insert_id('searches');
}