![]() |
The code is the same (using builder):
Code: public function getAllEmployeesEvaluators() { In v4.1.1, I get: Code: SELECT DISTINCT "Employee_Number", "Employee_Last", "Employee_first", "Job", "Building"."Description" in v4.4.3 I get: Code: SELECT DISTINCT "Employee_Number", "Employee_Last", "Employee_first", "Job", "Building"."Description" I've looked for change log notes on when this changed or how to address cross database queries, but I've not found anything. This seems like a bug, we have a qualified table name (Forms_Test..Evaluation_Takers) that doesn't need a prefix, yet the code is forcing one to happen. Anyone have ideas on settings or some change log entry I've missed?
Searching the *correct* previous version (edited it from 4.1.2 to 4.1.1 which is the one I am actually using) I found that the SQLSRV didn't have the join functionality in it, so the default join was being used from the base builder class.
HOWEVER (and undocumented in the v4.1.2 change log) they included the join in the SQLSRV builder.php file. The key differences are here: v4.1.2+ Code: // Assemble the JOIN statement v4.1.1 (using the default builder join code) Code: // Assemble the JOIN statement and the getFullName function: Code: private function getFullName(string $table): string which is why I'm seeing the differences between the two returns. Now I just need to sort out how to either force the base builder's join version - or - override the SQLSRV join's version to check for already declared database name and schema.
It is this bug fix: https://github.com/codeigniter4/CodeIgniter4/pull/4246
And as you said, it is not documented in the changelog: https://github.com/codeigniter4/CodeIgni...2021-05-18
That is a bug fix, and your usage does not seem to be assumed.
So it seems better to extend the DB classes. See https://forum.codeigniter.com/thread-782...83813.html
(12-11-2023, 05:11 PM)kenjis Wrote: That is a bug fix, and your usage does not seem to be assumed. Thanks, between the two posts I was able to solve the issue. Sadly, the way we do alternate databases doesn't work (the double periods was causing issues), so I just ended up replacing the join function with the basebuilder one. In case someone wants to avoid the guessing game... here is what I did: Created class files in App/Database/Mydriver for Connection, Builder, Forge, PreparedQuery, Result and Utils The Connection.php file: Code: <?php The Builder.php file: Code: <?php Then in the .ENV file: Code: database.default.DBDriver = 'App\Database\Mydriver' or in the App/Config/Database.php file: Code: public array $default = [ All of the other class files look like this (each with their own name and extended from the correct class): Code: <?php Also, in the Autoloader.php in the App/Config, I added this (although I don't think it is needed): Code: public $classmap = [ There is likely a more elegant way to solve this, but this got this part done so I could move on to the rest of the issues. |
Welcome Guest, Not a member yet? Register Sign In |