select() public méthode

Build a SELECT SQL string from SqlBuilder's state.
public select ( ) : string
Résultat string
Exemple #1
0
 public function edit()
 {
     $postBuilder = new SqlBuilder();
     $post = $postBuilder->from('post')->with(array('status' => array('status_name', 'label', 'id', 'status')))->where(array('id = ' . $_GET['id']))->limit(1)->query();
     $tagsBuilder = new SqlBuilder();
     $tags = $tagsBuilder->select(array('tag'))->from('tag')->where(array('post_id = ' . $post->id))->query();
     $this->render('post/edit', array('post' => $post, 'tags' => $tags));
 }
Exemple #2
0
 /**
  * Return the SQL representation of this PdoDataSet
  *
  * @return string
  */
 public function toSql()
 {
     return $this->sqlBuilder->select();
 }
Exemple #3
0
 /**
  * @throws Exception if MySQL error occurs
  * @return void
  */
 public function execute()
 {
     $rs = SqlTools::sqlQuery("SELECT " . SqlBuilder::select($this->tables) . " \nFROM " . SqlBuilder::from($this->get_from_tables()) . SqlBuilder::joins($this->joins, $this->getJoinType()) . "\n" . SqlBuilder::where($this->where, $this->sql_where) . "\n" . SqlBuilder::order_by($this->order, $this->order_dir) . "\n" . SqlBuilder::limit($this->offset, $this->limit));
     if ($rs) {
         $this->load($rs);
         $this->_executed = true;
         if (!is_null($this->_foreign_object_waiting_for_association)) {
             $this->associateForeignObject($this->_foreign_object_waiting_for_association[0], $this->_foreign_object_waiting_for_association[1]);
         }
     } else {
         throw new Exception("Fatal error:" . mysql_error());
     }
 }