| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/dbal/src/drivers/lmbDbBaseRecord.class.php'); 10 11 /** 12 * class lmbSqliteRecord. 13 * 14 * @package dbal 15 * @version $Id$ 16 */ 17 class lmbSqliteRecord extends lmbDbBaseRecord 18 { 19 protected $properties = array(); 20 21 function __construct($data = array()) 22 { 23 $this->properties = $data; 24 } 25 26 function get($name) 27 { 28 if(isset($this->properties[$name])) 29 return $this->properties[$name]; 30 } 31 32 function set($name, $value) 33 { 34 $this->properties[$name] = $value; 35 } 36 37 function export() 38 { 39 return $this->properties; 40 } 41 42 function import($values) 43 { 44 $this->properties = $values; 45 } 46 47 function importRaw($values) 48 { 49 $this->properties = array(); 50 51 foreach($values as $key => $value) 52 { 53 //hack for converting 'foo.bar' keys into 'bar' 54 if(($pos = strpos($key, '.')) !== false) 55 $key = substr($key, $pos+1); 56 57 //hack for stripping escaping " symbols 58 $this->properties[trim($key, '"')] = $value; 59 } 60 } 61 62 function remove($name) 63 { 64 if(isset($this->properties[$name])) 65 unset($this->properties[$name]); 66 } 67 68 function has($name) 69 { 70 return isset($this->properties[$name]); 71 } 72 73 function reset() 74 { 75 $this->properties = array(); 76 } 77 78 function getInteger($name) 79 { 80 $value = $this->get($name); 81 return is_null($value) ? null : (int) $value; 82 } 83 84 function getFloat($name) 85 { 86 $value = $this->get($name); 87 return is_null($value) ? null : (float) $value; 88 } 89 90 function getString($name) 91 { 92 $value = $this->get($name); 93 return is_null($value) ? null : (string) $value; 94 } 95 96 function getBoolean($name) 97 { 98 $value = $this->get($name); 99 return is_null($value) ? null : (boolean) $value; 100 } 101 102 function getIntegerTimeStamp($name) 103 { 104 $value = $this->get($name); 105 if(is_integer($value)) 106 return $value; 107 else if(is_string($value)) 108 { 109 $ts = strtotime($value); 110 if($ts === -1) 111 { 112 if(preg_match('/([\d]{4})([\d]{2})([\d]{2})([\d]{2})([\d]{2})([\d]{2})/', $value, $matches)) 113 return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); 114 } 115 else 116 return $ts; 117 } 118 } 119 120 function _getDate($name, $format) 121 { 122 $value = $this->get($name); 123 if(is_integer($value)) 124 return date($format, $value); 125 else 126 return $value; 127 } 128 129 function getStringDate($name) 130 { 131 return $this->_getDate($name, 'Y-m-d'); 132 } 133 134 function getStringTime($name) 135 { 136 return $this->_getDate($name, 'H:i:s'); 137 } 138 139 function getStringTimeStamp($name) 140 { 141 return $this->_getDate($name, 'Y-m-d H:i:s'); 142 } 143 144 function getStringFixed($name) 145 { 146 $value = $this->get($name); 147 return is_null($value) ? null : (string) $value; 148 } 149 150 function getBlob($name) 151 { 152 return $this->get($name); 153 } 154 155 function getClob($name) 156 { 157 return $this->get($name); 158 } 159 } 160 161 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Tue Oct 7 05:02:03 2008 | Cross-referenced by PHPXref 0.7 |