Commit Graph

18 Commits

Author SHA1 Message Date
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
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 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
Morris Jobke 99c9423766
Remove @suppress SqlInjectionChecker
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-09-16 15:53:56 +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
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 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +01:00
Morris Jobke f889beae7e
Fix PHPDoc
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2019-03-21 17:05:57 +01:00
Ole Ostergaard 0d778fcc4e Code cleanup.
Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
2019-03-21 11:42:00 +01:00
Ole Ostergaard d62da82bf9 Add supression of SqlInjectionChecker.
Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
2019-03-21 11:42:00 +01:00
Ole Ostergaard a48ea8cffa Add insertIgnoreConflict to Adapter and use it for for executing the file locking.
Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
2019-03-21 11:42:00 +01:00
Morris Jobke 5273639d0e
Add deprecation message ofr insertIfNotExist
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-11-09 12:13:30 +01:00
Morris Jobke 230e93f575
Catch UniqueConstraintViolationException inside insertIfNotExist
This is the most common case for the usage of this method.

See also https://github.com/nextcloud/server/issues/12369 and the linked tickets.

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-11-09 10:38:20 +01:00
Morris Jobke e6efa755c9
Use short for of substr to not need strlen()
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-25 22:23:48 +01:00
Joas Schilling 0215b004da
Update with robin 2016-07-21 18:13:58 +02:00
Joas Schilling ba87db3fcc
Fix others 2016-07-21 18:13:57 +02:00
Joas Schilling 7e3ce83526
Add a method to lock a table 2016-05-21 01:59:03 +02:00
Roeland Jago Douma d09f835dca
Move \OC\DB to PSR-4
Besides the statement wrapper that is moved to the legacy folder
(namepsace of shame folder)
2016-04-15 19:46:34 +02:00