Warning: file_put_contents(sites/nerkn/cache/containers/queryList/select_s_from_pages_where_pageTypeproject1.file.php): failed to open stream: No such file or directory in /home/erkintek/nerkl/inc/classBasic.php on line 247

Warning: file_put_contents(sites/nerkn/cache/containers/queryList/select_s_from_pages_where_pageTypeproject1.file.php): failed to open stream: No such file or directory in /home/erkintek/nerkl/inc/classBasic.php on line 247

Warning: file_put_contents(sites/nerkn/cache/containers/queryList/select_s_from_pages_where_pageTypeknowlagebase1.file.php): failed to open stream: No such file or directory in /home/erkintek/nerkl/inc/classBasic.php on line 247

Warning: Cannot modify header information - headers already sent by (output started at /home/erkintek/nerkl/inc/classBasic.php:247) in /home/erkintek/nerkl/inc/layout.php on line 227
Writing queries Zend way vs Normal way

Nerkn

Php developer, drupal, html, css, jquery, ajax, javascript
s:147:"

Writing queries Zend way vs Normal way

Here are orginal queries versus zend way:

SELECT p."product_id", p.cost * 1.08 AS cost_plus_tax FROM "products" AS p

$select = $db->select()
             ->from(array('p' => 'products'),
  •                     array('product_id',
                              'cost_plus_tax' =>
                                  new Zend_Db_Expr('p.cost * 1.08'))
                        );



  • SELECT p."product_id", p."product_name" FROM "products" AS p
     
    $select = $db->select()
                 ->from(array('p' => 'products'), 'product_id')
                 ->columns('product_name');
     

    SELECT p."product_id", p."product_name"  FROM "products" AS p
     
    $select = $db->select()
                 ->from(array('p' => 'products'), 'p.product_id')
                 ->columns('product_name', 'p');


    It bearely longers and creates confusion using zend way. Also Insead of using bare string that any one can easily write, a function, it overheads.

    ";