@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function getTypeHandlers() |
89 | 89 | { |
90 | 90 | if($this->_typeHandlers===null) |
91 | - $this->_typeHandlers= new TSqlMapTypeHandlerRegistry(); |
|
91 | + $this->_typeHandlers=new TSqlMapTypeHandlerRegistry(); |
|
92 | 92 | return $this->_typeHandlers; |
93 | 93 | } |
94 | 94 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function configureXml($file) |
110 | 110 | { |
111 | - $config = new TSqlMapXmlConfiguration($this); |
|
111 | + $config=new TSqlMapXmlConfiguration($this); |
|
112 | 112 | $config->configure($file); |
113 | 113 | } |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getCacheDependencies() |
120 | 120 | { |
121 | - if($this->_cacheDependencies === null) |
|
121 | + if($this->_cacheDependencies===null) |
|
122 | 122 | $this->_cacheDependencies=new TChainedCacheDependency(); |
123 | 123 | |
124 | 124 | return $this->_cacheDependencies; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function getMappedStatement($name) |
152 | 152 | { |
153 | - if($this->_mappedStatements->contains($name) == false) |
|
153 | + if($this->_mappedStatements->contains($name)==false) |
|
154 | 154 | throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name); |
155 | 155 | return $this->_mappedStatements[$name]; |
156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function addMappedStatement(IMappedStatement $statement) |
165 | 165 | { |
166 | - $key = $statement->getID(); |
|
167 | - if($this->_mappedStatements->contains($key) == true) |
|
166 | + $key=$statement->getID(); |
|
167 | + if($this->_mappedStatements->contains($key)==true) |
|
168 | 168 | throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key); |
169 | 169 | $this->_mappedStatements->add($key, $statement); |
170 | 170 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getResultMap($name) |
187 | 187 | { |
188 | - if($this->_resultMaps->contains($name) == false) |
|
188 | + if($this->_resultMaps->contains($name)==false) |
|
189 | 189 | throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name); |
190 | 190 | return $this->_resultMaps[$name]; |
191 | 191 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function addResultMap(TResultMap $result) |
198 | 198 | { |
199 | - $key = $result->getID(); |
|
200 | - if($this->_resultMaps->contains($key) == true) |
|
199 | + $key=$result->getID(); |
|
200 | + if($this->_resultMaps->contains($key)==true) |
|
201 | 201 | throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key); |
202 | 202 | $this->_resultMaps->add($key, $result); |
203 | 203 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function getParameterMap($name) |
219 | 219 | { |
220 | - if($this->_parameterMaps->contains($name) == false) |
|
220 | + if($this->_parameterMaps->contains($name)==false) |
|
221 | 221 | throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name); |
222 | 222 | return $this->_parameterMaps[$name]; |
223 | 223 | } |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function addParameterMap(TParameterMap $parameter) |
230 | 230 | { |
231 | - $key = $parameter->getID(); |
|
232 | - if($this->_parameterMaps->contains($key) == true) |
|
231 | + $key=$parameter->getID(); |
|
232 | + if($this->_parameterMaps->contains($key)==true) |
|
233 | 233 | throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key); |
234 | 234 | $this->_parameterMaps->add($key, $parameter); |
235 | 235 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function queryForObject($statementName, $parameter=null, $result=null) |
69 | 69 | { |
70 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
70 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
71 | 71 | return $statement->executeQueryForObject($this->getDbConnection(), $parameter, $result); |
72 | 72 | } |
73 | 73 | |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function queryForList($statementName, $parameter=null, $result=null, $skip=-1, $max=-1) |
90 | 90 | { |
91 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
92 | - return $statement->executeQueryForList($this->getDbConnection(),$parameter, $result, $skip, $max); |
|
91 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
92 | + return $statement->executeQueryForList($this->getDbConnection(), $parameter, $result, $skip, $max); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function queryWithRowDelegate($statementName, $delegate, $parameter=null, $result=null, $skip=-1, $max=-1) |
111 | 111 | { |
112 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
112 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
113 | 113 | return $statement->executeQueryForList($this->getDbConnection(), $parameter, $result, $skip, $max, $delegate); |
114 | 114 | } |
115 | 115 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function queryForPagedList($statementName, $parameter=null, $pageSize=10, $page=0) |
127 | 127 | { |
128 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
128 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
129 | 129 | return new TSqlMapPagedList($statement, $parameter, $pageSize, null, $page); |
130 | 130 | } |
131 | 131 | |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | * @param integer The number of the page to initially load into the list. |
145 | 145 | * @return TPagedList A PaginatedList of beans containing the rows. |
146 | 146 | */ |
147 | - public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10, $page=0) |
|
147 | + public function queryForPagedListWithRowDelegate($statementName, $delegate, $parameter=null, $pageSize=10, $page=0) |
|
148 | 148 | { |
149 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
150 | - return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate,$page); |
|
149 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
150 | + return new TSqlMapPagedList($statement, $parameter, $pageSize, $delegate, $page); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | */ |
166 | 166 | public function queryForMap($statementName, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1) |
167 | 167 | { |
168 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
168 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
169 | 169 | return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max); |
170 | 170 | } |
171 | 171 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function queryForMapWithRowDelegate($statementName, $delegate, $parameter=null, $keyProperty=null, $valueProperty=null, $skip=-1, $max=-1) |
186 | 186 | { |
187 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
187 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
188 | 188 | return $statement->executeQueryForMap($this->getDbConnection(), $parameter, $keyProperty, $valueProperty, $skip, $max, $delegate); |
189 | 189 | } |
190 | 190 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function insert($statementName, $parameter=null) |
208 | 208 | { |
209 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
209 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
210 | 210 | return $statement->executeInsert($this->getDbConnection(), $parameter); |
211 | 211 | } |
212 | 212 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function update($statementName, $parameter=null) |
227 | 227 | { |
228 | - $statement = $this->getSqlMapManager()->getMappedStatement($statementName); |
|
228 | + $statement=$this->getSqlMapManager()->getMappedStatement($statementName); |
|
229 | 229 | return $statement->executeUpdate($this->getDbConnection(), $parameter); |
230 | 230 | } |
231 | 231 |
@@ -75,6 +75,6 @@ |
||
75 | 75 | * @param object The result object. |
76 | 76 | * @return object result. |
77 | 77 | */ |
78 | - public function executeQueryForObject($connection,$parameter, $result=null); |
|
78 | + public function executeQueryForObject($connection, $parameter, $result=null); |
|
79 | 79 | } |
80 | 80 |
@@ -22,15 +22,15 @@ |
||
22 | 22 | |
23 | 23 | public function __construct($mappings) |
24 | 24 | { |
25 | - $this->_mappings = $mappings; |
|
25 | + $this->_mappings=$mappings; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function replaceDynamicParameter($sql, $parameter) |
29 | 29 | { |
30 | 30 | foreach($this->_mappings as $property) |
31 | 31 | { |
32 | - $value = TPropertyAccess::get($parameter, $property); |
|
33 | - $sql = preg_replace('/'.TSimpleDynamicParser::DYNAMIC_TOKEN.'/', str_replace('$', '\$', $value), $sql, 1); |
|
32 | + $value=TPropertyAccess::get($parameter, $property); |
|
33 | + $sql=preg_replace('/'.TSimpleDynamicParser::DYNAMIC_TOKEN.'/', str_replace('$', '\$', $value), $sql, 1); |
|
34 | 34 | } |
35 | 35 | return $sql; |
36 | 36 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct(TMappedStatement $statement) |
24 | 24 | { |
25 | - $this->_mappedStatement = $statement; |
|
25 | + $this->_mappedStatement=$statement; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getID() |
@@ -40,15 +40,15 @@ discard block |
||
40 | 40 | return $this->_mappedStatement->getManager(); |
41 | 41 | } |
42 | 42 | |
43 | - public function executeQueryForMap($connection, $parameter,$keyProperty, $valueProperty=null, $skip=-1, $max=-1,$delegate=null) |
|
43 | + public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null, $skip=-1, $max=-1, $delegate=null) |
|
44 | 44 | { |
45 | - $sql = $this->createCommand($connection, $parameter, $skip, $max); |
|
46 | - $key = $this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty,$skip, $max)); |
|
47 | - $map = $this->getStatement()->getCache()->get($key); |
|
45 | + $sql=$this->createCommand($connection, $parameter, $skip, $max); |
|
46 | + $key=$this->getCacheKey(array(clone($sql), $keyProperty, $valueProperty, $skip, $max)); |
|
47 | + $map=$this->getStatement()->getCache()->get($key); |
|
48 | 48 | if($map===null) |
49 | 49 | { |
50 | - $map = $this->_mappedStatement->runQueryForMap( |
|
51 | - $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); |
|
50 | + $map=$this->_mappedStatement->runQueryForMap( |
|
51 | + $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate); |
|
52 | 52 | $this->getStatement()->getCache()->set($key, $map); |
53 | 53 | } |
54 | 54 | return $map; |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | |
67 | 67 | public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null) |
68 | 68 | { |
69 | - $sql = $this->createCommand($connection, $parameter, $skip, $max); |
|
70 | - $key = $this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); |
|
71 | - $list = $this->getStatement()->getCache()->get($key); |
|
69 | + $sql=$this->createCommand($connection, $parameter, $skip, $max); |
|
70 | + $key=$this->getCacheKey(array(clone($sql), $parameter, $skip, $max)); |
|
71 | + $list=$this->getStatement()->getCache()->get($key); |
|
72 | 72 | if($list===null) |
73 | 73 | { |
74 | - $list = $this->_mappedStatement->runQueryForList( |
|
74 | + $list=$this->_mappedStatement->runQueryForList( |
|
75 | 75 | $connection, $parameter, $sql, $result, $delegate); |
76 | 76 | $this->getStatement()->getCache()->set($key, $list); |
77 | 77 | } |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | |
81 | 81 | public function executeQueryForObject($connection, $parameter, $result=null) |
82 | 82 | { |
83 | - $sql = $this->createCommand($connection, $parameter); |
|
84 | - $key = $this->getCacheKey(array(clone($sql), $parameter)); |
|
85 | - $object = $this->getStatement()->getCache()->get($key); |
|
83 | + $sql=$this->createCommand($connection, $parameter); |
|
84 | + $key=$this->getCacheKey(array(clone($sql), $parameter)); |
|
85 | + $object=$this->getStatement()->getCache()->get($key); |
|
86 | 86 | if($object===null) |
87 | 87 | { |
88 | - $object = $this->_mappedStatement->runQueryForObject($connection, $sql, $result); |
|
88 | + $object=$this->_mappedStatement->runQueryForObject($connection, $sql, $result); |
|
89 | 89 | $this->getStatement()->getCache()->set($key, $object); |
90 | 90 | } |
91 | 91 | return $object; |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | protected function getCacheKey($object) |
95 | 95 | { |
96 | - $cacheKey = new TSqlMapCacheKey($object); |
|
96 | + $cacheKey=new TSqlMapCacheKey($object); |
|
97 | 97 | return $cacheKey->getHash(); |
98 | 98 | } |
99 | 99 |
@@ -20,18 +20,18 @@ |
||
20 | 20 | { |
21 | 21 | private $_statement; |
22 | 22 | private $_preparedStatement; |
23 | - private $_parameterPrefix = 'param'; |
|
23 | + private $_parameterPrefix='param'; |
|
24 | 24 | private $_commandText; |
25 | 25 | |
26 | 26 | public function __construct($statement, $sqlString) |
27 | 27 | { |
28 | - $this->_statement = $statement; |
|
29 | - $this->_commandText = $sqlString; |
|
28 | + $this->_statement=$statement; |
|
29 | + $this->_commandText=$sqlString; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function prepare() |
33 | 33 | { |
34 | - $this->_preparedStatement = new TPreparedStatement(); |
|
34 | + $this->_preparedStatement=new TPreparedStatement(); |
|
35 | 35 | $this->_preparedStatement->setPreparedSql($this->_commandText); |
36 | 36 | if($this->_statement->parameterMap()!==null) |
37 | 37 | $this->createParametersForTextCommand(); |
@@ -22,33 +22,33 @@ |
||
22 | 22 | private $_parameterNames; |
23 | 23 | private $_parameterValues; |
24 | 24 | |
25 | - public function getPreparedSql(){ return $this->_sqlString; } |
|
26 | - public function setPreparedSql($value){ $this->_sqlString = $value; } |
|
25 | + public function getPreparedSql() { return $this->_sqlString; } |
|
26 | + public function setPreparedSql($value) { $this->_sqlString=$value; } |
|
27 | 27 | |
28 | - public function getParameterNames($needed = true) |
|
28 | + public function getParameterNames($needed=true) |
|
29 | 29 | { |
30 | - if (!$this->_parameterNames and $needed) |
|
31 | - $this->_parameterNames = new TList; |
|
30 | + if(!$this->_parameterNames and $needed) |
|
31 | + $this->_parameterNames=new TList; |
|
32 | 32 | return $this->_parameterNames; |
33 | 33 | } |
34 | 34 | |
35 | - public function setParameterNames($value){ $this->_parameterNames = $value; } |
|
35 | + public function setParameterNames($value) { $this->_parameterNames=$value; } |
|
36 | 36 | |
37 | - public function getParameterValues($needed = true) |
|
37 | + public function getParameterValues($needed=true) |
|
38 | 38 | { |
39 | - if (!$this->_parameterValues and $needed) |
|
39 | + if(!$this->_parameterValues and $needed) |
|
40 | 40 | $this->_parameterValues=new TMap; |
41 | 41 | return $this->_parameterValues; |
42 | 42 | } |
43 | 43 | |
44 | - public function setParameterValues($value){ $this->_parameterValues = $value; } |
|
44 | + public function setParameterValues($value) { $this->_parameterValues=$value; } |
|
45 | 45 | |
46 | 46 | public function __sleep() |
47 | 47 | { |
48 | - $exprops = array(); $cn = __CLASS__; |
|
49 | - if (!$this->_parameterNames or !$this->_parameterNames->getCount()) $exprops[] = "\0$cn\0_parameterNames"; |
|
50 | - if (!$this->_parameterValues or !$this->_parameterValues->getCount()) $exprops[] = "\0$cn\0_parameterValues"; |
|
51 | - return array_diff(parent::__sleep(),$exprops); |
|
48 | + $exprops=array(); $cn=__CLASS__; |
|
49 | + if(!$this->_parameterNames or !$this->_parameterNames->getCount()) $exprops[]="\0$cn\0_parameterNames"; |
|
50 | + if(!$this->_parameterValues or !$this->_parameterValues->getCount()) $exprops[]="\0$cn\0_parameterValues"; |
|
51 | + return array_diff(parent::__sleep(), $exprops); |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 |
@@ -21,45 +21,45 @@ |
||
21 | 21 | */ |
22 | 22 | class TPreparedCommand |
23 | 23 | { |
24 | - public function create(TSqlMapManager $manager, $connection, $statement, $parameterObject,$skip=null,$max=null) |
|
24 | + public function create(TSqlMapManager $manager, $connection, $statement, $parameterObject, $skip=null, $max=null) |
|
25 | 25 | { |
26 | - $sqlText = $statement->getSQLText(); |
|
26 | + $sqlText=$statement->getSQLText(); |
|
27 | 27 | |
28 | - $prepared = $sqlText->getPreparedStatement($parameterObject); |
|
28 | + $prepared=$sqlText->getPreparedStatement($parameterObject); |
|
29 | 29 | $connection->setActive(true); |
30 | - $sql = $prepared->getPreparedSql(); |
|
30 | + $sql=$prepared->getPreparedSql(); |
|
31 | 31 | |
32 | 32 | if($sqlText instanceof TSimpleDynamicSql) |
33 | - $sql = $sqlText->replaceDynamicParameter($sql, $parameterObject); |
|
33 | + $sql=$sqlText->replaceDynamicParameter($sql, $parameterObject); |
|
34 | 34 | |
35 | 35 | if($max!==null || $skip!==null) |
36 | 36 | { |
37 | - $builder = TDbMetaData::getInstance($connection)->createCommandBuilder(); |
|
38 | - $sql = $builder->applyLimitOffset($sql,$max,$skip); |
|
37 | + $builder=TDbMetaData::getInstance($connection)->createCommandBuilder(); |
|
38 | + $sql=$builder->applyLimitOffset($sql, $max, $skip); |
|
39 | 39 | } |
40 | - $command = $connection->createCommand($sql); |
|
40 | + $command=$connection->createCommand($sql); |
|
41 | 41 | $this->applyParameterMap($manager, $command, $prepared, $statement, $parameterObject); |
42 | 42 | |
43 | 43 | return $command; |
44 | 44 | } |
45 | 45 | |
46 | - protected function applyParameterMap($manager,$command,$prepared, $statement, $parameterObject) |
|
46 | + protected function applyParameterMap($manager, $command, $prepared, $statement, $parameterObject) |
|
47 | 47 | { |
48 | - $properties = $prepared->getParameterNames(false); |
|
48 | + $properties=$prepared->getParameterNames(false); |
|
49 | 49 | //$parameters = $prepared->getParameterValues(); |
50 | 50 | $registry=$manager->getTypeHandlers(); |
51 | - if ($properties) |
|
52 | - for($i = 0, $k=$properties->getCount(); $i<$k; $i++) |
|
51 | + if($properties) |
|
52 | + for($i=0, $k=$properties->getCount(); $i < $k; $i++) |
|
53 | 53 | { |
54 | - $property = $statement->parameterMap()->getProperty($i); |
|
55 | - $value = $statement->parameterMap()->getPropertyValue($registry,$property, $parameterObject); |
|
56 | - $dbType = $property->getDbType(); |
|
54 | + $property=$statement->parameterMap()->getProperty($i); |
|
55 | + $value=$statement->parameterMap()->getPropertyValue($registry, $property, $parameterObject); |
|
56 | + $dbType=$property->getDbType(); |
|
57 | 57 | if($dbType=='') //relies on PHP lax comparison |
58 | - $command->bindValue($i+1,$value, TDbCommandBuilder::getPdoType($value)); |
|
58 | + $command->bindValue($i + 1, $value, TDbCommandBuilder::getPdoType($value)); |
|
59 | 59 | else if(strpos($dbType, 'PDO::')===0) |
60 | - $command->bindValue($i+1,$value, constant($property->getDbType())); //assumes PDO types, e.g. PDO::PARAM_INT |
|
60 | + $command->bindValue($i + 1, $value, constant($property->getDbType())); //assumes PDO types, e.g. PDO::PARAM_INT |
|
61 | 61 | else |
62 | - $command->bindValue($i+1,$value); |
|
62 | + $command->bindValue($i + 1, $value); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | } |
@@ -22,8 +22,8 @@ |
||
22 | 22 | |
23 | 23 | public function buildPreparedStatement($statement, $sqlString) |
24 | 24 | { |
25 | - $factory = new TPreparedStatementFactory($statement, $sqlString); |
|
26 | - $this->_preparedStatement = $factory->prepare(); |
|
25 | + $factory=new TPreparedStatementFactory($statement, $sqlString); |
|
26 | + $this->_preparedStatement=$factory->prepare(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | public function getPreparedStatement($parameter=null) |