Skip to content

Feature: no table support#140

Merged
usmanhalalit merged 3 commits intousmanhalalit:2.xfrom
skipperbent:feature-no-table-support
Oct 17, 2017
Merged

Feature: no table support#140
usmanhalalit merged 3 commits intousmanhalalit:2.xfrom
skipperbent:feature-no-table-support

Conversation

@skipperbent
Copy link
Copy Markdown

@skipperbent skipperbent commented Jun 2, 2016

Added support for not defining any table (so calling QueryBuilderHandler()->table() is no longer required).

Can be useful for situations where you are using multiple subqueries to generate the rows without doing a specific query to any tables.

SQL Example:

SELECT (SELECT COUNT(*) FROM `mail`) as mail_count, (SELECT COUNT(*) FROM `event_message`) as message_count

Pixie example:

$subQuery1 = $this->builder->table('mail')->select($this->builder->raw('COUNT(*)'));
$subQuery2 = $this->builder->table('event_message')->select($this->builder->raw('COUNT(*)'));

$count = $this->builder->select($this->builder->subQuery($subQuery1, 'row1'), $this->builder->subQuery($subQuery2, 'row2'))->first();

I've created tests for this, which can be found in the NoTableSubQueryTest test-class.

@TCB13
Copy link
Copy Markdown

TCB13 commented Jun 29, 2017

This is useful :)

@skipperbent
Copy link
Copy Markdown
Author

I've added this and multiple other useful features in my custom fork, available here:

https://github.com/skipperbent/pecee-pixie

@TCB13
Copy link
Copy Markdown

TCB13 commented Jun 29, 2017

@skipperbent maybe you should PR all your changes to this project. The maintainer of this one had some heath complications lately but he is back.

@TCB13
Copy link
Copy Markdown

TCB13 commented Oct 16, 2017

@usmanhalalit please merge!

@usmanhalalit usmanhalalit merged commit 648090e into usmanhalalit:2.x Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants