Esempio n. 1
0
 public function __construct(IDataSourceDriver $driver)
 {
     parent::__construct(new XmlDataSourceDriver($driver));
     if (!function_exists('simplexml_load_file')) {
         throw new Exception('SimpleXML is required !');
     }
     $this->_xpathExpression = $driver->getParameter();
 }
 public function __construct(IDataSourceDriver $driver)
 {
     parent::__construct($driver);
 }
$genTimer = new Timer();
System::import('System.Context.HttpContext');
System::import('System.DataGrid.DataSources.DataGridSource');
System::import('System.DataSource.Expressions.XpathExpression');
System::import('System.DataSource.Expressions.DbmsExpression');
System::import('System.DataGrid.Controller.DataGridController');
System::import('System.SqlBuilder.SqlBuilder');
$context =& new HttpContext();
$timer =& new Timer();
$xmlDataSource =& DataGridSource::createNew('xml://datagrid.xml/');
$xmlDataGrid =& $xmlDataSource->getDataGrid(new XpathExpression('//datagrid'));
$dgController1 =& new DataGridController($context, $xmlDataGrid);
$dgController1->process();
$xmlTime = $timer->ReturnTimer();
$timer =& new Timer();
$dbDataSource =& DataGridSource::createNew('mysql://*****:*****@localhost.DPat/');
$sql =& new sqlBuilder();
$aliasA = $sql->aliasTable('DataGrid', 'A');
$aliasB = $sql->aliasTable('DataGridRow', 'B');
$aliasC = $sql->aliasTable('DataGridColumn', 'C');
$sql->get($aliasA, 'id', 'datagrid_id');
$sql->get($aliasA, 'title', 'datagrid_title');
$sql->get($aliasB, 'id', 'datagridrow_id');
$sql->get($aliasC, 'id', 'datagridcolumn_id');
$sql->get($aliasC, 'value', 'datagridcolumn_value');
$sql->joinTable($aliasA, 'id', $aliasB, 'datagrid_id', '=', sqlBuilder::InnerJoin);
$sql->joinTable($aliasB, 'id', $aliasC, 'datagridrow_id', '=', sqlBuilder::InnerJoin);
$request = $sql->select();
//  $request = 'SELECT A.id AS datagrid_id, A.title AS datagrid_title, B.id AS datagridrow_id, C.id AS datagridcolumn_id, C.value AS datagridcolumn_value FROM DataGrid AS A INNER JOIN DataGridRow AS B ON ( A.id = B.datagrid_id ) INNER JOIN DataGridColumn AS C ON ( B.id = C.datagridrow_id )';
$dbDataGrid =& $dbDataSource->getDataGrid(new DbmsExpression($request));
$dgController2 =& new DataGridController($context, $dbDataGrid);