summaryrefslogtreecommitdiffstats
path: root/lib/private/DB/Connection.php
Commit message (Collapse)AuthorAgeFilesLines
* Update php licensesJohn Molakvoæ (skjnldsv)2021-06-041-1/+0
| | | | Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
* Cleanup unneeded code around database.xmlMorris Jobke2021-03-241-4/+24
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* remove ReconnectWrapperRobin Appelman2021-02-091-1/+4
| | | | | | 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>
* Add our own DB exception abstractionChristoph Wurst2021-01-121-1/+24
| | | | | | | | | | | | | | | | | | 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>
* Bump doctrine/dbal from 2.12.0 to 3.0.0Christoph Wurst2021-01-081-24/+34
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update all license headers for Nextcloud 21Christoph Wurst2020-12-161-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Don't try to update on NotNullConstraintViolationException, only on unique ↵Joas Schilling2020-11-101-0/+3
| | | | | | or foreign key Signed-off-by: Joas Schilling <coding@schilljs.com>
* Fix comparing the empty string for global credentialsJoas Schilling2020-11-101-5/+11
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Replace prefix in executeUpdateJulius Härtl2020-11-031-0/+3
| | | | Signed-off-by: Julius Härtl <jus@bitgrid.net>
* Psalm fixesRoeland Jago Douma2020-10-301-10/+14
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Update internal connection classRoeland Jago Douma2020-10-301-2/+2
| | | | | | | 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>
* Fetch the logger and system config once for all query builder instancesMorris Jobke2020-10-291-8/+15
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Format code to a single space around binary operatorsChristoph Wurst2020-10-051-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Log the number of queries built and executedJoas Schilling2020-09-251-0/+18
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Remove @suppress SqlInjectionCheckerMorris Jobke2020-09-161-1/+0
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Format control structures, classes, methods and functionChristoph Wurst2020-04-101-7/+4
| | | | | | | | | | | | | | | 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>
* Use elseif instead of else ifChristoph Wurst2020-04-101-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Remove trailing and in between spacesChristoph Wurst2020-04-091-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Unify function spacing to PSR2 recommendationChristoph Wurst2020-04-091-3/+3
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Update the license headers for Nextcloud 19Christoph Wurst2020-03-311-1/+1
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #20170 from nextcloud/techdebt/remove-unused-importsChristoph Wurst2020-03-271-1/+0
|\ | | | | Remove unused imports
| * Remove unused importsChristoph Wurst2020-03-251-1/+0
| | | | | | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* | Use the short array syntax, everywhereChristoph Wurst2020-03-261-4/+4
|/ | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Add event subscriber for transaction isolation levelDaniel Kesselberg2020-02-211-2/+0
| | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* Update license headersChristoph Wurst2019-12-051-1/+4
| | | | Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Merge pull request #17949 from nextcloud/debt/deprecated-constJoas Schilling2019-12-041-1/+2
|\ | | | | Connection::TRANSACTION_READ_COMMITTED is deprecated
| * Connection::TRANSACTION_READ_COMMITTED is deprecatedDaniel Kesselberg2019-11-141-1/+2
| | | | | | | | Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
* | Some php-cs fixesRoeland Jago Douma2019-11-221-4/+4
|/ | | | | | | | | | | * 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>
* Code cleanup.Ole Ostergaard2019-03-211-2/+2
| | | | Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
* Add insertIgnoreConflict to Adapter and use it for for executing the file ↵Ole Ostergaard2019-03-211-0/+4
| | | | | | locking. Signed-off-by: Ole Ostergaard <ole.c.ostergaard@gmail.com>
* Add deprecation message ofr insertIfNotExistMorris Jobke2018-11-091-0/+1
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Catch UniqueConstraintViolationException inside insertIfNotExistMorris Jobke2018-11-091-1/+3
| | | | | | | | 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>
* Check connection status and attempt to reconnect each each minuteRobin Appelman2018-05-081-1/+1
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* refactor user searchingRobin Appelman2017-12-201-1/+1
| | | | | | add additional user searching tests Signed-off-by: Robin Appelman <robin@icewind.nl>
* Update license headersMorris Jobke2017-11-061-0/+2
| | | | Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Add Phan plugin to check for SQL injectionsLukas Reschke2017-07-201-0/+1
| | | | | | | | | | This adds a phan plugin which checks for SQL injections on code using our QueryBuilder, while it isn't perfect it should already catch most potential issues. As always, static analysis will sometimes have false positives and this is also here the case. So in some cases the analyzer just doesn't know if something is potential user input or not, thus I had to add some `@suppress SqlInjectionChecker` in front of those potential injections. The Phan plugin hasn't the most awesome code but it works and I also added a file with test cases. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
* Start migrationsJoas Schilling2017-07-051-0/+24
| | | | | | | | | | Fixme: - Install and update of apps - No revert on live systems (debug only) - Service adjustment to our interface - Loading via autoloader Signed-off-by: Joas Schilling <coding@schilljs.com>
* Adjust query/event logging code in favour of more complex ↵Piotr Mrówczyński2017-04-261-3/+0
| | | | | | | owncloud/diagnostics (#27643) * Adjust query/event logging code in favour of more complex owncloud/diagnostics * Add descriptions to IQueryLogger and IEventLogger interfaces
* Address commentsMorris Jobke2017-03-211-4/+1
| | | | | | | | | * fix URL to documentation * improve logic of UTF8mb4 check * fix connection parameter creation - it's done already in ConnectionFactory::createConnectionParams * remove unused attributes of MDB2SchemaReader Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Adding tests for 4 byte unicode charactersMorris Jobke2017-03-211-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * success on SQLite and Postgres * failure on MySQL due to the limited charset that only supports up to 3 bytes Add config option to update charset of mysql to utf8mb4 * fully optional * requires additional options set in the database only disable unicode test on mysql Fixing ctor call Adding docker based unit test execution for mysql utf8mb4 Add mysqlmb4 test configuration to Jenkinsfile fix collation on utf8mb4 Properly setup charset and collation in the doctrine connection Allow files containing 4-byte chars in case the database supports it During setup of a mysql database we try to detect if charset 'utf8mb4' can be used Fix mysql settings Add console command to migrate the charset Set ROW_FORMAT before setting collation to mb4 Also select tables with wrong collation Faster MySQL docker Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* Fixed failing test which was ignoring a required (not null) column (#26303)Philipp Schaffrath2017-03-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | * Fixed failing test which was ignoring a required (not null) column * restored test to original, catching DriverException which also catches ConstraintViolationException * catch ConstraintViolationException again * removed unnecessary field from this test * clobfield should be nullable * clobfield now is nullable * removed autoincrement since whenever this strategy is enabled, oracle would not throw constraint violation exceptions (needed for setValues), which mysql still does * this field does not auto increment anymore * mark integerfield as primary, since it is not getting marked as such through auto increment anymore, integerfield default always has been 0 instead of null Signed-off-by: Morris Jobke <hey@morrisjobke.de>
* @since 9.2.0 to @since 11.0.0Roeland Jago Douma2016-11-151-1/+1
| | | | Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
* Inject config and loggerJoas Schilling2016-11-021-1/+5
| | | | Signed-off-by: Joas Schilling <coding@schilljs.com>
* Allow 4byte unicode filenames on supported platformsRobin Appelman2016-10-201-0/+11
| | | | Signed-off-by: Robin Appelman <robin@icewind.nl>
* Update with robinJoas Schilling2016-07-211-1/+1
|
* Fix othersJoas Schilling2016-07-211-3/+4
|
* Update license headersLukas Reschke2016-05-261-0/+1
|
* Add a method to lock a tableJoas Schilling2016-05-211-1/+31
|
* Fix broken exception namingRoeland Jago Douma2016-05-191-3/+3
|
* Move \OC\DB to PSR-4Roeland Jago Douma2016-04-151-0/+373
Besides the statement wrapper that is moved to the legacy folder (namepsace of shame folder)