本文整理匯總了PHP中rcube_db::quote_identifier方法的典型用法代碼示例。如果您正苦於以下問題:PHP rcube_db::quote_identifier方法的具體用法?PHP rcube_db::quote_identifier怎麽用?PHP rcube_db::quote_identifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rcube_db
的用法示例。
在下文中一共展示了rcube_db::quote_identifier方法的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->quote_identifier($col), $this->db->quote($value));
}
if (!empty($write_sql)) {
$this->db->query("UPDATE " . $this->db->table_name($this->db_name, true) . " 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 ? true : false;
}
示例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->quote_identifier('type');
$insert_values[] = (int) $data['type'];
$insert_cols[] = $this->db->quote_identifier('name');
$insert_values[] = $data['name'];
$insert_cols[] = $this->db->quote_identifier('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');
}