diff options
author | wei <> | 2007-05-09 04:31:09 +0000 |
---|---|---|
committer | wei <> | 2007-05-09 04:31:09 +0000 |
commit | 559f04e22869e3b54ffc25b22a74aa297bf65c41 (patch) | |
tree | 08f1d49af1b401965bb8c5a2f24f0203309ec265 | |
parent | c3c0dc28d3e9964bddbe66dac34080cf9e1dd05c (diff) |
Fixed #547
-rw-r--r-- | framework/Data/Common/TDbCommandBuilder.php | 2 | ||||
-rw-r--r-- | framework/Data/SqlMap/Statements/TPreparedCommand.php | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/framework/Data/Common/TDbCommandBuilder.php b/framework/Data/Common/TDbCommandBuilder.php index 3535100f..0d960c8d 100644 --- a/framework/Data/Common/TDbCommandBuilder.php +++ b/framework/Data/Common/TDbCommandBuilder.php @@ -331,7 +331,7 @@ class TDbCommandBuilder extends TComponent * @param mixed PHP value
* @return integer PDO parameter types.
*/
- protected function getPdoType($value)
+ public static function getPdoType($value)
{
switch(gettype($value))
{
diff --git a/framework/Data/SqlMap/Statements/TPreparedCommand.php b/framework/Data/SqlMap/Statements/TPreparedCommand.php index ff5fd6ff..c50ff3e9 100644 --- a/framework/Data/SqlMap/Statements/TPreparedCommand.php +++ b/framework/Data/SqlMap/Statements/TPreparedCommand.php @@ -46,7 +46,10 @@ class TPreparedCommand {
$property = $statement->parameterMap()->getProperty($i);
$value = $statement->parameterMap()->getPropertyValue($registry,$property, $parameterObject);
- $command->bindValue($i+1,$value);
+ if(!empty($property->getDbType()))
+ $command->bindValue($i+1,$value, constant($property->getDbType())); //assumes PDO types, e.g. PDO::PARAM_INT
+ else
+ $command->bindValue($i+1,$value, TDbCommandBuilder::getPdoType($value));
}
}
}
|