Skip to content

respect DB restrictions on number of arguments in statements and queries#25036

Merged
blizzz merged 3 commits into
masterfrom
fix/noid/limitied-allowed-items-db-in_2
Jan 14, 2021
Merged

respect DB restrictions on number of arguments in statements and queries#25036
blizzz merged 3 commits into
masterfrom
fix/noid/limitied-allowed-items-db-in_2

Conversation

@blizzz

@blizzz blizzz commented Jan 8, 2021

Copy link
Copy Markdown
Member

Follow up of #25020

Additionally to what was stated before:

  • in the relevant LDAP issue run the query before there are too many parameters
  • the query builder logs when there are too many parameters in total per statement (by array type parameter)

@blizzz

blizzz commented Jan 8, 2021

Copy link
Copy Markdown
Member Author

/backport to stable20

@blizzz

blizzz commented Jan 8, 2021

Copy link
Copy Markdown
Member Author

/backport to stable19

@blizzz

blizzz commented Jan 8, 2021

Copy link
Copy Markdown
Member Author

might lead to a small conflict with #24948 (execute method in our QueryBuilder), but nothing dramatic.

Comment thread lib/private/DB/QueryBuilder/QueryBuilder.php Outdated
Comment thread apps/user_ldap/lib/Mapping/AbstractMapping.php Outdated
@rullzer rullzer mentioned this pull request Jan 8, 2021
5 tasks
@blizzz blizzz force-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from 36ed317 to e7c2cd8 Compare January 8, 2021 17:57
@blizzz

blizzz commented Jan 8, 2021

Copy link
Copy Markdown
Member Author

rebased and adjusted to the dbal bump.

@blizzz blizzz requested a review from nickvergessen January 8, 2021 17:59
@blizzz blizzz force-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from e7c2cd8 to ef28844 Compare January 8, 2021 18:05
@rullzer rullzer mentioned this pull request Jan 11, 2021
14 tasks
@MorrisJobke

Copy link
Copy Markdown
Member

Postgres says "no".

@blizzz

blizzz commented Jan 11, 2021

Copy link
Copy Markdown
Member Author

Postgres says "no".

aye. seems to be a form of off-by-1

But confirms the test is working 🚀

@blizzz blizzz force-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from ef28844 to 90005a6 Compare January 11, 2021 10:31
@blizzz blizzz added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jan 11, 2021
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz force-pushed the fix/noid/limitied-allowed-items-db-in_2 branch from 90005a6 to f9484d1 Compare January 11, 2021 12:43
@blizzz blizzz added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 11, 2021
@blizzz

blizzz commented Jan 11, 2021

Copy link
Copy Markdown
Member Author

Postgres says "no".

Not anymore 🧑‍🔧

$slice++;
$fdnsSlice = array_slice($fdns, $sliceSize * ($slice - 1), $sliceSize);

if (!isset($qb)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Psalm:

TypeDoesNotContainType: Cannot resolve types for $qb with type OCP\DB\QueryBuilder\IQueryBuilder and !isset assertion

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It occurs to me that Psalm does not understand the unset(), or am I wrong?

@blizzz blizzz Jan 12, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
@blizzz blizzz requested a review from MorrisJobke January 13, 2021 14:22
@rullzer rullzer mentioned this pull request Jan 14, 2021
15 tasks

@ChristophWurst ChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has tests, so what could go wrong 👍

FYI https://www.php.net/manual/en/function.array-chunk.php seems a tad more elegant than manual slicing, but the result is the same

@blizzz

blizzz commented Jan 14, 2021

Copy link
Copy Markdown
Member Author

Has tests, so what could go wrong +1

FYI https://www.php.net/manual/en/function.array-chunk.php seems a tad more elegant than manual slicing, but the result is the same

would have a bigger memory footprint as it would return all slices at once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants