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


PHP Connection::escapeTable方法代码示例

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


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

示例1: getMultiple

 /**
  * Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple().
  */
 public function getMultiple(&$cids, $allow_invalid = FALSE)
 {
     $cid_mapping = array();
     foreach ($cids as $cid) {
         $cid_mapping[$this->normalizeCid($cid)] = $cid;
     }
     // When serving cached pages, the overhead of using ::select() was found
     // to add around 30% overhead to the request. Since $this->bin is a
     // variable, this means the call to ::query() here uses a concatenated
     // string. This is highly discouraged under any other circumstances, and
     // is used here only due to the performance overhead we would incur
     // otherwise. When serving an uncached page, the overhead of using
     // ::select() is a much smaller proportion of the request.
     $result = array();
     try {
         $result = $this->connection->query('SELECT cid, data, created, expire, serialized, tags, checksum_invalidations, checksum_deletions FROM {' . $this->connection->escapeTable($this->bin) . '} WHERE cid IN (:cids)', array(':cids' => array_keys($cid_mapping)));
     } catch (\Exception $e) {
         // Nothing to do.
     }
     $cache = array();
     foreach ($result as $item) {
         // Map the cache ID back to the original.
         $item->cid = $cid_mapping[$item->cid];
         $item = $this->prepareItem($item, $allow_invalid);
         if ($item) {
             $cache[$item->cid] = $item;
         }
     }
     $cids = array_diff($cids, array_keys($cache));
     return $cache;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:34,代码来源:DatabaseBackend.php

示例2: getAllCollectionNames

 /**
  * {@inheritdoc}
  */
 public function getAllCollectionNames()
 {
     try {
         return $this->connection->query('SELECT DISTINCT collection FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection <> :collection ORDER by collection', array(':collection' => StorageInterface::DEFAULT_COLLECTION))->fetchCol();
     } catch (\Exception $e) {
         return array();
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:11,代码来源:DatabaseStorage.php

示例3: getAll

 /**
  * Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getAll().
  */
 public function getAll()
 {
     $result = $this->connection->query('SELECT name, value FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection = :collection', array(':collection' => $this->collection));
     $values = array();
     foreach ($result as $item) {
         if ($item) {
             $values[$item->name] = $this->serializer->decode($item->value);
         }
     }
     return $values;
 }
开发者ID:EarthTeam,项目名称:earthteam.net,代码行数:14,代码来源:DatabaseStorage.php

示例4: getRoutesByPath

 /**
  * Get all routes which match a certain pattern.
  *
  * @param string $path
  *   The route pattern to search for (contains % as placeholders).
  *
  * @return \Symfony\Component\Routing\RouteCollection
  *   Returns a route collection of matching routes.
  */
 protected function getRoutesByPath($path)
 {
     // Filter out each empty value, though allow '0' and 0, which would be
     // filtered out by empty().
     $parts = array_values(array_filter(explode('/', $path), function ($value) {
         return $value !== NULL && $value !== '';
     }));
     $collection = new RouteCollection();
     $ancestors = $this->getCandidateOutlines($parts);
     if (empty($ancestors)) {
         return $collection;
     }
     $routes = $this->connection->query("SELECT name, route FROM {" . $this->connection->escapeTable($this->tableName) . "} WHERE pattern_outline IN (:patterns) ORDER BY fit DESC, name ASC", array(':patterns' => $ancestors))->fetchAllKeyed();
     foreach ($routes as $name => $route) {
         $route = unserialize($route);
         if (preg_match($route->compile()->getRegex(), $path, $matches)) {
             $collection->add($name, $route);
         }
     }
     return $collection;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:30,代码来源:RouteProvider.php

示例5: getRoutesCount

 /**
  * {@inheritdoc}
  */
 public function getRoutesCount()
 {
     return $this->connection->query("SELECT COUNT(*) FROM {" . $this->connection->escapeTable($this->tableName) . "}")->fetchField();
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:7,代码来源:RouteProvider.php

示例6: escapeTable

 /**
  * {@inheritdoc}
  */
 public function escapeTable($table)
 {
     $escaped = parent::escapeTable($table);
     // Quote identifier to make it case-sensitive.
     if (preg_match('/[A-Z]/', $escaped)) {
         $escaped = '"' . $escaped . '"';
     }
     return $escaped;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:12,代码来源:Connection.php

示例7: escapeTable

 /**
  * {@inheritdoc}
  */
 public function escapeTable($table)
 {
     $escaped = parent::escapeTable($table);
     // Quote identifier to make it case-sensitive.
     if (preg_match('/[A-Z]/', $escaped)) {
         $escaped = '"' . $escaped . '"';
     } elseif (in_array(strtolower($escaped), $this->postgresqlReservedKeyWords)) {
         // Quote the table name for PostgreSQL reserved key words.
         $escaped = '"' . $escaped . '"';
     }
     return $escaped;
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:15,代码来源:Connection.php

示例8: __construct

 /**
  * Constructs a Subscription object.
  *
  * @param \Drupal\Core\Database\Connection $connection
  *   The database connection object.
  * @param string $table
  *   The database table to perform queries on.
  */
 public function __construct(Connection $connection, $table)
 {
     $this->connection = $connection;
     $this->table = $table;
     $this->tableEscaped = $connection->escapeTable($this->table);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:14,代码来源:Subscription.php

示例9: escapeTable

 /**
  * {@inheritdoc}
  */
 public function escapeTable($table)
 {
     $escaped = parent::escapeTable($table);
     // Ensure that each part (database, schema and table) of the table name is
     // properly and independently escaped.
     $parts = explode('.', $escaped);
     $parts = array_map([$this, 'doEscape'], $parts);
     $escaped = implode('.', $parts);
     return $escaped;
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:13,代码来源:Connection.php


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