diff options
Diffstat (limited to 'framework/Data/SqlMap/Statements/TPreparedStatementFactory.php')
-rw-r--r-- | framework/Data/SqlMap/Statements/TPreparedStatementFactory.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php new file mode 100644 index 00000000..52461983 --- /dev/null +++ b/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php @@ -0,0 +1,32 @@ +<?php
+
+class TPreparedStatementFactory
+{
+ private $_statement;
+ private $_preparedStatement;
+ private $_parameterPrefix = 'param';
+ private $_commandText;
+
+ public function __construct($statement, $sqlString)
+ {
+ $this->_statement = $statement;
+ $this->_commandText = $sqlString;
+ }
+
+ public function prepare()
+ {
+ $this->_preparedStatement = new TPreparedStatement();
+ $this->_preparedStatement->setPreparedSql($this->_commandText);
+ if(!is_null($this->_statement->parameterMap()))
+ $this->createParametersForTextCommand();
+ return $this->_preparedStatement;
+ }
+
+ protected function createParametersForTextCommand()
+ {
+ foreach($this->_statement->ParameterMap()->getProperties() as $prop)
+ $this->_preparedStatement->getParameterNames()->add($prop->getProperty());
+ }
+}
+
+?>
\ No newline at end of file |