aura/sqlquery
Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.
3.0.0
3.2M downloads/mo
#3128 most downloaded on Packagist
auraphp/Aura.SqlQuery
What this package is like to depend on
Last release 3 years ago
no release in 18 months
Ships unpredictably
gaps range from 9 days to 5.6 years
Nearly every release is documented
notes for 14 of 14 stable releases
Nothing withdrawn
no release was ever pulled
13 years old
16 releases · first in 2014
0 releases in the last 12 months
see the full history below
Release timeline
16 releases · Jan 2014 to Apr 2023Releases
latest 16-
3.0.025 Apr 2023Release notes
Open source →What's Changed
- fix phpDoc and broken return type in Common/Select.php by @pavarnos in #110
- insert->col() and update->col() use variable argument lists by @pavarnos in #111
- Docs structure and add changelog by @harikt in #113
- make $bind parameters explicit in WhereInterface and in having() clauses by @pavarnos in #114
- fix scrutinizer messages by @pavarnos in #117
- move copy/pasted where() / orWhere() to WhereTrait by @pavarnos in #116
- add missing public methods to SelectInterface and related. by @pavarnos in #112
- add Insert::orReplace by @pavarnos in #115
- improve test coverage by @pavarnos in #119
- move copy/pasted limit()/offset() code to traits by @pavarnos in #120
- add “composer test” command to composer.json by @pavarnos in #123
- Extract builder logic to separate classes by @pmjones in #131
- 3.x quoter by @pmjones in #132
- Remove SubSelect interface, typehint on SelectInterface instead by @pmjones in #133
- 3.x: Named placeholders only for where() et al. conditions by @pmjones in #134
- Fixes #125 by @harikt in #135
- Support 'grouping' of where() and having() conditions by @pmjones in #136
- Only fall back to common quoter when DB-specific quoter doesn't exist by @djmattyg007 in #141
- Add "table dot star" assertion to quoter test by @djmattyg007 in #140
- Add missing closing ``` in docs/select.md by @johnchen902 in #144
- Make travis use trusty by @jakejohns in #148
- Drop HHVM support v3.x by @odan in #153
- Test newer PHP versions on CI by @Bilge in #169
- Explain how to bind IN conditions by @afilina in #175
- fix minor typo in instantiation.md by @cammytown in #180
- improve select.md orderBy example by @cammytown in #181
- minor typo in select.md by @cammytown in #182
- fixes #178 by @pmjones in #179
- Enable PHP 5.6-8.1 compat in 3.x by @koriym in #195
- Fix typos by @koriym in #196
- Add to composer ext-pdo_sqlite which required for tests by @maximTarleckiy in #174
- Fix types in phpdoc by @koriym in #197
- Support inline array for condition by @syrm in #162
- Refactor #162 by @koriym in #198
- Add ignore() method to common Insert class by @maximTarleckiy in #173
- Fix deprecated test method by @koriym in #199
- Specify composer version to run up to PHP 7.1 with CI by @koriym in #202
- Enable PHP 8.2 compat by @koriym in #204
New Contributors
- @djmattyg007 made their first contribution in #141
- @johnchen902 made their first contribution in #144
- @jakejohns made their first contribution in #148
- @Bilge made their first contribution in #169
- @afilina made their first contribution in #175
- @cammytown made their first contribution in #180
- @maximTarleckiy made their first contribution in #174
- @syrm made their first contribution in #162
Full Changelog: 2.7.1...3.0.0
-
3.0.0-alpha.111 May 2022 pre-releaseRelease notes
Open source →What's Changed
- fix phpDoc and broken return type in Common/Select.php by @pavarnos in #110
- insert->col() and update->col() use variable argument lists by @pavarnos in #111
- Docs structure and add changelog by @harikt in #113
- make $bind parameters explicit in WhereInterface and in having() clauses by @pavarnos in #114
- fix scrutinizer messages by @pavarnos in #117
- move copy/pasted where() / orWhere() to WhereTrait by @pavarnos in #116
- add missing public methods to SelectInterface and related. by @pavarnos in #112
- add Insert::orReplace by @pavarnos in #115
- improve test coverage by @pavarnos in #119
- move copy/pasted limit()/offset() code to traits by @pavarnos in #120
- add “composer test” command to composer.json by @pavarnos in #123
- Extract builder logic to separate classes by @pmjones in #131
- 3.x quoter by @pmjones in #132
- Remove SubSelect interface, typehint on SelectInterface instead by @pmjones in #133
- 3.x: Named placeholders only for where() et al. conditions by @pmjones in #134
- Fixes #125 by @harikt in #135
- Support 'grouping' of where() and having() conditions by @pmjones in #136
- Only fall back to common quoter when DB-specific quoter doesn't exist by @djmattyg007 in #141
- Add "table dot star" assertion to quoter test by @djmattyg007 in #140
- Add missing closing ``` in docs/select.md by @johnchen902 in #144
- Make travis use trusty by @jakejohns in #148
- Drop HHVM support v3.x by @odan in #153
- Test newer PHP versions on CI by @Bilge in #169
- Explain how to bind IN conditions by @afilina in #175
- fix minor typo in instantiation.md by @cameronsteele in #180
- improve select.md orderBy example by @cameronsteele in #181
- minor typo in select.md by @cameronsteele in #182
- fixes #178 by @pmjones in #179
- Enable PHP 5.6-8.1 compat in 3.x by @koriym in #195
- Fix typos by @koriym in #196
- Add to composer ext-pdo_sqlite which required for tests by @maximTarleckiy in #174
- Fix types in phpdoc by @koriym in #197
- Support inline array for condition by @syrm in #162
- Refactor #162 by @koriym in #198
- Add ignore() method to common Insert class by @maximTarleckiy in #173
- Fix deprecated test method by @koriym in #199
- Specify composer version to run up to PHP 7.1 with CI by @koriym in #202
New Contributors
- @djmattyg007 made their first contribution in #141
- @johnchen902 made their first contribution in #144
- @jakejohns made their first contribution in #148
- @Bilge made their first contribution in #169
- @afilina made their first contribution in #175
- @cameronsteele made their first contribution in #180
- @maximTarleckiy made their first contribution in #174
- @syrm made their first contribution in #162
Full Changelog: 2.7.1...3.0.0-alpha1
-
2.8.125 Apr 2023Release notes
Open source →What's Changed
- [BUG] Fix bad use of strripos by @auroraeosrose in #206 , cherry picked and merged to 2.x via #207
Full Changelog: 2.8.0...2.8.1
-
2.8.021 May 2022Release notes
Open source →What's Changed
- Splitting array parameters into multiple parametres for fix PDO excecution error "Array to string conversion" by @PHPCraftdream in #127
- Added phpunit via composer by @syndicateSoftware in #128
- Drop HHVM support v2.x by @odan in #154
- Add WHERE IN example by @odan in #146
- Correct preg_split call by @srjlewis in #190
- Update ci to support from php 5.4 to 8.1 by @harikt in #203
New Contributors
- @PHPCraftdream made their first contribution in #127
- @syndicateSoftware made their first contribution in #128
- @srjlewis made their first contribution in #190
Full Changelog: 2.7.1...2.8.0
-
2.7.103 Oct 2016 -
2.7.002 Sep 2016Release notes
Open source →- [DOC] Numerous docblock and README updates.
- [ADD] Add various
Select::reset*()methods. Fixes #84, #95, #94, #91. - [FIX] On SELECT, allow OFFSET even when LIMIT not specified. Fixes #88.
- [FIX] On SELECT, allow
join*()beforefrom*(). Joins-before-from are added
to the first from. If no from is ever added, the joins will never be built
into the statement. Fixes #69, #90. - [BRK] Bumped the minimum version to PHP 5.3.9 (vs 5.3.0). Fixes #74. This is
to address a language-level bug in PHP. Technically I think this is a BC
break, but I hope it is understandable, given that PHP 5.3.x is end-of-life,
and that Aura.SqlQuery itself simply will not operate on versions earlier
than that. Updated README to reflect the version requirement.
Release notes
Open source →-
[DOC] Numerous docblock and README updates.
-
[ADD] Add various
Select::reset*()methods. Fixes #84, #95, #94, #91. -
[FIX] On SELECT, allow OFFSET even when LIMIT not specified. Fixes #88.
-
[FIX] On SELECT, allow
join*()beforefrom*(). Joins-before-from are added to the first from. If no from is ever added, the joins will never be built into the statement. Fixes #69, #90. -
[BRK] Bumped the minimum version to PHP 5.3.9 (vs 5.3.0). Fixes #74. This is to address a language-level bug in PHP. Technically I think this is a BC break, but I hope it is understandable, given that PHP 5.3.x is end-of-life, and that Aura.SqlQuery itself simply will not operate on versions earlier than that. Updated README to reflect the version requirement.
-
2.6.009 Nov 2015Release notes
Open source →- (DOC) Docblock and README updates; in particular, add an
@method getStatement()to the QueryInterface for IDE auto-completion. - (ADD) Select::hasCols() reports if there are any columsn in the Select.
- (ADD) Select::getCols() gets the existing columns in the Select.
- (ADD) Select::removeCol() removes a previously-added column.
- (FIX) Select::reset() now properly resets the table refs for a UNION.
- (FIX) Select::forUpdate() is now fluent.
Release notes
Open source →-
(DOC) Docblock and README updates; in particular, add an
@method getStatement()to the QueryInterface for IDE auto-completion. -
(ADD) Select::hasCols() reports if there are any columsn in the Select.
-
(ADD) Select::getCols() gets the existing columns in the Select.
-
(ADD) Select::removeCol() removes a previously-added column.
-
(FIX) Select::reset() now properly resets the table refs for a UNION.
-
(FIX) Select::forUpdate() is now fluent.
- (DOC) Docblock and README updates; in particular, add an
-
2.5.002 Jun 2015Release notes
Open source →- Docblock and README updates
- The Common\Select class, when binding values from a subselect, now checks for
instanceof SubselectInterfaceinstead ofself; the Select class now
implements SubselectInterface, so this should not be a BC break. - Subselects bound as where/having/etc conditions should now retain ?-bound
params.
Release notes
Open source →-
Docblock and README updates
-
The Common\Select class, when binding values from a subselect, now checks for
instanceof SubselectInterfaceinstead ofself; the Select class now implements SubselectInterface, so this should not be a BC break. -
Subselects bound as where/having/etc conditions should now retain ?-bound params.
-
2.4.227 Mar 2015Release notes
Open source →This release modifies the testing structure and updates other support files.
Release notes
Open source →This release modifies the testing structure and updates other support files.
-
2.4.126 Mar 2015Release notes
Open source →This release fixes Insert::addRows() so that adding only one row generates the correct SQL statement.
Release notes
Open source →This release fixes Insert::addRows() so that adding only one row generates the correct SQL statement.
-
2.4.022 Mar 2015Release notes
Open source →This release incorporates two feature additions and one fix.
-
ADD: The Insert objects now support multiple-row inserts with the new
addRow()andaddRows()methods. -
ADD: The MySQL Insert object now supports
ON DUPLICATE KEY UPDATEfunctionality with the newonDuplicateKeyUpdate*()methods. -
FIX: The Select methods regarding paging now interact better with LIMIT and OFFSET; in particular, both
setPaging()now re-calculates the LIMIT and OFFSET values.
-
-
2.3.016 Mar 2015Release notes
Open source →This release has several new features.
-
The various
join()methods now have an extra$bindparam that allows you to bind values to ?-placeholders in the condition, just as withwhere()andhaving(). -
The Select class now tracks table references internally, and will throw an exception if you try to use the same table name or alias more than once.
-
The method
getStatement()has been added to all queries, to allow you to get the text of the statement being built. Among other things, this is to avoid exception-related blowups related to PHP's string casting. -
When binding a value to a sequential placeholder in
where(),having(), etc, the Select class now examind the value to see if it is a query object. If so, it converts the object to a string and replaces the ?-placeholder inline with the string instead of attempting to bind it proper. It also binds the existing sequential placholder values into the current Select in a non-conflicting fashion. (Previously, no binding from the sub-select took place at all.) -
In
fromSubSelect()andjoinSubSelect(), the Select class now binds the sub-select object sequential values to the current Select in a non-conflicting fashion. (Previously, no binding from the sub-select took place at all.)
The change log follows:
-
REF: Extract rebuilding of condition and binding sequential values.
-
FIX: Allow binding of values as part of join() methods. Fixes #27.
-
NEW: Method Select::addTableRef(), to track table references and prevent double-use of aliases. Fixes #38.
-
REF: Extract statement-building to AbstractQuery::getStatement() method. Fixes #30.
-
FIX: #47, if value for sequential placeholder is a Query, place it as a string inline
-
ADD: Sequential-placeholder prefixing
-
ADD: bind values from sub-selects, and modify indenting
-
ADD: QueryFactory now sets the sequntial bind prefix
-
FIX: Fix line endings in queries to be sure tests will pass on windows and mac. Merge pull request #53 from ksimka/fix-tests-remove-line-endings: Fixed tests for windows.
-
Merge pull request #50 from auraphp/bindonjoin: Allow binding of values as part of join() methods.
-
Merge pull request #51 from auraphp/aliastracking: Add table-reference tracking to disallow duplicate references.
-
Merge pull request #52 from auraphp/bindsubselect. Bind Values From Sub-Selects.
-
DOC: Update documentation and support files.
-
-
2.2.012 Feb 2015Release notes
Open source →To avoid mixing numbered and names placeholders, we now convert numbered ? placeholders in where() and having() to :# named placeholders. This is because PDO is really touchy about sequence numbers on ? placeholders. If we have bound values [:foo, :bar, ?, :baz], the ? placeholder is not number 1, it is number 3. As it is nigh impossible to keep track of the numbering when done out-of-order, we now do a braindead check on the where/having condition string to see if it has ? placholders, and replace them with named :# placeholders, where # is the current count of the $bind_values array.
-
2.1.024 Aug 2014Release notes
Open source →-
ADD: Select::fromRaw() to allow raw FROM clause strings.
-
CHG: In Select, quote the columns at build time, not add time.
-
CHG: In Select, retain columns keyed on their aliases (when given).
-
DOC: Updates to README and docblocks.
-
-
2.0.009 Jun 2014Release notes
Open source →Initial 2.0 stable release.
-
The package has been renamed from Sql_Query to SqlQuery, in line with the new Aura naming standards.
-
Now compatible with PHP 5.3!
-
Refactored traits into interfaces (thanks @mindplay-dk).
-
Refactored the internal build process (thanks again @mindplay-dk).
-
Added Select::leftJoin()/innerJoin() methods (thanks @stanlemon).
-
Methods bindValue() and bindValues() are now fluent (thanks @karikt).
-
Select now throws an exception when there are no columns selected.
-
In joins, the condition type (ON or USING) may now be part of the condition.
-
Extracted new class, Quoter, for quoting identifer names.
-
Extracted new class, AbstractDmlQuery, for Insert/Update/Delete queries.
-
Select::cols() now accepts
colname => aliaspairs mixed in with sequential colname values. -
Added functionality to map last-insert-id names to alternative sequence names, esp. for Postgres and inherited/extended tables. Cf. QueryFactory::setLastInsertIdNames() and Insert::setLastInsertIdNames().
-
-
2.0.0-beta107 Jan 2014 pre-release