Feature to not append database prefix in QueryBuilder |
(Yesterday, 04:24 AM)michalsn Wrote: Why do you even need to skip DBPrefix if you have set it in the connection group? If I understand what you are suggesting correctly, you want me to create a custom connection group to handle no db prefix like this: PHP Code: $noPrefix = [ Then call $db = \Config\Database::connect($noPrefix); when needed. While generally that would resolve the problem, it doesn't resolve the problem where you need to selectively not add the prefix. For example, here is my current workaround PHP Code: function foreignKeyExists(string $constraintName, string $tableName): bool { You are suggesting this change: PHP Code: function foreignKeyExists(string $constraintName, string $tableName): bool { The problem with this is that I don't need to remove the prefix in the entire query, just in the table. Notice my 2nd where statement depends on the tableName with a prefix. I'm requesting the feature to have table() allow not appending the prefix so the code becomes PHP Code: function foreignKeyExists(string $constraintName, string $tableName): bool { And the signature to table() becomes PHP Code: public function table(string $tableName, string $appendPrefix = true) This would be a non-breaking change because the default value when $appendPrefix is not passed is true. That said, I respect that this may not be a straightforward change, but it would a useful change. |
Messages In This Thread |
Feature to not append database prefix in QueryBuilder - by objecttothis - Yesterday, 02:37 AM
RE: Feature to not append database prefix in QueryBuilder - by michalsn - Yesterday, 03:43 AM
RE: Feature to not append database prefix in QueryBuilder - by objecttothis - Yesterday, 03:59 AM
RE: Feature to not append database prefix in QueryBuilder - by michalsn - Yesterday, 04:24 AM
RE: Feature to not append database prefix in QueryBuilder - by objecttothis - Yesterday, 05:41 AM
RE: Feature to not append database prefix in QueryBuilder - by michalsn - 4 hours ago
|