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


PHP Horde_Db_Adapter::quoteString方法代码示例

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


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

示例1: ensureTypes

 /**
  * Ensure that an array of types exist in storage. Create any that don't,
  * return type_ids for all.
  *
  * @param mixed $types  An array of types or single type value. Values typed
  *                      as an integer are assumed to already be an type_id.
  *
  * @return array  An array of type_ids.
  * @throws Content_Exception
  */
 public function ensureTypes($types)
 {
     if (!is_array($types)) {
         $types = array($types);
     }
     $typeIds = array();
     $typeName = array();
     // Anything already typed as an integer is assumed to be a type id.
     foreach ($types as $typeIndex => $type) {
         if (is_int($type)) {
             $typeIds[$typeIndex] = $type;
         } else {
             $typeName[$type] = $typeIndex;
         }
     }
     try {
         // Get the ids for any types that already exist.
         if (count($typeName)) {
             $rows = $this->_db->selectAssoc('SELECT type_id, type_name FROM ' . $this->_t('types') . ' WHERE type_name IN (' . implode(',', array_map(array($this->_db, 'quoteString'), array_keys($typeName))) . ')');
             foreach ($rows as $id => $type) {
                 $typeIndex = $typeName[$type];
                 unset($typeName[$type]);
                 $typeIds[$typeIndex] = (int) $id;
             }
         }
         // Create any types that didn't already exist
         foreach ($typeName as $type => $typeIndex) {
             $typeIds[$typeIndex] = intval($this->_db->insert('INSERT INTO ' . $this->_t('types') . ' (type_name) VALUES (' . $this->_db->quoteString($type) . ')'));
         }
     } catch (Horde_Db_Exception $e) {
         throw new Content_Exception($e);
     }
     return $typeIds;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:44,代码来源:Manager.php

示例2: ensureObjects

 /**
  * Ensure that an array of objects exist in storage. Create any that don't,
  * return object_ids for all. All objects in the $objects array must be
  * of the same content type.
  *
  * @param mixed $objects  An array of objects (or single obejct value).
  *                        Values typed as an integer are assumed to already
  *                        be an object_id.
  * @param mixed $type     Either a string type_name or integer type_id
  *
  * @return array  An array of object_ids.
  */
 public function ensureObjects($objects, $type)
 {
     if (!is_array($objects)) {
         $objects = array($objects);
     }
     $objectIds = array();
     $objectName = array();
     $type = current($this->_typeManager->ensureTypes($type));
     // Anything already typed as an integer is assumed to be an object id.
     foreach ($objects as $objectIndex => $object) {
         if (is_int($object)) {
             $objectIds[$objectIndex] = $object;
         } else {
             $objectName[$object] = $objectIndex;
         }
     }
     // Get the ids for any objects that already exist.
     try {
         if (count($objectName)) {
             $rows = $this->_db->selectAll('SELECT object_id, object_name FROM ' . $this->_t('objects') . ' WHERE object_name IN (' . implode(',', array_map(array($this->_db, 'quoteString'), array_keys($objectName))) . ') AND type_id = ' . $type);
             foreach ($rows as $row) {
                 $objectIndex = $objectName[$row['object_name']];
                 unset($objectName[$row['object_name']]);
                 $objectIds[$objectIndex] = $row['object_id'];
             }
         }
         // Create any objects that didn't already exist
         foreach ($objectName as $object => $objectIndex) {
             $objectIds[$objectIndex] = $this->_db->insert('INSERT INTO ' . $this->_t('objects') . ' (object_name, type_id) VALUES (' . $this->_db->quoteString($object) . ', ' . $type . ')');
         }
     } catch (Horde_Db_Exception $e) {
         throw new Content_Exception($e);
     }
     return $objectIds;
 }
开发者ID:Gomez,项目名称:horde,代码行数:47,代码来源:Manager.php

示例3: searchLocations

 /**
  * Search for a textual location string from the passed in search token.
  * Used for location autocompletion.
  *
  * @param string $search  Search fragment for autocompleting location strings
  *
  * @return array  The results
  * @throws Ansel_Exception
  */
 public function searchLocations($search = '')
 {
     $sql = 'SELECT DISTINCT image_location, image_latitude, image_longitude FROM ansel_images WHERE LENGTH(image_location) > 0';
     if (strlen($search)) {
         $sql .= ' AND image_location LIKE ' . $this->_db->quoteString("{$search}%");
     }
     try {
         return $this->_db->selectAll($sql);
     } catch (Horde_Db_Exception $e) {
         throw new Ansel_Exception($e);
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:21,代码来源:Storage.php

示例4: quote

 /**
  * @param Horde_Db_Adapter $db
  */
 public function quote(Horde_Db_Adapter $db)
 {
     return $db->quoteString($this->value);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:7,代码来源:Text.php

示例5: toDriver

 public function toDriver($value)
 {
     return $this->_db->quoteString(Horde_String::convertCharset($value, 'UTF-8', $this->_db->getOption('charset')));
 }
开发者ID:horde,项目名称:horde,代码行数:4,代码来源:Tagger.php

示例6: quoteString

 /**
  * Quotes a string, escaping any special characters.
  *
  * @param   string  $string
  * @return  string
  */
 public function quoteString($string)
 {
     return $this->_read->quoteString($string);
 }
开发者ID:horde,项目名称:horde,代码行数:10,代码来源:SplitRead.php


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