Commit Graph

72 Commits

Author SHA1 Message Date
Vincent Petry a50bcdabcc
Prevent log_query to mess up regular execution flow
When the "log_query" debug config parameter is set, SQL queries are
logged. However, if an error occurs when converting the values to
string, it will abort the request.

This fix catches the error and continues instead.

Also added handler for DateTime value which is already known to cause
aborts here.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
2020-12-02 14:10:35 +01:00
Morris Jobke 1b613c84e9
Merge pull request #24007 from nextcloud/select-distinct-multiple
allow selecting multiple columns with SELECT DISTINCT
2020-11-19 22:39:01 +01:00
Joas Schilling a8cb8e21c1
Add types to function builder
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-16 19:46:24 +01:00
Robin Appelman a61a757b85
allow selecting multiple columns with SELECT DISTINCT
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-11-16 15:45:17 +01:00
Roeland Jago Douma a5fa9604ba
Merge pull request #23923 from nextcloud/bugfix/oci/fix-greatest-order-for-oracle
Fix greatest/least order for oracle
2020-11-07 16:55:13 +01:00
Joas Schilling d9e471771a
Update parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-07 14:06:03 +01:00
Joas Schilling cb8bef1f37
Fix iLike() falsely turning escaped % and _ into wildcards
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-06 16:22:13 +01:00
Joas Schilling 3aaf2fabb1
Make sure Oracle always casts everything in the best way
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-06 12:13:22 +01:00
Joas Schilling cfc35fa49a
Fix casting to integer on Oracle
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-06 08:38:08 +01:00
Roeland Jago Douma fe46149560
Psalm fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-10-30 19:27:53 +01:00
Daniel Kesselberg 0e3ddf1b27
Add explicit typecast for $value.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-10-03 17:15:14 +02:00
Daniel Kesselberg 64b10f61df
Update signature for set
also ILiteral and IQueryFunction are valid.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-10-02 19:15:34 +02:00
Daniel Kesselberg 8fdb74bdd5
Update signature for in/notIn
$y is always passed to quoteColumnName hence ILiteral|IParameter|IQueryFunction are supported.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-10-02 19:09:28 +02:00
Daniel Kesselberg d14c971ad6
Update signature for like/notLike/in/notIn
$x is always passed to quoteColumnName hence ILiteral|IParameter|IQueryFunction are supported.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-10-02 18:59:53 +02:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +02:00
Daniel Kesselberg 10ac844448
Update documentation for QueryBuilder::set
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2020-08-14 19:55:01 +02:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +02:00
Roeland Jago Douma cbcf072b23
Revert "Make sure MySQL is not saying 'this' = 'this ' is true" 2020-04-15 23:49:16 +02:00
Joas Schilling 16e9bf2309
Make sure MySQL is not saying 'this' = 'this ' is true
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-04-15 09:14:12 +02:00
Christoph Wurst caff1023ea
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.

This also removes and empty lines from method/function bodies at the
beginning and end.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 14:19:56 +02:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +02:00
Christoph Wurst 41b5e5923a
Use exactly one empty line after the namespace declaration
For PSR2

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 11:48:10 +02:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +02:00
Christoph Wurst b80ebc9674
Use the short array syntax, everywhere
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-26 16:34:56 +01:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Robin Appelman 9e450d727a
add LEAST and GREATER to db function builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-26 12:05:30 +01:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +01:00
Robin Appelman ac209cea52
add count() as shortcut for count('*') in FunctionBuilder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 11:30:32 +01:00
Robin Appelman 0e9feeb090
return from QueryBuilder instead of IQueryBuilder
this make the type hints work properly with querybuilder subclasses

Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-11-13 11:30:27 +01:00
Robin Appelman 8ef5a366ec
add MAX and MIN to functionbuilder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-09-06 12:28:17 +02:00
Joas Schilling f906913177
Allow to use Subqueries in from
Signed-off-by: Joas Schilling <coding@schilljs.com>
2019-04-16 15:42:21 +02:00
Robin Appelman bfd539017f
add casting to string for postgresql query builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2019-03-14 14:19:10 +01:00
Joas Schilling bb352fb667
Use the defined func()->count() instead of manual counting
Signed-off-by: Joas Schilling <coding@schilljs.com>
2018-11-08 15:44:45 +01:00
Robin Appelman 3047ef31bd
Add count to function builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-06-14 14:32:22 +02:00
Robin Appelman 89a9d35d90 dont keep shared database locks when running cli scripts
For cli scripts we don't have the assumption that the universe will be cleaned up soon

Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-04-11 19:21:45 +02:00
Roeland Jago Douma ab04f3cb19
Fix Array to String conversion in QueryBuilder
Fixes #9080

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-04-05 09:08:32 +02:00
Roeland Jago Douma 46c195b58b
Made IExpressionBuilder varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:35:09 +01:00
Roeland Jago Douma 0009358c17
Made orHaving varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:32:31 +01:00
Roeland Jago Douma 408c2103db
Made addHaving varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:31:33 +01:00
Roeland Jago Douma 2c585afea1
Make having varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:31:04 +01:00
Roeland Jago Douma c6eba3c925
Made addGroupBy varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:30:14 +01:00
Roeland Jago Douma afbad7e15e
Made groupBy varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:29:36 +01:00
Roeland Jago Douma d6b93e6620
Made orWhere varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:28:27 +01:00
Roeland Jago Douma 07cb6aaeff
Made andWhere varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:27:43 +01:00
Roeland Jago Douma 222dbb7bc9
Made where varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:27:11 +01:00
Roeland Jago Douma 2976b39102
Made AddSelect varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 09:25:32 +01:00
Roeland Jago Douma c8aee70a0b
Made select varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-03-13 08:07:08 +01:00
Robin Appelman 42b3aa3a0a
reuse query builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2018-01-12 13:57:55 +01:00
Robin Appelman aad01894e3
refactor user searching
add additional user searching tests

Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-12-20 15:51:37 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00