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


PHP PDO::sqliteCreateCollation方法代码示例

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


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

示例1: open

 /**
  * {@inheritdoc}
  */
 public static function open(array &$connection_options = array())
 {
     // Allow PDO options to be overridden.
     $connection_options += array('pdo' => array());
     $connection_options['pdo'] += array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_STRINGIFY_FETCHES => TRUE);
     $pdo = new \PDO('sqlite:' . $connection_options['database'], '', '', $connection_options['pdo']);
     // Create functions needed by SQLite.
     $pdo->sqliteCreateFunction('if', array(__CLASS__, 'sqlFunctionIf'));
     $pdo->sqliteCreateFunction('greatest', array(__CLASS__, 'sqlFunctionGreatest'));
     $pdo->sqliteCreateFunction('pow', 'pow', 2);
     $pdo->sqliteCreateFunction('exp', 'exp', 1);
     $pdo->sqliteCreateFunction('length', 'strlen', 1);
     $pdo->sqliteCreateFunction('md5', 'md5', 1);
     $pdo->sqliteCreateFunction('concat', array(__CLASS__, 'sqlFunctionConcat'));
     $pdo->sqliteCreateFunction('concat_ws', array(__CLASS__, 'sqlFunctionConcatWs'));
     $pdo->sqliteCreateFunction('substring', array(__CLASS__, 'sqlFunctionSubstring'), 3);
     $pdo->sqliteCreateFunction('substring_index', array(__CLASS__, 'sqlFunctionSubstringIndex'), 3);
     $pdo->sqliteCreateFunction('rand', array(__CLASS__, 'sqlFunctionRand'));
     $pdo->sqliteCreateFunction('regexp', array(__CLASS__, 'sqlFunctionRegexp'));
     // SQLite does not support the LIKE BINARY operator, so we overload the
     // non-standard GLOB operator for case-sensitive matching. Another option
     // would have been to override another non-standard operator, MATCH, but
     // that does not support the NOT keyword prefix.
     $pdo->sqliteCreateFunction('glob', array(__CLASS__, 'sqlFunctionLikeBinary'));
     // Create a user-space case-insensitive collation with UTF-8 support.
     $pdo->sqliteCreateCollation('NOCASE_UTF8', array('Drupal\\Component\\Utility\\Unicode', 'strcasecmp'));
     // Execute sqlite init_commands.
     if (isset($connection_options['init_commands'])) {
         $pdo->exec(implode('; ', $connection_options['init_commands']));
     }
     return $pdo;
 }
开发者ID:papillon-cendre,项目名称:d8,代码行数:35,代码来源:Connection.php

示例2: open

 /**
  * {@inheritdoc}
  */
 public static function open(array &$connection_options = array())
 {
     // Allow PDO options to be overridden.
     $connection_options += array('pdo' => array());
     $connection_options['pdo'] += array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_STRINGIFY_FETCHES => TRUE);
     $pdo = new \PDO('sqlite:' . $connection_options['database'], '', '', $connection_options['pdo']);
     // Create functions needed by SQLite.
     $pdo->sqliteCreateFunction('if', array(__CLASS__, 'sqlFunctionIf'));
     $pdo->sqliteCreateFunction('greatest', array(__CLASS__, 'sqlFunctionGreatest'));
     $pdo->sqliteCreateFunction('pow', 'pow', 2);
     $pdo->sqliteCreateFunction('exp', 'exp', 1);
     $pdo->sqliteCreateFunction('length', 'strlen', 1);
     $pdo->sqliteCreateFunction('md5', 'md5', 1);
     $pdo->sqliteCreateFunction('concat', array(__CLASS__, 'sqlFunctionConcat'));
     $pdo->sqliteCreateFunction('concat_ws', array(__CLASS__, 'sqlFunctionConcatWs'));
     $pdo->sqliteCreateFunction('substring', array(__CLASS__, 'sqlFunctionSubstring'), 3);
     $pdo->sqliteCreateFunction('substring_index', array(__CLASS__, 'sqlFunctionSubstringIndex'), 3);
     $pdo->sqliteCreateFunction('rand', array(__CLASS__, 'sqlFunctionRand'));
     $pdo->sqliteCreateFunction('regexp', array(__CLASS__, 'sqlFunctionRegexp'));
     // Create a user-space case-insensitive collation with UTF-8 support.
     $pdo->sqliteCreateCollation('NOCASE_UTF8', array('Drupal\\Component\\Utility\\Unicode', 'strcasecmp'));
     // Execute sqlite init_commands.
     if (isset($connection_options['init_commands'])) {
         $pdo->exec(implode('; ', $connection_options['init_commands']));
     }
     return $pdo;
 }
开发者ID:brstde,项目名称:gap1,代码行数:30,代码来源:Connection.php


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