diff options
author | wei <> | 2006-12-04 00:02:23 +0000 |
---|---|---|
committer | wei <> | 2006-12-04 00:02:23 +0000 |
commit | 18ea316c553f7ccfc18b73f0c987de007f11b275 (patch) | |
tree | b8fa0d14de75582b48c3e4d12050c84f07805920 /framework/Data/SqlMap/Statements/TPreparedCommand.php | |
parent | b69ca04f50ffd538239342f3bfd1e77ffc6156c0 (diff) |
Fixed #469
Diffstat (limited to 'framework/Data/SqlMap/Statements/TPreparedCommand.php')
-rw-r--r-- | framework/Data/SqlMap/Statements/TPreparedCommand.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/framework/Data/SqlMap/Statements/TPreparedCommand.php b/framework/Data/SqlMap/Statements/TPreparedCommand.php new file mode 100644 index 00000000..5a8041ae --- /dev/null +++ b/framework/Data/SqlMap/Statements/TPreparedCommand.php @@ -0,0 +1,29 @@ +<?php
+
+class TPreparedCommand
+{
+
+ public function create(TSqlMapManager $manager, $connection, $statement, $parameterObject)
+ {
+ $prepared = $statement->getSQLText()->getPreparedStatement($parameterObject);
+ $connection->setActive(true);
+ $command = $connection->createCommand($prepared->getPreparedSql());
+ $this->applyParameterMap($manager, $command, $prepared, $statement, $parameterObject);
+ return $command;
+ }
+
+ protected function applyParameterMap($manager,$command,$prepared, $statement, $parameterObject)
+ {
+ $properties = $prepared->getParameterNames();
+ $parameters = $prepared->getParameterValues();
+ $registry=$manager->getTypeHandlers();
+ for($i = 0, $k=$properties->getCount(); $i<$k; $i++)
+ {
+ $property = $statement->parameterMap()->getProperty($i);
+ $value = $statement->parameterMap()->getPropertyValue($registry,$property, $parameterObject);
+ $command->bindValue($i+1,$value);
+ }
+ }
+}
+
+?>
\ No newline at end of file |