Commit Graph

222 Commits

Author SHA1 Message Date
Roeland Jago Douma 85e48d796c
Merge pull request #25929 from nextcloud/techdept/psalm/25839/redundantcasts
Remove Redundantcasts
2021-03-05 08:42:54 +01:00
Roeland Jago Douma d7f7d3bc51 Type CompositeExpression and ICompositeExpression
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-04 21:47:44 +01:00
Roeland Jago Douma c3f1eb4f7f Remove Redundantcasts
For #25839

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-04 14:44:04 +01:00
Roeland Jago Douma 76a6328d10 Add executeQuery and executeUpdate
Names shamelessly copied from Doctrine itself.
Internally it is still using the same flow. But I added some checks
around it.

This should make static analysis a bit more happy. Which in turn makes
me more happy.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-04 14:03:31 +01:00
Joas Schilling a6246be34c
Merge pull request #25656 from nextcloud/enh/type/expressionbuilder
Type the experssionbuilders
2021-03-03 11:37:16 +01:00
Joas Schilling 11858a3d66
Merge pull request #25816 from nextcloud/iquerybuilder-join-conditions
allow non string join conditions in query builder
2021-03-03 11:34:56 +01:00
Roeland Jago Douma 4bdf9f5849 Type the experssionbuilders
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-03 10:44:09 +01:00
Robin Appelman 47dd8e54b5
allow non string join conditions in query builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-03-03 10:43:15 +01:00
Daniel Kesselberg bc91eb7c64
Filter tables with other table prefix
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-03-02 21:09:33 +01:00
dependabot-preview[bot] eb502c02ff
Bump nextcloud/coding-standard from 0.3.0 to 0.5.0
Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/nextcloud/coding-standard/releases)
- [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nextcloud/coding-standard/compare/v0.3.0...v0.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-02-18 13:31:24 +01:00
Joas Schilling 1de3b8b0ec
When it kicks in
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-02-18 10:14:12 +01:00
Robin Appelman 111fa47f10
remove ReconnectWrapper
dbal now handles it's own reconnections: https://github.com/doctrine/dbal/blob/3.0.x/UPGRADE.md#the-pingableconnection-interface-is-removed

Signed-off-by: Robin Appelman <robin@icewind.nl>
2021-02-09 16:40:09 +01:00
Daniel Kesselberg fe378200fa
Check for generic errors at last.
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2021-02-02 18:28:49 +01:00
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