From 6f7fdef0f500cd4bb540affd3bc1482243f337c1 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 24 Feb 2016 23:18:07 +0100 Subject: * Prado 3.3.0 --- .../Statements/TPreparedStatementFactory.php | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/prado/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php (limited to 'lib/prado/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php') diff --git a/lib/prado/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php b/lib/prado/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php new file mode 100644 index 0000000..a85cd76 --- /dev/null +++ b/lib/prado/framework/Data/SqlMap/Statements/TPreparedStatementFactory.php @@ -0,0 +1,47 @@ + + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT + * @package System.Data.SqlMap.Statements + */ + +/** + * TPreparedStatementFactory class. + * + * @author Wei Zhuo + * @package System.Data.SqlMap.Statements + * @since 3.1 + */ +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($this->_statement->parameterMap()!==null) + $this->createParametersForTextCommand(); + return $this->_preparedStatement; + } + + protected function createParametersForTextCommand() + { + foreach($this->_statement->ParameterMap()->getProperties() as $prop) + $this->_preparedStatement->getParameterNames()->add($prop->getProperty()); + } +} + -- cgit v1.2.3