Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Add a comma between two table expression. #6

Merged
merged 1 commit into from
Jan 17, 2014

Conversation

Metalaka
Copy link
Member

@Hywan
Copy link
Member

Hywan commented Jan 16, 2014

Hello :-),

Thank you for the PR! Nevertheless, I would encourage you to use an array $out, combined with an implode(', ', $out), which avoid the use of substr (this is how we made out there in Hoa).

Thanks!

@Metalaka
Copy link
Member Author

I agree, you prefer something like that ?

foreach($this->_from as $alias => &$from)
    if(!is_int($alias))
        $form = $from . ' AS ' . $alias;

$out .= ' ' . implode(', ', $this->_from)

@Hywan
Copy link
Member

Hywan commented Jan 16, 2014

Something like:

$handle = array();
foreach($this->_from as $alias => $from)
    if(is_int($alias))
        $handle[] = ' ' . $from;
    else
        $handle[] = ' ' . $from . ' AS ' . $alias;
$out = implode(', ', $handle);

This is how we used to do :-).

@Metalaka
Copy link
Member Author

Also modify $this->_from is not a good idea.

I updated the attached commit ;)

Metalaka referenced this pull request in Metalaka/Database Jan 17, 2014
@ghost ghost assigned thehawk970 Jan 17, 2014
@Hywan
Copy link
Member

Hywan commented Jan 17, 2014

@camael24 will do the review.

@thehawk970
Copy link

Sounds good for me

$select->from('foo')->_as('f')->from('bar')->_as('b');
output in Metalaka version : SELECT * FROM foo AS f, bar AS b
instead of Hoa version which output : SELECT * FROM foo AS f bar AS b

@Bhoat Bhoat merged commit 066ed57 into hoaproject:master Jan 17, 2014
@Hywan
Copy link
Member

Hywan commented Jan 17, 2014

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants