summaryrefslogtreecommitdiff
path: root/framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php
diff options
context:
space:
mode:
authorwei <>2006-04-14 06:22:09 +0000
committerwei <>2006-04-14 06:22:09 +0000
commit3d3f8d3832921f99daf8ce1953304763c2e76c62 (patch)
treee1b0a9bc3a13fccd253770fb452ac96cc6315121 /framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php
parent373d8acc503b94ea09823f49e2ab5e395eccc584 (diff)
Importing SQLMap + sample + docs.
Diffstat (limited to 'framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php')
-rw-r--r--framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php b/framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php
new file mode 100644
index 00000000..41059934
--- /dev/null
+++ b/framework/DataAccess/SQLMap/Statements/TPreparedStatementFactory.php
@@ -0,0 +1,47 @@
+<?php
+
+class TPreparedStatementFactory
+{
+ private $_statement;
+ private $_preparedStatement;
+ private $_parameterPrefix = 'param';
+ private $_commandText;
+
+ public function __construct($statement, $sqlString)
+ {
+ $this->_statement = $statement;
+ $this->_commandText = $sqlString;
+ // $this->_statement = new TPreparedStatement();
+// $this->_statement->setSqlString($sqlString);
+ }
+
+ public function prepare()
+ {
+ //$this->createParametersFromTextCommand();
+ //return $this->_statement;
+ $this->_preparedStatement = new TPreparedStatement();
+ $this->_preparedStatement->setPreparedSql($this->_commandText);
+ if(!is_null($this->_statement->parameterMap()))
+ {
+ $this->createParametersForTextCommand();
+ //$this->evaluateParameterMap();
+ }
+ //var_dump($this->_preparedStatement);
+ return $this->_preparedStatement;
+ }
+
+ protected function createParametersForTextCommand()
+ {
+ /*$matches = array();
+ $string = $this->_statement->getSqlString();
+ preg_match_all('/#([a-zA-Z0-9._]+)#/', $string, $matches);
+ $this->_statement->getParameterNames()->copyFrom($matches[0]);*/
+ //var_dump($this->_statement);
+ foreach($this->_statement->ParameterMap()->getProperties() as $prop)
+ {
+ $this->_preparedStatement->getParameterNames()->add($prop->getProperty());
+ }
+ }
+}
+
+?> \ No newline at end of file