problem about query-builder-Collection of common programming errors


  • Victor Czechov
    kohana kohana-3.2 query-builder
    I need to INSERT a data to table, but before a query I must to know the MAX value from column position, than to INSERT a data WHERE my SELECTED before position+1. Is it possible with query builder?following my first comment I did query:$p = DB::select(array(DB::expr(‘MAX(`position`)’, ‘p’)))->from(‘supercategories’)->execute();echo $p;the error:ErrorException [ Notice ]: Undefined offset: 1MODPATH\database\classes\kohana\database.php [ 505 ]500 */ 501 public function quote_column

  • Brent C
    php zend-framework doctrine2 service-layer query-builder
    For years now I’ve been reimplementing the same code over and over (with evolution) without finding some method of cleanly, and efficiently, abstracting it out.The pattern is a base ‘find[Type]s’ method in my service layers which abstracts select query creation to a single point in the service, but supports the ability to quickly create easier to use proxy methods (see the example PostServivce::getPostById() method way below).Unfortunately, so far, I’ve been unable to satisfy these goals:Reduce

  • Andresch Serj
    symfony2 doctrine2 apc query-builder doctrine-query
    I deleted a property (teaser) from an enitiy (sale). I used the CLi to update the database & entites:$ php app/console doctrine:schema:update –complete –force $ php app/console doctrine:generate:entities Our –no-backup $ php app/console doctrine:cache:clear-metadata $ php app/console doctrine:cache:clear-resultAnd i cleared the cache:$ php app/console cache:clear –no-optional-warmers –no-warmupNow i have a query created by query builder:$qb = $this->createQueryBuilder(‘s’); $q = $qb-

  • Karem
    php kohana query-builder
    like you can do in a normal query:SELECT id, ‘Default’ AS Type FROM …I would like to do that in Kohana, i tried:DB::select(‘id’, array(‘Default’, ‘Type’))->from(‘…’)But it thinks that “Default” is a column so it returns with error unknown column Default.What can i do here to make a alias of my own defined column?

Originally posted 2013-11-27 12:16:16.