Closed imonteiro closed 11 years ago
From pao.fre...@gmail.com on July 14, 2009 20:41:40 This grid now uses the Zend_Db_Select to perform queries.
Please wait for the next release or try the latest revision from SVN.
$gri->query(Zend_Db_Select instance);
From pao.fre...@gmail.com on July 14, 2009 20:41:41 This grid now uses the Zend_Db_Select to perform queries.
Please wait for the next release or try the latest revision from SVN.
$gri->query(Zend_Db_Select instance);
Original author: chonn...@gmail.com (March 27, 2009 15:19:37)
So it is my query: $s = $this->db->select(); $s->from(array('p'=>'tb_mats_prodin'),array('id','PLabel','count','length','width','thickness'))
->joinLeft(array('u'=>'tb_measures'),'p.unit_id=u.id',array('measure')) ->joinLeft(array('m'=>'tb_materials'),'p.mat_id=m.id',array('material')) ->joinLeft(array('pr'=>'tb_products'),'p.prod_id=pr.id',array('product')) ->joinLeft(array('s'=>'tb_selections'),'p.sel_id=s.id',array('selection')) ->joinLeft(array('q'=>'tb_qualities'),'p.qual_id=q.id',array('quality')) ->joinLeft(array('pc'=>'tb_processing'),'p.proc_id=pc.id',array('processing')) ->joinLeft(array('apc'=>'tb_add_processing'),'p.add_proc_id=apc.id',array('add_processing')) ->joinLeft(array('c'=>'tb_mats_categories'),'p.cat_id=c.id',array('category')) ->joinLeft(array('po'=>'tb_mats_prodout'),'p.id=po.pid',array()) ->where('po.pid is null');
When I print it and query it via phpmyadmin everything is fine
SELECT
p
.id
,p
.PLabel
,p
.count
,p
.length
,p
.width
,p
.thickness
,u
.measure
,m
.material
,pr
.product
,s
.selection
,q
.quality
,pc
.processing
,apc
.add_processing
,c
.category
FROMtb_mats_prodin
ASp
LEFT JOINtb_measures
ASu
ON p.unit_id=u.id LEFT JOINtb_materials
ASm
ON p.mat_id=m.id LEFT JOINtb_products
ASpr
ON p.prod_id=pr.id LEFT JOINtb_selections
ASs
ON p.sel_id=s.id LEFT JOINtb_qualities
ASq
ON p.qual_id=q.id LEFT JOINtb_processing
ASpc
ON p.proc_id=pc.id LEFT JOINtb_add_processing
ASapc
ON p.add_proc_id=apc.id LEFT JOINtb_mats_categories
ASc
ON p.cat_id=c.id LEFT JOINtb_mats_prodout
ASpo
ON p.id=po.pid WHERE (po.pid is null)Problem is when I use it with grid $grid->queryFromZendDbSelect($s);
exception info
exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u.idleft' in 'on clause'' in C:\wamp\frameworks\Zend\Db\Statement\Pdo.php:238 Stack trace: #0 C:\wamp\frameworks\Zend\Db\Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\wamp\frameworks\Zend\Db\Adapter\Abstract.php(433): Zend_Db_Statement->execute(Array) #2 C:\wamp\frameworks\Zend\Db\Adapter\Pdo\Abstract.php(230): Zend_Db_Adapter_Abstract->query('SELECT p.id, p....', Array) #3 C:\wamp\frameworks\Zend\Db\Adapter\Abstract.php(644): Zend_Db_Adapter_Pdo_Abstract->query('SELECT p.id, p....', Array) #4 C:\wamp\projects\erp\library\Bvb\Grid\DataGrid.php(2754): Zend_Db_Adapter_Abstract->fetchAll('SELECT p.id, p....') #5 C:\wamp\projects\erp\library\Bvb\Grid\Deploy\Table.php(1833): Bvb_Grid_DataGrid->deploy() #6 C:\wamp\projects\erp\application\Mats\controllers\AddController.php(220): Bvb_Grid_Deploy_Table->deploy() #7 C:\wamp\frameworks\Zend\Controller\Action.php(503): Mats_AddController->prodoutAction() #8 C:\wamp\frameworks\Zend\Controller\Dispatcher\Standard.php(285): Zend_Controller_Action->dispatch('prodoutAction') #9 C:\wamp\frameworks\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #10 C:\wamp\projects\erp\application\bootstrap.php(30): Zend_Controller_Front->dispatch() #11 C:\wamp\projects\erp\public\index.php(8): require('C:\wamp\project...') #12 {main}
Original issue: http://code.google.com/p/zfdatagrid/issues/detail?id=30