本文整理汇总了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;
}
示例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;
}
}
示例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);
}
}
}
}