Christoph Wurst
b9287f9780
Merge pull request #25091 from nextcloud/enhancement/ocp-db-exception-abstraction
...
Add our own DB exception abstraction
2021-01-14 12:27:23 +01:00
blizzz
f9ab7575e7
Merge pull request #25036 from nextcloud/fix/noid/limitied-allowed-items-db-in_2
...
respect DB restrictions on number of arguments in statements and queries
2021-01-14 11:36:42 +01:00
Christoph Wurst
2c9cdc1cdb
Add our own DB exception abstraction
...
Right now our API exports the Doctrine/dbal exception. As we've seen
with the dbal 3 upgrade, the leakage of 3rdparty types is problematic as
a dependency update means lots of work in apps, due to the direct
dependency of what Nextcloud ships. This breaks this dependency so that
apps only need to depend on our public API. That API can then be vendor
(db lib) agnostic and we can work around future deprecations/removals in
dbal more easily.
Right now the type of exception thrown is transported as "reason". For
the more popular types of errors we can extend the new exception class
and allow apps to catch specific errors only. Right now they have to
catch-check-rethrow. This is not ideal, but better than the dependnecy
on dbal.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-01-12 16:38:23 +01:00
Arthur Schiwon
f9484d15cb
DB: warn on parameter number constraints
...
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-01-11 13:43:34 +01:00
Joas Schilling
3cdfe7b0f4
Don't try a transaction for the migrator on MySQL
...
As per https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html
CREATE TABLE statements automatically commit always. The only reason
this worked in the past was that PHPs PDO connection didn't check the
actual state on commit, but only checked their internal state.
But in PHP8 this was fixed:
https://github.com/php/php-src/blob/PHP-8.0/UPGRADING#L446-L450
So now commit() fails because the internal PDO connection implicitly
commited already.
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-01-08 16:25:40 +01:00
Morris Jobke
dc00c8ac31
Remove "primary" option from schema builder argument $options as it is not used anymore and triggers an exception
...
See 138eb85234 (diff-300f55366adb50a32a40882ebdc95c163b141f64cba5f45f20bda04a907b3eb3L82)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2021-01-08 11:45:19 +01:00
Christoph Wurst
8b64e92b92
Bump doctrine/dbal from 2.12.0 to 3.0.0
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-01-08 11:45:19 +01:00
Christoph Wurst
9ce3ea3368
Update license headers
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-30 14:07:05 +01:00
Roeland Jago Douma
adc4f1a811
Merge pull request #22916 from J0WI/unifiy-links-to-php.net
...
Unify links to php.net
2020-12-22 09:53:31 +01:00
Christoph Wurst
d89a75be0b
Update all license headers for Nextcloud 21
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +01:00
Joas Schilling
39bee7948d
Merge pull request #24631 from nextcloud/bugfix/noid/prevent-select-asterix-and-specifics
...
Prevent * and other things in the same query for Oracle
2020-12-14 14:31:15 +01:00
Joas Schilling
5828f3c4f9
Prevent * and other things in the same query for Oracle
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-12-14 09:35:50 +01:00
Julius Härtl
36ffad5ba7
Make sure the migrations table schema is always checked
...
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Revert "Make sure the migrations table schema is always checked"
This reverts commit 258955ef738a52d9da2ac2fe59466e6093d7e9bc.
Set current vendor during upgrade and perform migrations table change if needed
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-12-09 15:24:03 +01:00
Joas Schilling
c1f28f8d35
Make debugging migration exceptions easier
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-12-07 19:35:01 +01:00
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
691409cdec
Merge pull request #24062 from nextcloud/revert-24060-revert-24039-faster-installation
...
Revert "Revert "Installation goes brrrr""
2020-11-20 15:02:51 +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
Joas Schilling
9a3ce2f71f
Don't drop the table anymore when we create it again
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-16 19:34:38 +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
Joas Schilling
d7b5d4cb58
Revert "Revert "Installation goes brrrr""
2020-11-11 20:12:13 +01:00
Christoph Wurst
d36155620c
Revert "Installation goes brrrr"
2020-11-11 17:40:12 +01:00
Joas Schilling
77713ab454
Don't create a schema to check if the migrations table exists
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-11 11:45:00 +01:00
Joas Schilling
dde0e73c6b
Reduce the number of schemas we generate when we just run all migrations anyway
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-11 11:45:00 +01:00
Joas Schilling
d5df033ede
Create primary keys on all tables and add a command to create the afterwards
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-10 15:36:27 +01:00
Joas Schilling
fbda2d1d25
Don't try to update on NotNullConstraintViolationException, only on unique or foreign key
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-10 15:36:27 +01:00
Joas Schilling
1aa9c9164d
Fix comparing the empty string for global credentials
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-10 15:36:26 +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
Julius Härtl
f49630f48c
Replace prefix in executeUpdate
...
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2020-11-03 11:03:02 +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
Roeland Jago Douma
28be188fbc
Update internal connection class
...
executeUpdate is deprecated in favor of executeStatement.
We overwrote the old one hence the prefix was no longer replaced.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-10-30 19:27:53 +01:00
Morris Jobke
f12e7e0e95
Fetch the logger and system config once for all query builder instances
...
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-10-29 22:35:06 +01:00
Morris Jobke
c1fd22b025
Merge pull request #23144 from nextcloud/enh/noid/update-param-for-psalm
...
Less psalm warnings
2020-10-06 22:07:58 +02:00
Christoph Wurst
d9015a8c94
Format code to a single space around binary operators
...
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-10-05 20:25:24 +02: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
Joas Schilling
3212c074b9
Log the number of queries built and executed
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-09-25 14:55:53 +02:00
J0WI
68ce17e59b
Unify links to php.net
...
Update all links to https://www.php.net/
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2020-09-17 17:40:04 +02:00
Morris Jobke
99c9423766
Remove @suppress SqlInjectionChecker
...
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +02:00
Joas Schilling
50230847ce
Warn about adding NotNull columns with nullable default
...
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-09-07 13:14:49 +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
Morris Jobke
fedf9c69d9
Use matching parameter names form interfaces and implementations
...
Found by Psalm 3.14.1
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-19 18:16:35 +02:00
Morris Jobke
d7f66c36ac
Fix "misplaced variables" warning of Psalm in PHPDoc statements
...
Ref #21787
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-17 17:46:57 +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