database icon indicating copy to clipboard operation
database copied to clipboard

🚀 Feature: Contains for SQL(MariaDB/MySQL/SQLite) adapter

Open mattie-cmsp opened this issue 2 years ago • 0 comments

🔖 Feature description

The SQL adapter including Maria/MySQL/SQLite should support the Contains query. I.E. attribute LIKE '%something%'

🎤 Pitch

Forgive me if I missed it somewhere, but I don't see any reason that the SQL connector doesn't already support "Contains" queries. The syntax is well know, supported by all 3 supported SQL engines(and most others), and simple and consistent across all versions of SQL.

So far as I can tell, this would only require changing 1 line of code to provide support, and one or two others to enable that support(instead of rejecting it).

src/Database/Adapter/SQL.php -> bindConditionValue, add:

Query::TYPE_CONTAINS => '%' . $this->escapeWildcards($value) . '%',

Please let me know if there is a reason this isn't already done. It seems so obvious that I can't help but think there is a reason it's not already done, and that I'm the one missing something obvious.

If needed, I'd be happy to clone, modify, and submit a PR.

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

mattie-cmsp avatar Nov 22 '23 21:11 mattie-cmsp