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


PHP Criteria::isIgnoreCase方法代码示例

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


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

示例1: createSelectSql

 /**
  * Method to create an SQL query based on values in a Criteria.
  *
  * This method creates only prepared statement SQL (using ? where values
  * will go).  The second parameter ($params) stores the values that need
  * to be set before the statement is executed.  The reason we do it this way
  * is to let the PDO layer handle all escaping & value formatting.
  *
  * @param      Criteria $criteria Criteria for the SELECT query.
  * @param      array &$params Parameters that are to be replaced in prepared statement.
  * @return     string
  * @throws     PropelException Trouble creating the query string.
  */
 public static function createSelectSql(Criteria $criteria, &$params)
 {
     $db = Propel::getDB($criteria->getDbName());
     $dbMap = Propel::getDatabaseMap($criteria->getDbName());
     $fromClause = array();
     $joinClause = array();
     $joinTables = array();
     $whereClause = array();
     $orderByClause = array();
     $orderBy = $criteria->getOrderByColumns();
     $groupBy = $criteria->getGroupByColumns();
     $ignoreCase = $criteria->isIgnoreCase();
     // get the first part of the SQL statement, the SELECT part
     $selectSql = self::createSelectSqlPart($criteria, $fromClause);
     // add the criteria to WHERE clause
     // this will also add the table names to the FROM clause if they are not already
     // included via a LEFT JOIN
     foreach ($criteria->keys() as $key) {
         $criterion = $criteria->getCriterion($key);
         $table = null;
         foreach ($criterion->getAttachedCriterion() as $attachedCriterion) {
             $tableName = $attachedCriterion->getTable();
             $table = $criteria->getTableForAlias($tableName);
             if ($table !== null) {
                 $fromClause[] = $table . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
                 $table = $tableName;
             }
             if (($criteria->isIgnoreCase() || $attachedCriterion->isIgnoreCase()) && $dbMap->getTable($table)->getColumn($attachedCriterion->getColumn())->isText()) {
                 $attachedCriterion->setIgnoreCase(true);
             }
         }
         $criterion->setDB($db);
         $sb = '';
         $criterion->appendPsTo($sb, $params);
         $whereClause[] = $sb;
     }
     // Handle joins
     // joins with a null join type will be added to the FROM clause and the condition added to the WHERE clause.
     // joins of a specified type: the LEFT side will be added to the fromClause and the RIGHT to the joinClause
     foreach ($criteria->getJoins() as $join) {
         // The join might have been established using an alias name
         $leftTable = $join->getLeftTableName();
         if ($realTable = $criteria->getTableForAlias($leftTable)) {
             $leftTableForFrom = $realTable . ' ' . $leftTable;
             $leftTable = $realTable;
         } else {
             $leftTableForFrom = $leftTable;
         }
         $rightTable = $join->getRightTableName();
         if ($realTable = $criteria->getTableForAlias($rightTable)) {
             $rightTableForFrom = $realTable . ' ' . $rightTable;
             $rightTable = $realTable;
         } else {
             $rightTableForFrom = $rightTable;
         }
         // determine if casing is relevant.
         if ($ignoreCase = $criteria->isIgnoreCase()) {
             $leftColType = $dbMap->getTable($leftTable)->getColumn($join->getLeftColumnName())->getType();
             $rightColType = $dbMap->getTable($rightTable)->getColumn($join->getRightColumnName())->getType();
             $ignoreCase = $leftColType == 'string' || $rightColType == 'string';
         }
         // build the condition
         $condition = '';
         foreach ($join->getConditions() as $index => $conditionDesc) {
             if ($ignoreCase) {
                 $condition .= $db->ignoreCase($conditionDesc['left']) . $conditionDesc['operator'] . $db->ignoreCase($conditionDesc['right']);
             } else {
                 $condition .= implode($conditionDesc);
             }
             if ($index + 1 < $join->countConditions()) {
                 $condition .= ' AND ';
             }
         }
         // add 'em to the queues..
         if ($joinType = $join->getJoinType()) {
             // real join
             if (!$fromClause) {
                 $fromClause[] = $leftTableForFrom;
             }
             $joinTables[] = $rightTableForFrom;
             $joinClause[] = $join->getJoinType() . ' ' . $rightTableForFrom . " ON ({$condition})";
         } else {
             // implicit join, translates to a where
             $fromClause[] = $leftTableForFrom;
             $fromClause[] = $rightTableForFrom;
//.........这里部分代码省略.........
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:101,代码来源:BasePeer.php

示例2: createSelectSql

 /**
  * Method to create an SQL query based on values in a Criteria.
  *
  * This method creates only prepared statement SQL (using ? where values
  * will go).  The second parameter ($params) stores the values that need
  * to be set before the statement is executed.  The reason we do it this way
  * is to let the Creole layer handle all escaping & value formatting.
  *
  * @param Criteria $criteria Criteria for the SELECT query.
  * @param array &$params Parameters that are to be replaced in prepared statement.
  * @return string
  * @throws PropelException Trouble creating the query string.
  */
 public static function createSelectSql(Criteria $criteria, &$params)
 {
     $db = Propel::getDB($criteria->getDbName());
     $dbMap = Propel::getDatabaseMap($criteria->getDbName());
     // redundant definition $selectModifiers = array();
     $selectClause = array();
     $fromClause = array();
     $joinClause = array();
     $joinTables = array();
     $whereClause = array();
     $orderByClause = array();
     // redundant definition $groupByClause = array();
     $orderBy = $criteria->getOrderByColumns();
     $groupBy = $criteria->getGroupByColumns();
     $ignoreCase = $criteria->isIgnoreCase();
     $select = $criteria->getSelectColumns();
     $aliases = $criteria->getAsColumns();
     // simple copy
     $selectModifiers = $criteria->getSelectModifiers();
     // get selected columns
     foreach ($select as $columnName) {
         // expect every column to be of "table.column" formation
         // it could be a function:  e.g. MAX(books.price)
         $tableName = null;
         $selectClause[] = $columnName;
         // the full column name: e.g. MAX(books.price)
         $parenPos = strpos($columnName, '(');
         $dotPos = strpos($columnName, '.');
         // [HL] I think we really only want to worry about adding stuff to
         // the fromClause if this function has a TABLE.COLUMN in it at all.
         // e.g. COUNT(*) should not need this treatment -- or there needs to
         // be special treatment for '*'
         if ($dotPos !== false) {
             if ($parenPos === false) {
                 // table.column
                 $tableName = substr($columnName, 0, $dotPos);
             } else {
                 // FUNC(table.column)
                 $tableName = substr($columnName, $parenPos + 1, $dotPos - ($parenPos + 1));
                 // functions may contain qualifiers so only take the last
                 // word as the table name.
                 // COUNT(DISTINCT books.price)
                 $lastSpace = strpos($tableName, ' ');
                 if ($lastSpace !== false) {
                     // COUNT(DISTINCT books.price)
                     $tableName = substr($tableName, $lastSpace + 1);
                 }
             }
             $tableName2 = $criteria->getTableForAlias($tableName);
             if ($tableName2 !== null) {
                 $fromClause[] = $tableName2 . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
             }
         }
         // if $dotPost !== null
     }
     // set the aliases
     foreach ($aliases as $alias => $col) {
         $selectClause[] = $col . " AS " . $alias;
     }
     // add the criteria to WHERE clause
     // this will also add the table names to the FROM clause if they are not already
     // invluded via a LEFT JOIN
     foreach ($criteria->keys() as $key) {
         $criterion = $criteria->getCriterion($key);
         $someCriteria = $criterion->getAttachedCriterion();
         $someCriteriaLength = count($someCriteria);
         $table = null;
         for ($i = 0; $i < $someCriteriaLength; $i++) {
             $tableName = $someCriteria[$i]->getTable();
             $table = $criteria->getTableForAlias($tableName);
             if ($table !== null) {
                 $fromClause[] = $table . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
                 $table = $tableName;
             }
             $ignoreCase = ($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && $dbMap->getTable($table)->getColumn($someCriteria[$i]->getColumn())->getType() == "string";
             $someCriteria[$i]->setIgnoreCase($ignoreCase);
         }
         $criterion->setDB($db);
         $sb = "";
         $criterion->appendPsTo($sb, $params);
         $whereClause[] = $sb;
     }
     // handle RIGHT (straight) joins
//.........这里部分代码省略.........
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:101,代码来源:BasePeer.php

示例3: createSelectSql

 /**
  * Method to create select SQL.
  *
  * @param Criteria $criteria object used to create the SELECT statement.
  * @param String $tableName
  * @param Array &$params
  * @throws PropelException Any exceptions caught during processing will be
  * rethrown wrapped into a PropelException.
  */
 private function createSelectSql($criteria, $tableName, &$params)
 {
     $db = Propel::getDB($criteria->getDbName());
     // redundant definition $selectModifiers = array();
     $selectClause = array();
     $fromClause = array();
     $joinClause = array();
     $joinTables = array();
     $whereClause = array();
     $orderByClause = array();
     $groupByClause = array();
     $orderBy = $criteria->getOrderByColumns();
     $groupBy = $criteria->getGroupByColumns();
     $ignoreCase = $criteria->isIgnoreCase();
     $select = $criteria->getSelectColumns();
     $aliases = $criteria->getAsColumns();
     $fromClause[] = $criteria->getDBArrayTable();
     // simple copy
     $selectModifiers = $criteria->getSelectModifiers();
     // get selected columns
     foreach ($select as $columnName) {
         $tableName = null;
         $selectClause[] = $columnName;
         // the full column name: e.g. MAX(books.price)
         $parenPos = strpos($columnName, '(');
         $dotPos = strpos($columnName, '.');
         // [HL] I think we really only want to worry about adding stuff to
         // the fromClause if this function has a TABLE.COLUMN in it at all.
         // e.g. COUNT(*) should not need this treatment -- or there needs to
         // be special treatment for '*'
         if ($dotPos !== false) {
             if ($parenPos === false) {
                 // table.column
                 $tableName = substr($columnName, 0, $dotPos);
             } else {
                 // FUNC(table.column)
                 $tableName = substr($columnName, $parenPos + 1, $dotPos - ($parenPos + 1));
                 // functions may contain qualifiers so only take the last
                 // word as the table name.
                 // COUNT(DISTINCT books.price)
                 $lastSpace = strpos($tableName, ' ');
                 if ($lastSpace !== false) {
                     // COUNT(DISTINCT books.price)
                     $tableName = substr($tableName, $lastSpace + 1);
                 }
             }
             $tableName2 = $criteria->getTableForAlias($tableName);
             if ($tableName2 !== null) {
                 $fromClause[] = $tableName2 . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
             }
         }
         // if $dotPost !== null
     }
     // set the aliases
     foreach ($aliases as $alias => $col) {
         $selectClause[] = $col . " AS " . $alias;
     }
     // add the criteria to WHERE clause
     foreach ($criteria->keys() as $key) {
         $criterion = $criteria->getCriterion($key);
         $someCriteria = $criterion->getAttachedCriterion();
         $someCriteriaLength = count($someCriteria);
         $table = null;
         for ($i = 0; $i < $someCriteriaLength; $i++) {
             $tableName = $someCriteria[$i]->getTable();
             $table = $criteria->getTableForAlias($tableName);
             if ($table !== null) {
                 $fromClause[] = $table . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
                 $table = $tableName;
             }
             $ignoreCase = ($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && $dbMap->getTable($table)->getColumn($someCriteria[$i]->getColumn())->getType() == "string";
             $someCriteria[$i]->setIgnoreCase($ignoreCase);
         }
         $criterion->setDB($db);
         $cri['table'] = $criterion->table;
         $cri['field'] = $criterion->column;
         $cri['comparison'] = $criterion->comparison == '=' ? '==' : $criterion->comparison;
         $cri['value'] = $criterion->getValue();
         $sb = "";
         $sb .= "\$row['" . $cri['field'] . "'] " . $cri['comparison'] . "'" . $cri['value'] . "'";
         $params[] = $cri;
         //$criterion->appendPsTo($sb, $params);
         $whereClause[] = $sb;
     }
     // Unique from clause elements
     $fromClause = array_unique($fromClause);
     if (!empty($orderBy)) {
//.........这里部分代码省略.........
开发者ID:emildev35,项目名称:processmaker,代码行数:101,代码来源:class.ArrayPeer.php

示例4: createSelectSql

 /**
  * Method to create an SQL query based on values in a Criteria.
  *
  * This method creates only prepared statement SQL (using ? where values
  * will go).  The second parameter ($params) stores the values that need
  * to be set before the statement is executed.  The reason we do it this way
  * is to let the PDO layer handle all escaping & value formatting.
  *
  * @param      Criteria $criteria Criteria for the SELECT query.
  * @param      array &$params Parameters that are to be replaced in prepared statement.
  * @return     string
  * @throws     PropelException Trouble creating the query string.
  */
 public static function createSelectSql(Criteria $criteria, &$params)
 {
     $db = Propel::getDB($criteria->getDbName());
     $dbMap = Propel::getDatabaseMap($criteria->getDbName());
     // redundant definition $selectModifiers = array();
     $selectClause = array();
     $fromClause = array();
     $joinClause = array();
     $joinTables = array();
     $whereClause = array();
     $orderByClause = array();
     // redundant definition $groupByClause = array();
     $orderBy = $criteria->getOrderByColumns();
     $groupBy = $criteria->getGroupByColumns();
     $ignoreCase = $criteria->isIgnoreCase();
     $select = $criteria->getSelectColumns();
     $aliases = $criteria->getAsColumns();
     // simple copy
     $selectModifiers = $criteria->getSelectModifiers();
     // get selected columns
     foreach ($select as $columnName) {
         // expect every column to be of "table.column" formation
         // it could be a function:  e.g. MAX(books.price)
         $tableName = null;
         $selectClause[] = $columnName;
         // the full column name: e.g. MAX(books.price)
         $parenPos = strrpos($columnName, '(');
         $dotPos = strrpos($columnName, '.', $parenPos !== false ? $parenPos : 0);
         // [HL] I think we really only want to worry about adding stuff to
         // the fromClause if this function has a TABLE.COLUMN in it at all.
         // e.g. COUNT(*) should not need this treatment -- or there needs to
         // be special treatment for '*'
         if ($dotPos !== false) {
             if ($parenPos === false) {
                 // table.column
                 $tableName = substr($columnName, 0, $dotPos);
             } else {
                 // FUNC(table.column)
                 $tableName = substr($columnName, $parenPos + 1, $dotPos - ($parenPos + 1));
                 // functions may contain qualifiers so only take the last
                 // word as the table name.
                 // COUNT(DISTINCT books.price)
                 $lastSpace = strpos($tableName, ' ');
                 if ($lastSpace !== false) {
                     // COUNT(DISTINCT books.price)
                     $tableName = substr($tableName, $lastSpace + 1);
                 }
             }
             $tableName2 = $criteria->getTableForAlias($tableName);
             if ($tableName2 !== null) {
                 $fromClause[] = $tableName2 . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
             }
         }
         // if $dotPost !== null
     }
     // set the aliases
     foreach ($aliases as $alias => $col) {
         $selectClause[] = $col . " AS " . $alias;
     }
     // add the criteria to WHERE clause
     // this will also add the table names to the FROM clause if they are not already
     // invluded via a LEFT JOIN
     foreach ($criteria->keys() as $key) {
         $criterion = $criteria->getCriterion($key);
         $someCriteria = $criterion->getAttachedCriterion();
         $someCriteriaLength = count($someCriteria);
         $table = null;
         for ($i = 0; $i < $someCriteriaLength; $i++) {
             $tableName = $someCriteria[$i]->getTable();
             $table = $criteria->getTableForAlias($tableName);
             if ($table !== null) {
                 $fromClause[] = $table . ' ' . $tableName;
             } else {
                 $fromClause[] = $tableName;
                 $table = $tableName;
             }
             $ignoreCase = ($criteria->isIgnoreCase() || $someCriteria[$i]->isIgnoreCase()) && strpos($dbMap->getTable($table)->getColumn($someCriteria[$i]->getColumn())->getType(), "VARCHAR") !== false;
             $someCriteria[$i]->setIgnoreCase($ignoreCase);
         }
         $criterion->setDB($db);
         $sb = "";
         $criterion->appendPsTo($sb, $params);
         $whereClause[] = $sb;
     }
     // Handle joins
//.........这里部分代码省略.........
开发者ID:alexhandzhiev,项目名称:sifact,代码行数:101,代码来源:BasePeer.php


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