當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AQueryWriter::canBeTreatedAsInt方法代碼示例

本文整理匯總了PHP中RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt方法的典型用法代碼示例。如果您正苦於以下問題:PHP AQueryWriter::canBeTreatedAsInt方法的具體用法?PHP AQueryWriter::canBeTreatedAsInt怎麽用?PHP AQueryWriter::canBeTreatedAsInt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RedBeanPHP\QueryWriter\AQueryWriter的用法示例。


在下文中一共展示了AQueryWriter::canBeTreatedAsInt方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: fillInValue

 /**
  * Fills in a value of a binding and truncates the
  * resulting string if necessary.
  *
  * @param mixed $value bound value
  *
  * @return string
  */
 protected function fillInValue($value)
 {
     if (is_null($value)) {
         $value = 'NULL';
     }
     $value = strval($value);
     if (strlen($value) > $this->strLen) {
         $value = substr($value, 0, $this->strLen) . '... ';
     }
     if (!\RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt($value) && $value !== 'NULL') {
         $value = '\'' . $value . '\'';
     }
     return $value;
 }
開發者ID:gabordemooij,項目名稱:redbean,代碼行數:22,代碼來源:Debug.php

示例2: scanType

 /**
  * @see QueryWriter::scanType
  */
 public function scanType($value, $flagSpecial = FALSE)
 {
     $this->svalue = $value;
     if ($value === INF) {
         return self::C_DATATYPE_TEXT;
     }
     if ($flagSpecial && $value) {
         if (preg_match('/^\\d{4}\\-\\d\\d-\\d\\d$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_DATE;
         }
         if (preg_match('/^\\d{4}\\-\\d\\d-\\d\\d\\s\\d\\d:\\d\\d:\\d\\d(\\.\\d{1,6})?$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_DATETIME;
         }
         if (preg_match('/^\\([\\d\\.]+,[\\d\\.]+\\)$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_POINT;
         }
         if (preg_match('/^\\[\\([\\d\\.]+,[\\d\\.]+\\),\\([\\d\\.]+,[\\d\\.]+\\)\\]$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_LSEG;
         }
         if (preg_match('/^\\<\\([\\d\\.]+,[\\d\\.]+\\),[\\d\\.]+\\>$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_CIRCLE;
         }
         if (preg_match('/^\\((\\([\\d\\.]+,[\\d\\.]+\\),?)+\\)$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_POLYGON;
         }
         if (preg_match('/^\\-?(\\$|€|¥|£)[\\d,\\.]+$/', $value)) {
             return PostgreSQL::C_DATATYPE_SPECIAL_MONEY;
         }
     }
     if (is_float($value)) {
         return self::C_DATATYPE_DOUBLE;
     }
     if ($this->startsWithZeros($value)) {
         return self::C_DATATYPE_TEXT;
     }
     if ($value === FALSE || $value === TRUE || $value === NULL || is_numeric($value) && AQueryWriter::canBeTreatedAsInt($value) && $value < 2147483648.0 && $value > -2147483648.0) {
         return self::C_DATATYPE_INTEGER;
     } elseif (is_numeric($value)) {
         return self::C_DATATYPE_DOUBLE;
     } else {
         return self::C_DATATYPE_TEXT;
     }
 }
開發者ID:WTer,項目名稱:NJB,代碼行數:46,代碼來源:rb.php

示例3: bindParams

 /**
  * Binds parameters. This method binds parameters to a\PDOStatement for
  * Query Execution. This method binds parameters as NULL, INTEGER or STRING
  * and supports both named keys and question mark keys.
  *
  * @param \PDOStatement $statement \PDO Statement instance
  * @param  array        $bindings   values that need to get bound to the statement
  *
  * @return void
  */
 protected function bindParams($statement, $bindings)
 {
     foreach ($bindings as $key => &$value) {
         if (is_integer($key)) {
             if (is_null($value)) {
                 $statement->bindValue($key + 1, NULL, \PDO::PARAM_NULL);
             } elseif (!$this->flagUseStringOnlyBinding && AQueryWriter::canBeTreatedAsInt($value) && $value < 2147483648) {
                 $statement->bindParam($key + 1, $value, \PDO::PARAM_INT);
             } else {
                 $statement->bindParam($key + 1, $value, \PDO::PARAM_STR);
             }
         } else {
             if (is_null($value)) {
                 $statement->bindValue($key, NULL, \PDO::PARAM_NULL);
             } elseif (!$this->flagUseStringOnlyBinding && AQueryWriter::canBeTreatedAsInt($value) && $value < 2147483648) {
                 $statement->bindParam($key, $value, \PDO::PARAM_INT);
             } else {
                 $statement->bindParam($key, $value, \PDO::PARAM_STR);
             }
         }
     }
 }
開發者ID:EGArian,項目名稱:sarkesh,代碼行數:32,代碼來源:core_cls_db_orm.php


注:本文中的RedBeanPHP\QueryWriter\AQueryWriter::canBeTreatedAsInt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。