@@ -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 | } |
@@ -26,6 +26,9 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class TPreparedCommand |
| 28 | 28 | { |
| 29 | + /** |
|
| 30 | + * @param \Prado\Data\SqlMap\Configuration\TSqlMapStatement $statement |
|
| 31 | + */ |
|
| 29 | 32 | public function create(TSqlMapManager $manager, $connection, $statement, $parameterObject,$skip=null,$max=null) |
| 30 | 33 | { |
| 31 | 34 | $sqlText = $statement->getSQLText(); |
@@ -48,6 +51,9 @@ discard block |
||
| 48 | 51 | return $command; |
| 49 | 52 | } |
| 50 | 53 | |
| 54 | + /** |
|
| 55 | + * @param TSqlMapManager $manager |
|
| 56 | + */ |
|
| 51 | 57 | protected function applyParameterMap($manager,$command,$prepared, $statement, $parameterObject) |
| 52 | 58 | { |
| 53 | 59 | $properties = $prepared->getParameterNames(false); |
@@ -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) |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function registerTypeHandler(TSqlMapTypeHandler $handler) |
| 49 | 49 | { |
| 50 | - $this->_typeHandlers[$handler->getType()] = $handler; |
|
| 50 | + $this->_typeHandlers[$handler->getType()]=$handler; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** |
@@ -90,13 +90,13 @@ discard block |
||
| 90 | 90 | switch(strtolower($type)) |
| 91 | 91 | { |
| 92 | 92 | case 'integer': case 'int': |
| 93 | - $type = 'integer'; break; |
|
| 93 | + $type='integer'; break; |
|
| 94 | 94 | case 'float': case 'double': case 'decimal': |
| 95 | - $type = 'float'; break; |
|
| 95 | + $type='float'; break; |
|
| 96 | 96 | case 'boolean': case 'bool': |
| 97 | - $type = 'boolean'; break; |
|
| 97 | + $type='boolean'; break; |
|
| 98 | 98 | case 'string' : |
| 99 | - $type = 'string'; break; |
|
| 99 | + $type='string'; break; |
|
| 100 | 100 | default: |
| 101 | 101 | return $value; |
| 102 | 102 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public function __construct($cacheModel=null) |
| 28 | 28 | { |
| 29 | - $this->_cacheModel = $cacheModel; |
|
| 29 | + $this->_cacheModel=$cacheModel; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | protected function getBaseKeyKeyName() |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | protected function getBaseKey() |
| 38 | 38 | { |
| 39 | - $cache = $this->getCache(); |
|
| 40 | - $keyname = $this->getBaseKeyKeyName(); |
|
| 41 | - $basekey = $cache->get($keyname); |
|
| 42 | - if (!$basekey) |
|
| 39 | + $cache=$this->getCache(); |
|
| 40 | + $keyname=$this->getBaseKeyKeyName(); |
|
| 41 | + $basekey=$cache->get($keyname); |
|
| 42 | + if(!$basekey) |
|
| 43 | 43 | { |
| 44 | - $basekey = DxUtil::generateRandomHash(8); |
|
| 45 | - $cache->set($keyname,$basekey); |
|
| 44 | + $basekey=DxUtil::generateRandomHash(8); |
|
| 45 | + $cache->set($keyname, $basekey); |
|
| 46 | 46 | } |
| 47 | 47 | return $basekey; |
| 48 | 48 | } |
@@ -64,23 +64,23 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | public function get($key) |
| 66 | 66 | { |
| 67 | - $result = $this->getCache()->get($this->getCacheKey($key)); |
|
| 68 | - return $result === false ? null : $result; |
|
| 67 | + $result=$this->getCache()->get($this->getCacheKey($key)); |
|
| 68 | + return $result===false ? null : $result; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - public function set($key, $value,$expire=0,$dependency=null) |
|
| 71 | + public function set($key, $value, $expire=0, $dependency=null) |
|
| 72 | 72 | { |
| 73 | - $this->getCache()->set($this->getCacheKey($key), $value, $expire,$dependency); |
|
| 73 | + $this->getCache()->set($this->getCacheKey($key), $value, $expire, $dependency); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | protected function getCache() |
| 77 | 77 | { |
| 78 | - if (!$this->_cache) |
|
| 79 | - $this->_cache = Prado::getApplication()->getCache(); |
|
| 78 | + if(!$this->_cache) |
|
| 79 | + $this->_cache=Prado::getApplication()->getCache(); |
|
| 80 | 80 | return $this->_cache; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - public function add($id,$value,$expire=0,$dependency=null) |
|
| 83 | + public function add($id, $value, $expire=0, $dependency=null) |
|
| 84 | 84 | { |
| 85 | 85 | throw new TSqlMapException('sqlmap_use_set_to_store_cache'); |
| 86 | 86 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | class TSimpleDynamicParser |
| 21 | 21 | { |
| 22 | - const PARAMETER_TOKEN_REGEXP = '/\$([^\$]+)\$/'; |
|
| 23 | - const DYNAMIC_TOKEN = '`!`'; |
|
| 22 | + const PARAMETER_TOKEN_REGEXP='/\$([^\$]+)\$/'; |
|
| 23 | + const DYNAMIC_TOKEN='`!`'; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Parse the sql text for dynamic place holders of the form $name$. |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function parse($sqlText) |
| 31 | 31 | { |
| 32 | - $matches = array(); |
|
| 33 | - $mappings = array(); |
|
| 32 | + $matches=array(); |
|
| 33 | + $mappings=array(); |
|
| 34 | 34 | preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); |
| 35 | - for($i = 0, $k=count($matches[1]); $i<$k; $i++) |
|
| 35 | + for($i=0, $k=count($matches[1]); $i < $k; $i++) |
|
| 36 | 36 | { |
| 37 | - $mappings[] = $matches[1][$i]; |
|
| 38 | - $sqlText = str_replace($matches[0][$i], self::DYNAMIC_TOKEN, $sqlText); |
|
| 37 | + $mappings[]=$matches[1][$i]; |
|
| 38 | + $sqlText=str_replace($matches[0][$i], self::DYNAMIC_TOKEN, $sqlText); |
|
| 39 | 39 | } |
| 40 | 40 | return array('sql'=>$sqlText, 'parameters'=>$mappings); |
| 41 | 41 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * Regular expression for parsing inline parameter maps. |
| 27 | 27 | */ |
| 28 | - const PARAMETER_TOKEN_REGEXP = '/#([^#]+)#/'; |
|
| 28 | + const PARAMETER_TOKEN_REGEXP='/#([^#]+)#/'; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Parse the sql text for inline parameters. |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function parse($sqlText, $scope) |
| 37 | 37 | { |
| 38 | - $matches = array(); |
|
| 39 | - $mappings = array(); |
|
| 38 | + $matches=array(); |
|
| 39 | + $mappings=array(); |
|
| 40 | 40 | preg_match_all(self::PARAMETER_TOKEN_REGEXP, $sqlText, $matches); |
| 41 | 41 | |
| 42 | - for($i = 0, $k=count($matches[1]); $i<$k; $i++) |
|
| 42 | + for($i=0, $k=count($matches[1]); $i < $k; $i++) |
|
| 43 | 43 | { |
| 44 | - $mappings[] = $this->parseMapping($matches[1][$i], $scope); |
|
| 45 | - $sqlText = str_replace($matches[0][$i], '?', $sqlText); |
|
| 44 | + $mappings[]=$this->parseMapping($matches[1][$i], $scope); |
|
| 45 | + $sqlText=str_replace($matches[0][$i], '?', $sqlText); |
|
| 46 | 46 | } |
| 47 | 47 | return array('sql'=>$sqlText, 'parameters'=>$mappings); |
| 48 | 48 | } |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | protected function parseMapping($token, $scope) |
| 57 | 57 | { |
| 58 | - $mapping = new TParameterProperty; |
|
| 59 | - $properties = explode(',', $token); |
|
| 58 | + $mapping=new TParameterProperty; |
|
| 59 | + $properties=explode(',', $token); |
|
| 60 | 60 | $mapping->setProperty(trim(array_shift($properties))); |
| 61 | 61 | foreach($properties as $property) |
| 62 | 62 | { |
| 63 | - $prop = explode('=',$property); |
|
| 64 | - $name = trim($prop[0]); $value=trim($prop[1]); |
|
| 63 | + $prop=explode('=', $property); |
|
| 64 | + $name=trim($prop[0]); $value=trim($prop[1]); |
|
| 65 | 65 | if($mapping->canSetProperty($name)) |
| 66 | 66 | $mapping->{'set'.$name}($value); |
| 67 | 67 | else |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | public function bindColumn($column, &$value, $dataType=null) |
| 64 | 64 | { |
| 65 | 65 | if($dataType===null) |
| 66 | - $this->_statement->bindColumn($column,$value); |
|
| 66 | + $this->_statement->bindColumn($column, $value); |
|
| 67 | 67 | else |
| 68 | - $this->_statement->bindColumn($column,$value,$dataType); |
|
| 68 | + $this->_statement->bindColumn($column, $value, $dataType); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public function setFetchMode($mode) |
| 75 | 75 | { |
| 76 | 76 | $params=func_get_args(); |
| 77 | - call_user_func_array(array($this->_statement,'setFetchMode'),$params); |
|
| 77 | + call_user_func_array(array($this->_statement, 'setFetchMode'), $params); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | * @param array list of column names whose values are to be passed as parameters in the constructor of the class being created |
| 103 | 103 | * @return mixed|false the populated object, false if no more row of data available |
| 104 | 104 | */ |
| 105 | - public function readObject($className,$fields) |
|
| 105 | + public function readObject($className, $fields) |
|
| 106 | 106 | { |
| 107 | - return $this->_statement->fetchObject($className,$fields); |
|
| 107 | + return $this->_statement->fetchObject($className, $fields); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | */ |
| 172 | 172 | public function rewind() |
| 173 | 173 | { |
| 174 | - if($this->_index<0) |
|
| 174 | + if($this->_index < 0) |
|
| 175 | 175 | { |
| 176 | 176 | $this->_row=$this->_statement->fetch(); |
| 177 | 177 | $this->_index=0; |
@@ -179,8 +179,7 @@ |
||
| 179 | 179 | { |
| 180 | 180 | $this->_row=$this->_statement->fetch(); |
| 181 | 181 | $this->_index=0; |
| 182 | - } |
|
| 183 | - else |
|
| 182 | + } else |
|
| 184 | 183 | throw new TDbException('dbdatareader_rewind_invalid'); |
| 185 | 184 | } |
| 186 | 185 | |
@@ -109,8 +109,7 @@ discard block |
||
| 109 | 109 | try |
| 110 | 110 | { |
| 111 | 111 | $this->_statement=$this->getConnection()->getPdoInstance()->prepare($this->getText()); |
| 112 | - } |
|
| 113 | - catch(Exception $e) |
|
| 112 | + } catch(Exception $e) |
|
| 114 | 113 | { |
| 115 | 114 | throw new TDbException('dbcommand_prepare_failed',$e->getMessage(),$this->getText()); |
| 116 | 115 | } |
@@ -186,11 +185,9 @@ discard block |
||
| 186 | 185 | { |
| 187 | 186 | $this->_statement->execute(); |
| 188 | 187 | return $this->_statement->rowCount(); |
| 189 | - } |
|
| 190 | - else |
|
| 188 | + } else |
|
| 191 | 189 | return $this->getConnection()->getPdoInstance()->exec($this->getText()); |
| 192 | - } |
|
| 193 | - catch(Exception $e) |
|
| 190 | + } catch(Exception $e) |
|
| 194 | 191 | { |
| 195 | 192 | throw new TDbException('dbcommand_execute_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 196 | 193 | } |
@@ -223,8 +220,7 @@ discard block |
||
| 223 | 220 | else |
| 224 | 221 | $this->_statement=$this->getConnection()->getPdoInstance()->query($this->getText()); |
| 225 | 222 | return new TDbDataReader($this); |
| 226 | - } |
|
| 227 | - catch(Exception $e) |
|
| 223 | + } catch(Exception $e) |
|
| 228 | 224 | { |
| 229 | 225 | throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 230 | 226 | } |
@@ -250,8 +246,7 @@ discard block |
||
| 250 | 246 | $result=$this->_statement->fetch($fetchAssociative ? PDO::FETCH_ASSOC : PDO::FETCH_NUM); |
| 251 | 247 | $this->_statement->closeCursor(); |
| 252 | 248 | return $result; |
| 253 | - } |
|
| 254 | - catch(Exception $e) |
|
| 249 | + } catch(Exception $e) |
|
| 255 | 250 | { |
| 256 | 251 | throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 257 | 252 | } |
@@ -279,8 +274,7 @@ discard block |
||
| 279 | 274 | return stream_get_contents($result); |
| 280 | 275 | else |
| 281 | 276 | return $result; |
| 282 | - } |
|
| 283 | - catch(Exception $e) |
|
| 277 | + } catch(Exception $e) |
|
| 284 | 278 | { |
| 285 | 279 | throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
| 286 | 280 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param TDbConnection the database connection |
| 46 | 46 | * @param string the SQL statement to be executed |
| 47 | 47 | */ |
| 48 | - public function __construct(TDbConnection $connection,$text) |
|
| 48 | + public function __construct(TDbConnection $connection, $text) |
|
| 49 | 49 | { |
| 50 | 50 | $this->_connection=$connection; |
| 51 | 51 | $this->setText($text); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function __sleep() |
| 58 | 58 | { |
| 59 | - return array_diff(parent::__sleep(),array("\0TDbCommand\0_statement")); |
|
| 59 | + return array_diff(parent::__sleep(), array("\0TDbCommand\0_statement")); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | } |
| 113 | 113 | catch(Exception $e) |
| 114 | 114 | { |
| 115 | - throw new TDbException('dbcommand_prepare_failed',$e->getMessage(),$this->getText()); |
|
| 115 | + throw new TDbException('dbcommand_prepare_failed', $e->getMessage(), $this->getText()); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | { |
| 143 | 143 | $this->prepare(); |
| 144 | 144 | if($dataType===null) |
| 145 | - $this->_statement->bindParam($name,$value); |
|
| 145 | + $this->_statement->bindParam($name, $value); |
|
| 146 | 146 | else if($length===null) |
| 147 | - $this->_statement->bindParam($name,$value,$dataType); |
|
| 147 | + $this->_statement->bindParam($name, $value, $dataType); |
|
| 148 | 148 | else |
| 149 | - $this->_statement->bindParam($name,$value,$dataType,$length); |
|
| 149 | + $this->_statement->bindParam($name, $value, $dataType, $length); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -163,9 +163,9 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $this->prepare(); |
| 165 | 165 | if($dataType===null) |
| 166 | - $this->_statement->bindValue($name,$value); |
|
| 166 | + $this->_statement->bindValue($name, $value); |
|
| 167 | 167 | else |
| 168 | - $this->_statement->bindValue($name,$value,$dataType); |
|
| 168 | + $this->_statement->bindValue($name, $value, $dataType); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | } |
| 193 | 193 | catch(Exception $e) |
| 194 | 194 | { |
| 195 | - throw new TDbException('dbcommand_execute_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
| 195 | + throw new TDbException('dbcommand_execute_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | } |
| 227 | 227 | catch(Exception $e) |
| 228 | 228 | { |
| 229 | - throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
| 229 | + throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | catch(Exception $e) |
| 255 | 255 | { |
| 256 | - throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
| 256 | + throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
| 257 | 257 | } |
| 258 | 258 | } |
| 259 | 259 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | catch(Exception $e) |
| 284 | 284 | { |
| 285 | - throw new TDbException('dbcommand_query_failed',$e->getMessage(),$this->getDebugStatementText()); |
|
| 285 | + throw new TDbException('dbcommand_query_failed', $e->getMessage(), $this->getDebugStatementText()); |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
@@ -165,6 +165,7 @@ discard block |
||
| 165 | 165 | * placeholders, this will be the 1-indexed position of the parameter. |
| 166 | 166 | * @param mixed The value to bind to the parameter |
| 167 | 167 | * @param int SQL data type of the parameter |
| 168 | + * @param string $name |
|
| 168 | 169 | * @see http://www.php.net/manual/en/function.PDOStatement-bindValue.php |
| 169 | 170 | */ |
| 170 | 171 | public function bindValue($name, $value, $dataType=null) |
@@ -269,7 +270,7 @@ discard block |
||
| 269 | 270 | * Executes the SQL statement and returns the value of the first column in the first row of data. |
| 270 | 271 | * This is a convenient method of {@link query} when only a single scalar |
| 271 | 272 | * value is needed (e.g. obtaining the count of the records). |
| 272 | - * @return mixed the value of the first column in the first row of the query result. False is returned if there is no value. |
|
| 273 | + * @return string the value of the first column in the first row of the query result. False is returned if there is no value. |
|
| 273 | 274 | * @throws TDbException execution failed |
| 274 | 275 | */ |
| 275 | 276 | public function queryScalar() |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | if(!extension_loaded('apc')) |
| 57 | 57 | throw new TConfigurationException('apccache_extension_required'); |
| 58 | 58 | |
| 59 | - if(ini_get('apc.enabled') == false) |
|
| 59 | + if(ini_get('apc.enabled')==false) |
|
| 60 | 60 | throw new TConfigurationException('apccache_extension_not_enabled'); |
| 61 | 61 | |
| 62 | - if(substr(php_sapi_name(), 0, 3) === 'cli' and ini_get('apc.enable_cli') == false) |
|
| 62 | + if(substr(php_sapi_name(), 0, 3)==='cli' and ini_get('apc.enable_cli')==false) |
|
| 63 | 63 | throw new TConfigurationException('apccache_extension_not_enabled_cli'); |
| 64 | 64 | |
| 65 | 65 | parent::init($config); |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
| 86 | 86 | * @return boolean true if the value is successfully stored into cache, false otherwise |
| 87 | 87 | */ |
| 88 | - protected function setValue($key,$value,$expire) |
|
| 88 | + protected function setValue($key, $value, $expire) |
|
| 89 | 89 | { |
| 90 | - return apc_store($key,$value,$expire); |
|
| 90 | + return apc_store($key, $value, $expire); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * @param integer the number of seconds in which the cached value will expire. 0 means never expire. |
| 100 | 100 | * @return boolean true if the value is successfully stored into cache, false otherwise |
| 101 | 101 | */ |
| 102 | - protected function addValue($key,$value,$expire) |
|
| 102 | + protected function addValue($key, $value, $expire) |
|
| 103 | 103 | { |
| 104 | - return apc_add($key,$value,$expire); |
|
| 104 | + return apc_add($key, $value, $expire); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |