Commit Graph

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

Author SHA1 Message Date
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Joas Schilling ecad09b38a
Merge pull request #36261 from nextcloud/techdebt/noid/warn-devs-about-potential-bugs
fix(querybuilder): Log a warning if where() is called again on a quer…
2023-01-23 18:47:25 +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
Joas Schilling 7f0a54c558
fix(querybuilder): Log a warning if where() is called again on a query builder object
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-01-20 07:41:19 +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
luz paz 368f83095d Fix typos in lib/private subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/private`

Signed-off-by: luz paz <luzpaz@github.com>
2022-07-27 08:52:17 +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
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
Côme Chilliet 765999f454
Merge pull request #31609 from nextcloud/fix/migrate-away-from-ilogger
Migrate from ILogger to LoggerInterface in lib/private
2022-03-29 09:39:38 +07:00
Côme Chilliet 7407a324d9
Fix LENGTH function name across databases
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-28 00:01:17 +07:00
Côme Chilliet 25af856ed2 Use OCTET_LENGTH which is more common than LENGTHB
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 20:35:02 +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
Côme Chilliet f1febfe696
Fix log level for exception in QueryBuilder
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:28 +07:00
Côme Chilliet 6be7aa112f
Migrate from ILogger to LoggerInterface in lib/private
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-03-24 16:21:25 +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 f732cf1b04
Unit tests
Signed-off-by: Vitor Mattos <vitor@php.rio>
2022-01-07 09:54:41 +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
Joas Schilling eebed2c434
Fix psalm complaint
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-04 17:32:07 +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 ecc92067bf
Try escaping Oracle single quotes
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-04 13:36:55 +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
Joas Schilling e3e73a12ef
Fix oracle LISTAGG
Signed-off-by: Joas Schilling <coding@schilljs.com>
2022-01-03 21:43:53 +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
Arthur Schiwon ce283c12b6
make it possible to override the default collation
- allows admins to configure it for edge cases like accent sensitivity

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2021-09-01 11:57:47 +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
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
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 +07: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 +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