Skip to content

Filter SQL queries - #4064

Merged
ozh merged 8 commits into
masterfrom
YDB_wrappers
Apr 6, 2026
Merged

ozh merged 8 commits into
masterfrom
YDB_wrappers

Conversation

@ozh

@ozh ozh commented Feb 15, 2026

Copy link
Copy Markdown
Member

This one is neat.

It introduces the ability to filter SQL query statements, or completely bypass fetch* methods.

Practical uses :

  • rewrite all queries to make things compatible with PostgreSQL without hacking core
  • bypass SQL queries to store and retrieve stuff from cache
  • and many more stuff of course

Postgresql plugin functional :
image

Cache plugin functional, support APCu, Redis, Memcache, or writing to disk
image

ozh added 7 commits February 3, 2026 22:04
(ie "fetchPair", "fetchObject", etc.. not just "perform")
When no URL, the query returns a null and number_format() throws a deprecation notice
Much cleaner to return integers anyway.
Sufficient for the unit tests and compatible with more DB engines

@LeoColomb LeoColomb 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.

Quite a big chunk to review! 😅
Seems pretty fair on the principle.
That said, is it really needed to reimplement all parent class fetch functions?
As they all call perform() anyway, wouldn't it be just good enough to override this one to include the filter?

@ozh

ozh commented Mar 14, 2026

Copy link
Copy Markdown
Member Author

Thanks for reviewing !!

Legit question. The answer is that the fetchXXX functions return serializable content, while perform returns a PDO statement. I needed to identify the fetch method for a cache plugin concept, without using an ugly debug_backtrace() in perform to guess the caller (fetchOne, fetchPairs, etc...)

@LeoColomb

Copy link
Copy Markdown
Member

AI answer, right? 😅
Because "ugly debug_backtrace()" is actually used through this change set already. So not really logical…

@ozh

ozh commented Mar 14, 2026

Copy link
Copy Markdown
Member Author

Nope, my own words :)

Regarding the other debugbacktrace : I was relunctant to use it but couldn't find another way. Eventually used it because it's only used when debug is true.

In perform it would be always active, which I thought would be a bad idea

@ozh

ozh commented Mar 17, 2026

Copy link
Copy Markdown
Member Author

Is there anything, or anything else, that I may clarify to move on with this PR?

@ozh
ozh merged commit df4ede5 into master Apr 6, 2026
8 checks passed
@ozh
ozh deleted the YDB_wrappers branch April 6, 2026 08:54
@dgw dgw added this to the 1.10.4 milestone May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants