Skip to content

Commit

Permalink
优化根据值类型获取PDO数据类型
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Jan 4, 2024
1 parent 0c4d415 commit 6961142
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Db/Drivers/TPdoStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ public function valid(): bool
*/
protected function getDataTypeByValue($value): int
{
if (\is_int($value))
{
return \PDO::PARAM_INT;
}
if (\is_string($value))
{
return \PDO::PARAM_STR;
}
if (null === $value)
{
return \PDO::PARAM_NULL;
Expand All @@ -327,10 +335,6 @@ protected function getDataTypeByValue($value): int
{
return \PDO::PARAM_BOOL;
}
if (\is_int($value))
{
return \PDO::PARAM_INT;
}
if (\is_resource($value))
{
return \PDO::PARAM_LOB;
Expand Down

0 comments on commit 6961142

Please sign in to comment.