本文整理汇总了PHP中DBManager::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManager::quote方法的具体用法?PHP DBManager::quote怎么用?PHP DBManager::quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager::quote方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
function set_relationship($table, $relate_values, $check_duplicates = true, $do_update = false, $data_values = null)
{
$where = '';
// make sure there is a date modified
$date_modified = $this->db->convert("'" . $GLOBALS['timedate']->nowDb() . "'", 'datetime');
$row = null;
if ($check_duplicates) {
$query = "SELECT * FROM {$table} ";
$where = "WHERE deleted = '0' ";
foreach ($relate_values as $name => $value) {
$where .= " AND {$name} = '{$value}' ";
}
$query .= $where;
$result = $this->db->query($query, false, "Looking For Duplicate Relationship:" . $query);
$row = $this->db->fetchByAssoc($result);
}
if (!$check_duplicates || empty($row)) {
unset($relate_values['id']);
if (isset($data_values)) {
$relate_values = array_merge($relate_values, $data_values);
}
$query = "INSERT INTO {$table} (id, " . implode(',', array_keys($relate_values)) . ", date_modified) VALUES ('" . create_guid() . "', " . "'" . implode("', '", $relate_values) . "', " . $date_modified . ")";
$this->db->query($query, false, "Creating Relationship:" . $query);
} else {
if ($do_update) {
$conds = array();
foreach ($data_values as $key => $value) {
array_push($conds, $key . "='" . $this->db->quote($value) . "'");
}
$query = "UPDATE {$table} SET " . implode(',', $conds) . ",date_modified=" . $date_modified . " " . $where;
$this->db->query($query, false, "Updating Relationship:" . $query);
}
}
}
示例2: nextJob
/**
* Fetch the next job in the queue and mark it running
* @param string $clientID ID of the client requesting the job
* @return SugarJob
*/
public function nextJob($clientID)
{
$now = $this->db->now();
$queued = SchedulersJob::JOB_STATUS_QUEUED;
$try = $this->jobTries;
while ($try--) {
// TODO: tranaction start?
$id = $this->db->getOne("SELECT id FROM {$this->job_queue_table} WHERE execute_time <= {$now} AND status = '{$queued}' ORDER BY date_entered ASC");
if (empty($id)) {
return null;
}
$job = new SchedulersJob();
$job->retrieve($id);
if (empty($job->id)) {
return null;
}
$job->status = SchedulersJob::JOB_STATUS_RUNNING;
$job->client = $clientID;
$client = $this->db->quote($clientID);
// using direct query here to be able to fetch affected count
// if count is 0 this means somebody changed the job status and we have to try again
$res = $this->db->query("UPDATE {$this->job_queue_table} SET status='{$job->status}', date_modified={$now}, client='{$client}' WHERE id='{$job->id}' AND status='{$queued}'");
if ($this->db->getAffectedRowCount($res) == 0) {
// somebody stole our job, try again
continue;
} else {
// to update dates & possible hooks
$job->save();
break;
}
// TODO: commit/check?
}
return $job;
}
示例3: setWhereClauses
/**
* @param $where_clauses
*/
public function setWhereClauses(&$where_clauses)
{
if (isset($this->avail_fields)) {
foreach ($this->avail_fields as $name => $value) {
if (!empty($_REQUEST[$name])) {
$where_clauses[] = $this->bean->table_name . "_cstm.{$name} LIKE '" . $this->db->quote($_REQUEST[$name]) . "%'";
}
}
}
}
示例4: foreach
/**
* @param array $value_array
*/
function _insert_row(&$value_array)
{
//add key column
$value_array['id'] = create_guid();
$columns_list = '';
$values_list = '';
$delimiter = '';
foreach ($value_array as $key => $value) {
$columns_list .= $delimiter . $key;
$values_list .= $delimiter . "'" . $this->_db->quote($value) . "'";
$delimiter = ",";
}
$insert_string = 'INSERT into ' . $this->_relationship->join_table . ' (' . $columns_list . ') VALUES (' . $values_list . ')';
Log::debug("Relationship Insert String :" . $insert_string);
$this->_db->query($insert_string, true);
}
示例5: quote
/**
* @see DBManager::quote()
*/
public function quote($string, $isLike = true)
{
return mysql_real_escape_string(parent::quote($string), $this->getDatabase());
}
示例6: quote
/**
* @see DBManager::quote()
*/
public function quote($string, $isLike = true)
{
return mysqli_escape_string($this->getDatabase(), DBManager::quote($string));
}
示例7: updateDashboardsMetadata
/**
* @param $metadata
* @param $module
* @return bool|resource
*/
public function updateDashboardsMetadata($metadata, $module)
{
return $this->dbManager->query(sprintf("\n UPDATE dashboards SET\n metadata = '%s'\n WHERE\n deleted = 0\n AND name = 'LBL_DEFAULT_DASHBOARD_TITLE'\n AND dashboard_module = '{$module}'\n AND view_name = 'record'\n AND dashboard_type = 'dashboard'\n ", $this->dbManager->quote(json_encode($metadata))));
}
示例8: quote
/**
* @see DBManager::quote()
*/
public function quote($string, $isLike = true)
{
return $string = str_replace("'", "''", parent::quote($string));
}