-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't emit "FOR UPDATE .." On SQLite
Rather than just ignore it like it does for other things it doesn't implement, SQLite throws an error with 'FOR UPDATE' on a select statement. This just over-rides with an implementation that doesn't emit anything if there is a '.for'. The test just checks it doesn't explode with .skip-update, I've confirmed the SQL generated for both Pg and SQLite visually.
- Loading branch information
1 parent
715ae29
commit 20afb07
Showing
3 changed files
with
44 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use Test; | ||
use Red; | ||
|
||
model Foo { | ||
has Int $.bar is serial; | ||
has Str $.foo is column; | ||
} | ||
|
||
my $*RED-DEBUG = $_ with %*ENV<RED_DEBUG>; | ||
my $*RED-DEBUG-RESPONSE = $_ with %*ENV<RED_DEBUG_RESPONSE>; | ||
my @conf = (%*ENV<RED_DATABASE> // "SQLite").split(" "); | ||
my $driver = @conf.shift; | ||
my $*RED-DB = database $driver, |%( @conf.map: { do given .split: "=" { .[0] => val .[1] } } ); | ||
|
||
schema(Foo).drop; | ||
Foo.^create-table; | ||
|
||
Foo.^create: foo => "babaa"; | ||
|
||
my @rows; | ||
lives-ok { @rows = Foo.^rs.skip-locked.all }, 'with skip-locked'; | ||
|
||
is @rows.elems, 1, "got the right number of rows"; | ||
|
||
done-testing |