[ Index ] |
|
Code source de PRADO 3.0.6 |
1 <?php 2 /** 3 * TDataSourceSelectParameters, TDataSourceView, TReadOnlyDataSourceView class file 4 * 5 * @author Qiang Xue <qiang.xue@gmail.com> 6 * @link http://www.pradosoft.com/ 7 * @copyright Copyright © 2005 PradoSoft 8 * @license http://www.pradosoft.com/license/ 9 * @version $Id: TDataSourceView.php 1397 2006-09-07 07:55:53Z wei $ 10 * @package System.Web.UI.WebControls 11 */ 12 13 /** 14 * TDataSourceSelectParameters class 15 * 16 * @author Qiang Xue <qiang.xue@gmail.com> 17 * @version $Id: TDataSourceView.php 1397 2006-09-07 07:55:53Z wei $ 18 * @package System.Web.UI.WebControls 19 * @since 3.0 20 */ 21 class TDataSourceSelectParameters extends TComponent 22 { 23 private $_retrieveTotalRowCount=false; 24 private $_startRowIndex=0; 25 private $_totalRowCount=0; 26 private $_maximumRows=0; 27 28 public function getStartRowIndex() 29 { 30 return $this->_startRowIndex; 31 } 32 33 public function setStartRowIndex($value) 34 { 35 if(($value=TPropertyValue::ensureInteger($value))<0) 36 $value=0; 37 $this->_startRowIndex=$value; 38 } 39 40 public function getMaximumRows() 41 { 42 return $this->_maximumRows; 43 } 44 45 public function setMaximumRows($value) 46 { 47 if(($value=TPropertyValue::ensureInteger($value))<0) 48 $value=0; 49 $this->_maximumRows=$value; 50 } 51 52 public function getRetrieveTotalRowCount() 53 { 54 return $this->_retrieveTotalRowCount; 55 } 56 57 public function setRetrieveTotalRowCount($value) 58 { 59 $this->_retrieveTotalRowCount=TPropertyValue::ensureBoolean($value); 60 } 61 62 public function getTotalRowCount() 63 { 64 return $this->_totalRowCount; 65 } 66 67 public function setTotalRowCount($value) 68 { 69 if(($value=TPropertyValue::ensureInteger($value))<0) 70 $value=0; 71 $this->_totalRowCount=$value; 72 } 73 } 74 75 /** 76 * TDataSourceView class 77 * 78 * @author Qiang Xue <qiang.xue@gmail.com> 79 * @version $Id: TDataSourceView.php 1397 2006-09-07 07:55:53Z wei $ 80 * @package System.Web.UI.WebControls 81 * @since 3.0 82 */ 83 abstract class TDataSourceView extends TComponent 84 { 85 private $_owner; 86 private $_name; 87 88 public function __construct(IDataSource $owner,$viewName) 89 { 90 $this->_owner=$owner; 91 $this->_name=$viewName; 92 } 93 94 /** 95 * Performs DB selection based on specified parameters. 96 * @param ??? 97 * @return Traversable 98 */ 99 abstract public function select($parameters); 100 101 /** 102 * Inserts a DB record. 103 * @param array|TMap 104 * @return integer affected rows 105 */ 106 public function insertAt($values) 107 { 108 throw new TNotSupportedException('datasourceview_insert_unsupported'); 109 } 110 111 /** 112 * Updates DB record(s) with the specified keys and new values 113 * @param array|TMap keys for specifying the records to be updated 114 * @param array|TMap new values 115 * @return integer affected rows 116 */ 117 public function update($keys,$values) 118 { 119 throw new TNotSupportedException('datasourceview_update_unsupported'); 120 } 121 122 /** 123 * Deletes DB row(s) with the specified keys. 124 * @param array|TMap keys for specifying the rows to be deleted 125 * @return integer affected rows 126 */ 127 public function delete($keys) 128 { 129 throw new TNotSupportedException('datasourceview_delete_unsupported'); 130 } 131 132 public function getCanDelete() 133 { 134 return false; 135 } 136 137 public function getCanInsert() 138 { 139 return false; 140 } 141 142 public function getCanPage() 143 { 144 return false; 145 } 146 147 public function getCanGetRowCount() 148 { 149 return false; 150 } 151 152 public function getCanSort() 153 { 154 return false; 155 } 156 157 public function getCanUpdate() 158 { 159 return false; 160 } 161 162 public function getName() 163 { 164 return $this->_name; 165 } 166 167 public function getDataSource() 168 { 169 return $this->_owner; 170 } 171 172 public function onDataSourceViewChanged($param) 173 { 174 $this->raiseEvent('OnDataSourceViewChanged',$this,$param); 175 } 176 } 177 178 /** 179 * TReadOnlyDataSourceView class 180 * 181 * @author Qiang Xue <qiang.xue@gmail.com> 182 * @version $Id: TDataSourceView.php 1397 2006-09-07 07:55:53Z wei $ 183 * @package System.Web.UI.WebControls 184 * @since 3.0 185 */ 186 class TReadOnlyDataSourceView extends TDataSourceView 187 { 188 private $_dataSource=null; 189 190 public function __construct(IDataSource $owner,$viewName,$dataSource) 191 { 192 parent::__construct($owner,$viewName); 193 if($dataSource===null || is_array($dataSource)) 194 $this->_dataSource=new TMap($dataSource); 195 else if($dataSource instanceof Traversable) 196 $this->_dataSource=$dataSource; 197 else 198 throw new TInvalidDataTypeException('readonlydatasourceview_datasource_invalid'); 199 } 200 201 public function select($parameters) 202 { 203 return $this->_dataSource; 204 } 205 } 206 207 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 21:07:04 2007 | par Balluche grâce à PHPXref 0.7 |