public getPdoType ( mixed $data ) : integer | ||
$data | mixed | the data whose PDO type is to be determined |
return | integer | the PDO type |
public function getPdoType($data)
{
static $typeMap = ['boolean' => \PDO::PARAM_BOOL, 'integer' => \PDO::PARAM_INT, 'string' => \PDO::PARAM_STR, 'resource' => \PDO::PARAM_LOB, 'NULL' => \PDO::PARAM_NULL];
$type = gettype($data);
return isset($typeMap[$type]) ? $typeMap[$type] : \PDO::PARAM_STR;
}