当前位置: 首页>>代码示例>>PHP>>正文


PHP DBManager::quote方法代码示例

本文整理汇总了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);
         }
     }
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:34,代码来源:SugarBean.php

示例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;
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:39,代码来源:SugarJobQueue.php

示例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]) . "%'";
             }
         }
     }
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:13,代码来源:DynamicField.php

示例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);
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:19,代码来源:Link.php

示例5: quote

 /**
  * @see DBManager::quote()
  */
 public function quote($string, $isLike = true)
 {
     return mysql_real_escape_string(parent::quote($string), $this->getDatabase());
 }
开发者ID:nerdystudmuffin,项目名称:dashlet-subpanels,代码行数:7,代码来源:MysqlManager.php

示例6: quote

 /**
  * @see DBManager::quote()
  */
 public function quote($string, $isLike = true)
 {
     return mysqli_escape_string($this->getDatabase(), DBManager::quote($string));
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:7,代码来源:MysqliManager.php

示例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))));
 }
开发者ID:svnvcristea,项目名称:pslib,代码行数:9,代码来源:Migration.php

示例8: quote

 /**
  * @see DBManager::quote()
  */
 public function quote($string, $isLike = true)
 {
     return $string = str_replace("'", "''", parent::quote($string));
 }
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:7,代码来源:MssqlManager.php


注:本文中的DBManager::quote方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。