select() public method

Build a SELECT SQL string from SqlBuilder's state.
public select ( ) : string
return string
コード例 #1
0
ファイル: PostController.php プロジェクト: RomsonApp/blog
 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));
 }
コード例 #2
0
ファイル: PdoDataSet.class.php プロジェクト: rday/recess
 /**
  * Return the SQL representation of this PdoDataSet
  *
  * @return string
  */
 public function toSql()
 {
     return $this->sqlBuilder->select();
 }
コード例 #3
0
ファイル: Mormons.php プロジェクト: anicet/morm
 /**
  * @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());
     }
 }