File Manager
<?php
namespace CGExtensions\query;
class sql_query extends query
{
private $_data = array('sql'=>null,'limit'=>1000,'offset'=>0);
public function __construct($parms = array())
{
foreach( $parms as $key => $val ) {
if( array_key_exists($key,$this->_data) ) $this[$key] = $val;
}
}
public function OffsetGet($key)
{
if( isset($this->_data[$key]) ) return $this->_data[$key];
throw new \CmsInvalidDataException($key.' is not a valid member of '.__CLASS__);
}
public function OffsetSet($key,$value)
{
if( !array_key_exists($key,$this->_data) ) throw new \CmsInvalidDataException($key.' is not a valid member of '.__CLASS__);
switch( $key ) {
case 'sql':
$this->_data[$key] = $value;
break;
case 'limit':
$value = max(1,min(1000,(int)$value));
$this->_data[$key] = $value;
break;
case 'offset':
$val = max(0,min(9000000,(int)$value));
$this->_data[$key] = $value;
break;
}
}
public function OffsetExists($key)
{
return array_key_exists($key,$this->_data);
}
public function &execute()
{
$rs = new sql_resultset($this);
return $rs;
}
} // end of class
?>
File Manager Version 1.0, Coded By Lucas
Email: hehe@yahoo.com