根据值类型获取PDO数据类型

@param mixed $value
@return int
343337
protected function getDataTypeByValue($value)
    {
        if(null === $value)
        {
            return \PDO::PARAM_NULL;
        }
        if(is_bool($value))
        {
            return \PDO::PARAM_BOOL;
        }
        if(is_int($value))
        {
            return \PDO::PARAM_INT;
        }
        return \PDO::PARAM_STR;
    }
390573
private function calc_size( $value ) {

		$type = gettype( $value );

		switch ( $type ) {
			case 'string' :
				return function_exists( 'mb_strlen' ) ? mb_strlen( $value ) : strlen( $value );
			case 'integer' :
			case 'double' :
			case 'boolean' :
				return (int) $value;
			case 'array' :
			case 'object' :
				return count( $value );
		}

		return - 1;

	}
33192
public function get($value) {
        //TODO throw exception instead?!
        if (\is_int($value)) {
            $info = $this->getIndexAndMask($value);
            $i = $info["i"];
            $k = $info["k"];

            $flag = 1;
            $flag = $flag << $k;

            if (isset($this->array[$i])) return (($this->array[$i] & $flag) !== 0);
            return false;
        }
        return false;
    }
1366510
private function argValue($value) {
        if (is_bool($value)) {
            return (int)$value;
        } elseif ($value instanceof \DateTimeInterface) {
            return $value->format(self::MYSQL_DATE_FORMAT);
        } else {
            return $value;
        }
    }
720878
public function cmp($value)
	{
		$ts = sfDateTimeToolkit::getTS($value);
		
		if ($this->ts < $ts)
		{
			// less than
			return -1;
		}
		else if ($this->ts > $ts)
		{
			// greater than
			return 1;
		}
		
		// equal to
		return 0;
	}
548898
public function int($value)
    {
        if ($this->notBeEmpty($value)) {
            if (is_int($value)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
948626
public function quote($value)
	{
		// PDO::quote() does not work as it should ...
		if ($value instanceof FlupdoRawSql) {
			return $value;
		} else if (is_bool($value)) {
			return $value ? 'TRUE' : 'FALSE';
		} else if (is_null($value)) {
			return 'NULL';
		} else if (is_int($value)) {
			return (string) $value;
		} else if (is_float($value)) {
			return sprintf('%F', $value);
		} else {
			// ignore locales when converting to string
			return $this->pdo->quote(strval($value), \PDO::PARAM_STR);
		}
	}
1282555
public function quote($value)
    {
        if ($value === null) {
            return 'NULL';
        }
        if ($value instanceof DateTimeInterface) {
            return $this->pdo->quote($value->format('Y-m-d H:i:s'));
        }
        if (is_array($value)) {
            return implode(',', array_map([$this, 'quote'], $value));
        }
        if (is_bool($value)) {
            return $this->pdo->quote($value ? 1 : 0);
        }

        return $this->pdo->quote($value);
    }
99523
public function insert(array $values) : int
    {
        $fields = $this->fields;
        array_shift($fields);

        $sql = 'INSERT INTO `' . $this->table . '` (' . implode(', ', $fields) . ') VALUES (:' . implode(', :', $fields) . ')';
        $query = $this->pdo->prepare($sql);
        foreach ($values as $key => &$value) {
            $query->bindParam(':' . $fields[$key], $value);
        }
        $query->execute();

        return $this->pdo->lastInsertId();
    }
788906
public function escape_string($value)
    {
        if ($this->pdo) {
            return substr($this->pdo->quote($value), 1, -1);
        }
        return $value;
    }
1291720
private function inferType($value)
    {
        if (is_integer($value)) {
            return \PDO::PARAM_INT;
        }

        if (is_bool($value)) {
            return \PDO::PARAM_BOOL;
        }

        if (is_array($value)) {
            return is_integer(current($value))
                ? Connection::PARAM_INT_ARRAY
                : Connection::PARAM_STR_ARRAY;
        }

        return \PDO::PARAM_STR;
    }
1175488
private function getResult() {
        //返回数据集
        $result =   $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);
        $this->numRows = count( $result );
        return $result;
    }
793889
public static function isInt($value) {
        if(is_object($value)) {
            $value = Assert::isString($value);
        }
        if(is_int($value)) {
            return $value;
        } elseif(is_scalar($value) && preg_match('@^-?[0-9]+$@', $value)) {
            return (int)$value;
        } else {
            throw new \InvalidArgumentException('Must be Int: ' . print_r($value, true));
        }
    }
221194
public function get_PDO_param($var) {
        switch($var) {
            case is_int($var):
                $param_datatype = \PDO::PARAM_INT;
                break;
            case is_string($var):
                $param_datatype = \PDO::PARAM_STR;
                break;
            default:
                $param_datatype = \PDO::PARAM_INT;
        }

        return $param_datatype;
    }
344561
private function prepareRow($value)
    {
        if (is_array($value) and count($value) === 1) {
            $value = array_shift($value);
        }

        return $value;
    }
63610
public function pull($column, $value = null)
    {
        $this->compileWheres();
        $result = $this->query->update([
            $column => r\row($column)->difference([$value]),
        ])->run();

        return 0 == (int) $result['errors'];
    }
590812
public static function int(&$value, $options = ['max'=>null, 'min'=>null, 'default'=>null])
    {
        $value = (int)$value;
        self::processNum($value, $options);
        return $value;
    }