Changeset 874 for trunk/Packages/Common/Database.php
- Timestamp:
- Apr 6, 2020, 11:56:19 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Database.php
r873 r874 7 7 { 8 8 list($usec, $sec) = explode(" ", microtime()); 9 return ( (float)$usec + (float)$sec);9 return (float)$usec + (float)$sec; 10 10 } 11 11 … … 17 17 function fetch_assoc() 18 18 { 19 return ($this->PDOStatement->fetch(PDO::FETCH_ASSOC));19 return $this->PDOStatement->fetch(PDO::FETCH_ASSOC); 20 20 } 21 21 22 22 function fetch_array() 23 23 { 24 return ($this->PDOStatement->fetch(PDO::FETCH_BOTH));24 return $this->PDOStatement->fetch(PDO::FETCH_BOTH); 25 25 } 26 26 27 27 function fetch_row() 28 28 { 29 return ($this->PDOStatement->fetch(PDO::FETCH_NUM));29 return $this->PDOStatement->fetch(PDO::FETCH_NUM); 30 30 } 31 31 } … … 81 81 function Connected() 82 82 { 83 return (isset($this->PDO));83 return isset($this->PDO); 84 84 } 85 85 … … 119 119 throw new Exception('SQL Error: '.$this->Error.', Query: '.$Query); 120 120 } 121 return ($Result);121 return $Result; 122 122 } 123 123 124 124 function select($Table, $What = '*', $Condition = 1) 125 125 { 126 return ($this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition));126 return $this->query('SELECT '.$What.' FROM `'.$this->Prefix.$Table.'` WHERE '.$Condition); 127 127 } 128 128 … … 154 154 $Name = substr($Name, 1); 155 155 $Values = substr($Values, 1); 156 return ('INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')');156 return 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'; 157 157 } 158 158 … … 175 175 } 176 176 $Values = substr($Values, 2); 177 return ('UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')');177 return 'UPDATE `'.$this->Prefix.$Table.'` SET '.$Values.' WHERE ('.$Condition.')'; 178 178 } 179 179 … … 206 206 function real_escape_string($Text) 207 207 { 208 return (addslashes($Text));208 return addslashes($Text); 209 209 } 210 210 211 211 function quote($Text) 212 212 { 213 return ($this->PDO->quote($Text));213 return $this->PDO->quote($Text); 214 214 } 215 215 … … 239 239 function TimeToMysqlDateTime($Time) 240 240 { 241 if ($Time == NULL) return (NULL);242 else return (date('Y-m-d H:i:s', $Time));241 if ($Time == NULL) return NULL; 242 else return date('Y-m-d H:i:s', $Time); 243 243 } 244 244 245 245 function TimeToMysqlDate($Time) 246 246 { 247 if ($Time == NULL) return (NULL);248 else return (date('Y-m-d', $Time));247 if ($Time == NULL) return NULL; 248 else return date('Y-m-d', $Time); 249 249 } 250 250 251 251 function TimeToMysqlTime($Time) 252 252 { 253 if ($Time == NULL) return (NULL);254 else return (date('H:i:s', $Time));253 if ($Time == NULL) return NULL; 254 else return date('H:i:s', $Time); 255 255 } 256 256 257 257 function MysqlDateTimeToTime($DateTime) 258 258 { 259 if ($DateTime == '') return (NULL);259 if ($DateTime == '') return NULL; 260 260 $Parts = explode(' ', $DateTime); 261 261 $DateParts = explode('-', $Parts[0]); 262 262 $TimeParts = explode(':', $Parts[1]); 263 263 $Result = mktime($TimeParts[0], $TimeParts[1], $TimeParts[2], $DateParts[1], $DateParts[2], $DateParts[0]); 264 return ($Result);264 return $Result; 265 265 } 266 266 267 267 function MysqlDateToTime($Date) 268 268 { 269 if ($Date == '') return (NULL);270 return (MysqlDateTimeToTime($Date.' 0:0:0'));269 if ($Date == '') return NULL; 270 return MysqlDateTimeToTime($Date.' 0:0:0'); 271 271 } 272 272 273 273 function MysqlTimeToTime($Time) 274 274 { 275 if ($Time == '') return (NULL);276 return (MysqlDateTimeToTime('0000-00-00 '.$Time));277 } 275 if ($Time == '') return NULL; 276 return MysqlDateTimeToTime('0000-00-00 '.$Time); 277 }
Note:
See TracChangeset
for help on using the changeset viewer.