-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix BaseBuilder setAlias() and RawSql use with key value pairs #6741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
36f2432
Fix use of setAlias()
sclubricants 92b4881
Fix RawSql use
sclubricants 9cf0b96
Fix Alias and Raw Sql for OCI8
sclubricants 2e42aca
Fix Alias for Postgres
sclubricants bb8fc35
Fix alias for SQLite3
sclubricants e831c46
Fix alias and RawSql for SQLSRV
sclubricants 9028bba
Fix test usage of alias and add new test for RawSql key value pair
sclubricants 71a2a64
Add alias exception for Postgres and SQLite
sclubricants a8106ac
Fix escape identifier
sclubricants 88f7f52
Remove DBDebug test for throwing error.
sclubricants a12b8e7
Change Exception Type
sclubricants d180e7a
Fix class path
sclubricants 0084c3c
Fix class path
sclubricants File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -475,14 +475,38 @@ public function testRawSqlConstraint() | |
|
||
$builder = $this->db->table('user'); | ||
|
||
$builder->setData($data, true, 'db_myalias') | ||
$builder->setData($data, true, 'myalias') | ||
sclubricants marked this conversation as resolved.
Show resolved
Hide resolved
|
||
->updateFields('name, country') | ||
->onConstraint(new RawSql($this->db->protectIdentifiers('user.email') . ' = ' . $this->db->protectIdentifiers('myalias.email'))) | ||
->updateBatch(); | ||
|
||
$this->seeInDatabase('user', ['email' => '[email protected]', 'country' => 'Germany']); | ||
} | ||
|
||
public function testRawSqlConstraintWithKey() | ||
{ | ||
if ($this->db->DBDriver === 'SQLite3' && ! (version_compare($this->db->getVersion(), '3.33.0') >= 0)) { | ||
$this->markTestSkipped('Only SQLite 3.33 and newer can complete this test.'); | ||
} | ||
|
||
$data = [ | ||
[ | ||
'name' => 'Derek Jones', | ||
'email' => '[email protected]', | ||
'country' => 'Germany', | ||
], | ||
]; | ||
|
||
$builder = $this->db->table('user'); | ||
|
||
$builder->setData($data, true, 'myalias') | ||
->updateFields('name, country') | ||
->onConstraint(['email' => new RawSql($this->db->protectIdentifiers('myalias.email'))]) | ||
->updateBatch(); | ||
|
||
$this->seeInDatabase('user', ['email' => '[email protected]', 'country' => 'Germany']); | ||
} | ||
|
||
public function testNoConstraintFound() | ||
{ | ||
$jobData = [ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.