Commit Graph

96 Commits (feat/database/query-result-fetch-associative-fetch-num)

Author SHA1 Message Date
Joas Schilling 5a1fcdb272
fix(dbal): Migrate to Doctrine\DBAL\ParameterTypes
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-08-23 09:08:08 +07:00
Simon L d55a7c619d Fix typos in lib/public subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/public`

Signed-off-by: luz paz <luzpaz@github.com>

Update lib/public/Accounts/IAccount.php

Signed-off-by: luz paz <luzpaz@github.com>

Signed-off-by: Simon L <szaimen@e.mail.de>
Co-Authored-By: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
2023-05-10 11:56:34 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
Robin Appelman 6e0123a1d0 Revert "add case statement to sql function builder"
This reverts commit 2a68819a67.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 12:07:13 +07:00
Robin Appelman 9b52663a81 Revert "make expression build return IQueryFunction instead of string"
This reverts commit 813b50ed42.

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-08-16 12:07:09 +07:00
Robin Appelman 2a68819a67
add case statement to sql function builder
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-06-02 15:52:12 +07:00
Robin Appelman 813b50ed42
make expression build return IQueryFunction instead of string
this allows passing the expressions to further expressions without them being escaped as column names

Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-06-02 15:52:08 +07:00
Joas Schilling be4faebc47
Adjust docs to the same as the implementation
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-05-23 12:56:47 +07:00
Carl Schwan 9ec0cb0a90 Fix psalm issues related to the user backend
- Reflect the actual return value returned by the implementation in the
  the interface. E.g. IUser|bool -> IUser|false
- Remove $hasLoggedIn parameter from private countUser implementation.
  Replace the two call with the equivalent countSeenUser
- getBackend is nuallable, add this to the interface
- Use backend interface to make psalm happy about call to undefined
  methods. Also helps with getting rid at some point of the old
  implementActions

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-20 17:14:58 +07:00
Robin Appelman a4e120c203
tell mysql to ignore the sort index for search queries
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-04-22 13:42:33 +07:00
Carl Schwan 7817845538 Add a metadata service to store file metadata
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-04-13 14:06:29 +07:00
Côme Chilliet efebbacca4 Add octetLength and charLength to function builder, and tests
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 20:35:02 +07:00
Carl Schwan c870bd1968 Do chuncked job deletion
This is helpful in cases where we are deleting tons jobs at the same
time in a gallera cluster. This doesn't happen often but this can create
issues.

Test plan:

1. Use https://github.com/nextcloud/quota_warning/pull/88
2. Change max to 1
3. Enabled/Disable quota_warning app and see jobs getting sucessfully
   added and removed

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-03-17 21:41:58 +07:00
Joas Schilling fccb98c8b6
Merge pull request #30379 from nextcloud/feature/add-comments-reactions
Add comments reactions
2022-01-21 15:08:12 +07:00
Joas Schilling d850dc0220
Remove order from groupConcat as it is not working everywhere
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-21 08:39:39 +07:00
Vitor Mattos f071b4dfbb
Fix groupConcat and ordering on Oracle
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-21 08:39:39 +07:00
Vitor Mattos afe5b6dd8a
Prevent query error when use subquery
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-21 08:37:06 +07:00
Joas Schilling de9fe8fcc1
Merge pull request #30471 from nextcloud/enh/cast-char-mysql
Explicitly cast char in the query builder
2022-01-20 14:32:56 +07:00
Vitor Mattos 814924a787
Accept multipe args on concat
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-06 08:12:10 +07:00
Julius Härtl a169ca306e
Explicitly cast char in the query builder
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-01-04 16:53:00 +07:00
Joas Schilling 005e717fe6
Use quote function
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-04 13:59:54 +07:00
Joas Schilling 46ad6fa3c7
Add a test with integer
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-04 09:15:17 +07:00
Vitor Mattos fb6a9f308d
Add unit test
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-03 21:41:38 +07:00
Vitor Mattos 7b9fea85b6
Add unit test and orderBy parameter
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-03 12:45:00 +07:00
Vitor Mattos 79b3df00f8
Add group_concat aggregator function
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-03 07:48:11 +07:00
Côme Chilliet 18a91f02fa
Fix default value for $type in OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder::literal
This fixes PHP errors about passing null to PDO::quote second parameter.
We may want to change IExpressionBuilder as well?

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2021-11-23 09:29:02 +07:00
Joas Schilling 5bb49feef8
Allow NULL as well for limit, not integer only
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-11-15 18:51:28 +07:00
Christoph Wurst 130ab63ca1
Bump doctrine/dbal from 3.0.0 to 3.1.3
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-10-22 09:03:45 +07:00
Joas Schilling aae16c21e6
Allow casting query functions as well
Signed-off-by: Joas Schilling <coding@schilljs.com>
2021-07-07 14:20:24 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Lukas Reschke 4e7b82169c executeUpdate is also deprecated
Ref 1089ad5d9e/lib/private/DB/QueryBuilder/QueryBuilder.php (L312-L323)

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-05-25 20:25:44 +07:00
Christoph Wurst 865661ed75
Rename IQueryBuilder::executeUpdate to IQueryBuilder::executeStatement
Because executeUpdate wasn't a great name. And in DBAL they also use
executeStatement more consistently now.

Ref https://github.com/doctrine/dbal/issues/4607

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2021-05-05 10:31:54 +07:00
Roeland Jago Douma 85e48d796c
Merge pull request #25929 from nextcloud/techdept/psalm/25839/redundantcasts
Remove Redundantcasts
2021-03-05 08:42:54 +07:00
Roeland Jago Douma d7f7d3bc51 Type CompositeExpression and ICompositeExpression
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-04 21:47:44 +07:00
Roeland Jago Douma c3f1eb4f7f Remove Redundantcasts
For #25839

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-04 14:44:04 +07: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 +07:00
Joas Schilling a6246be34c
Merge pull request #25656 from nextcloud/enh/type/expressionbuilder
Type the experssionbuilders
2021-03-03 11:37:16 +07:00
Roeland Jago Douma 4bdf9f5849 Type the experssionbuilders
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2021-03-03 10:44:09 +07: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 +07:00
Lukas Reschke d7590a6190
Add expression taint source and sanitizer
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
2021-02-17 21:38:15 +07: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 +07: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 +07:00
Christoph Wurst 9ce3ea3368
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-30 14:07:05 +07: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 +07: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 +07:00
Joas Schilling a8cb8e21c1
Add types to function builder
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-16 19:46:24 +07:00
Joas Schilling d9e471771a
Update parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
2020-11-07 14:06:03 +07:00
Roeland Jago Douma fe46149560
Psalm fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-10-30 19:27:53 +07: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 +07: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 +07:00