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


PHP resource::quote方法代码示例

本文整理汇总了PHP中resource::quote方法的典型用法代码示例。如果您正苦于以下问题:PHP resource::quote方法的具体用法?PHP resource::quote怎么用?PHP resource::quote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在resource的用法示例。


在下文中一共展示了resource::quote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: stripslashes

 function q_str($value, $addquote = true)
 {
     if (!$this->conn) {
         $this->connect();
     }
     if (is_bool($value)) {
         return $value ? 1 : 0;
     }
     if (is_null($value)) {
         return 'NULL';
     }
     $value = stripslashes($value);
     if ($this->type == "PDO") {
         if ($addquote) {
             return $this->conn->quote($value);
         } else {
             return $value;
         }
     } else {
         if ($this->type == "SQLite3") {
             $value = $this->conn->escapeString($value);
             return $addquote ? "'" . $value . "'" : $value;
         } else {
             $value = sqlite_escape_string($value);
             return $addquote ? "'" . $value . "'" : $value;
         }
     }
 }
开发者ID:jorkin,项目名称:meiupic,代码行数:28,代码来源:sqlite.php

示例2: quoteTrustedValue

 /**
  * Quote Trusted Value
  *
  * The ability to quote values without notices
  *
  * @param $value
  * @return mixed
  */
 public function quoteTrustedValue($value)
 {
     if ($this->resource instanceof \PDO) {
         return $this->resource->quote($value);
     }
     return '\'' . str_replace('\'', '\'\'', $value) . '\'';
 }
开发者ID:totolouis,项目名称:ZF2-Auth,代码行数:15,代码来源:SqlServer.php

示例3: addItems

 /**
  * Add items on the database
  *
  * @param Integer $feed_id ToDo desc
  * @param Array   $items   ToDo desc
  *
  * @return void
  */
 public function addItems($feed_id, $items)
 {
     if (empty($items)) {
         return;
     }
     $items = array_slice($items, 0, intval($this->getConfig('FeedTicker.itemsLimit', 5)));
     $dli = intval($this->getConfig('FeedTicker.dateLimit', 60 * 60 * 24 * 7));
     $dateLimit = time() - $dli;
     $q = $this->db->prepare('INSERT INTO ft_items (
             feed_id, updated, title, link, author, read
         ) VALUES (
             :feed_id, :updated, :title, :link, :author, :read
         )');
     foreach ($items as $i) {
         if (!empty($i['updated']) and $i['updated'] < $dateLimit) {
             continue;
         }
         // Check if this item already exists
         $sql = 'SELECT COUNT(*) FROM ft_items WHERE feed_id = ' . $this->db->quote($feed_id) . ' AND link = ' . $this->db->quote(trim($i['link']));
         $opa = $this->db->query($sql)->fetchColumn();
         if ((bool) $this->db->query($sql)->fetchColumn()) {
             continue;
         }
         $q->execute(array(':feed_id' => $feed_id, ':updated' => trim($i['updated']), ':title' => trim($i['title']), ':link' => trim($i['link']), ':author' => trim($i['author']), ':read' => 0));
     }
 }
开发者ID:phergie,项目名称:phergie,代码行数:34,代码来源:FeedManager.php

示例4: escapeString

 /**
  * {@inheritDoc}
  *
  * @param string $str  string to escape
  * @return string a string which is safe to insert into the db
  */
 function escapeString($str)
 {
     return substr($this->pdo->quote($str), 1, -1);
     /*
         pdo->quote adds quotes around string rather than
         just escape. As existing code then adds an additional
         pair of quotes we need to strip inner quotes
     */
 }
开发者ID:yakar,项目名称:yioop,代码行数:15,代码来源:pdo_manager.php

示例5: quoteTrustedValue

 /**
  * Quote Trusted Value
  *
  * The ability to quote values without notices
  *
  * @param $value
  * @return mixed
  */
 public function quoteTrustedValue($value)
 {
     if (is_resource($this->resource)) {
         return '\'' . pg_escape_string($this->resource, $value) . '\'';
     }
     if ($this->resource instanceof \PDO) {
         return $this->resource->quote($value);
     }
     return '\'' . addcslashes($value, "\n\r\\'\"") . '\'';
 }
开发者ID:totolouis,项目名称:ZF2-Auth,代码行数:18,代码来源:Postgresql.php

示例6: qstr

 /**
  * 转义字符串
  *
  * @param string $value
  * @return mixed
  */
 function qstr($value)
 {
     if (is_bool($value)) {
         return $value ? $this->TRUE_VALUE : $this->FALSE_VALUE;
     }
     if (is_null($value)) {
         return $this->NULL_VALUE;
     }
     return $this->conn->quote($value);
 }
开发者ID:BGCX261,项目名称:zlskytakeorder-svn-to-git,代码行数:16,代码来源:Sqlitepdo.php

示例7: escapeString

 /**
  * Add escape characters for importing data
  *
  * @param string $str String to parse
  * @return string
  */
 public function escapeString($string)
 {
     try {
         $string = $this->connection->quote($string);
         return substr($string, 1, -1);
     } catch (PDOException $e) {
         $this->_loadError($link, $e);
     }
     return false;
 }
开发者ID:mvnp,项目名称:Simple-MVC-Framework,代码行数:16,代码来源:Database.class.php

示例8: quoteTrustedValue

 /**
  * {@inheritDoc}
  */
 public function quoteTrustedValue($value)
 {
     if ($this->resource instanceof DriverInterface) {
         $this->resource = $this->resource->getConnection()->getResource();
     }
     if ($this->resource instanceof \PDO) {
         return $this->resource->quote($value);
     }
     return '\'' . str_replace('\'', '\'\'', $value) . '\'';
 }
开发者ID:zendframework,项目名称:zend-db,代码行数:13,代码来源:SqlServer.php

示例9: quoteTrustedValue

 /**
  * {@inheritDoc}
  */
 public function quoteTrustedValue($value)
 {
     if ($this->resource instanceof DriverInterface) {
         $this->resource = $this->resource->getConnection()->getResource();
     }
     if (is_resource($this->resource)) {
         return '\'' . pg_escape_string($this->resource, $value) . '\'';
     }
     if ($this->resource instanceof \PDO) {
         return $this->resource->quote($value);
     }
     return 'E' . parent::quoteTrustedValue($value);
 }
开发者ID:karnurik,项目名称:zf2-turtorial,代码行数:16,代码来源:Postgresql.php

示例10: escape

 public function escape($string)
 {
     if (get_magic_quotes_runtime()) {
         $string = stripslashes($string);
     }
     if (function_exists($this->db->real_escape_string)) {
         return $this->db->real_escape_string($string);
     } elseif (function_exists($this->db->quote)) {
         return $this->db->quote($string);
     } else {
         return $string;
     }
 }
开发者ID:bartonlp,项目名称:site-class,代码行数:13,代码来源:dbPdo.class.php

示例11: quote

 /**
  * Quote a string for a quote. Note you should generally use a bind!
  *  @param string $val Value to quote
  *  @param string $type Value type
  *  @return string
  */
 public function quote($val, $type = \PDO::PARAM_STR)
 {
     return $this->_db->quote($val, $type);
 }
开发者ID:Lostvincent,项目名称:taoaixin,代码行数:10,代码来源:Database.php

示例12: purgeOldCodesFromDatabase

 /**
  * Deletes old codes from sqlite database
  */
 protected function purgeOldCodesFromDatabase()
 {
     if ($this->use_database && $this->pdo_conn) {
         $now = time();
         $limit = !is_numeric($this->expiry_time) || $this->expiry_time < 1 ? 86400 : $this->expiry_time;
         $query = sprintf("DELETE FROM %s WHERE %s - created > %s", $this->database_table, $this->pdo_conn->quote($now, PDO::PARAM_INT), $this->pdo_conn->quote($limit, PDO::PARAM_INT));
         $result = $this->pdo_conn->query($query);
     }
 }
开发者ID:arunrajthala,项目名称:leapers,代码行数:12,代码来源:securimage.php

示例13: migration_save

/** Save migration status to database
 *
 * @param resource $db DB link
 * @param string $file_name Migration file name
 *
 * @return boolean true on success, false on failure
 */
function migration_save($db, $file_name)
{
    $query = "INSERT INTO migrations (version, apply_time) VALUES(" . $db->quote($file_name, 'text') . "," . $db->quote(time(), 'text') . ")";
    return $db->query($query);
}
开发者ID:cengjing,项目名称:poweradmin,代码行数:12,代码来源:migrations.inc.php

示例14: escape

 /**
  * escape
  * @param string $sql
  * @param resource $connResource
  * @return string
  */
 public function escape($sql, $connResource)
 {
     // quote返回值带最前面和最后面的单引号, 这里去掉, DbHandler中加
     return trim($connResource->quote($sql), "'");
 }
开发者ID:zhangshijle,项目名称:Python3,代码行数:11,代码来源:DbConnectionAdapterPdo.php

示例15: quote

 /**
  * Quotes a string for use in a query.
  *
  * @param string $string string to quote
  *
  * @return string
  * @deprecated since version 2.6.0 - alpha 3. Switch to doctrine connector.
  */
 public function quote($string)
 {
     $this->deprecated();
     return $this->conn->quote($string);
 }
开发者ID:redmexico,项目名称:XoopsCore,代码行数:13,代码来源:mysqldatabase.php


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