-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser: disallow invalid infix for where clause in
delete
and update
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
vlib/v/parser/tests/orm_delete_where_invalid_inifx_err.vv:23:49: error: undefined variable: `client_id` | ||
21 | }! | ||
22 | sql db { | ||
23 | delete from ParameterTable where client_id == client_id && name == name | ||
| ~~~~~~~~~ | ||
24 | } or { panic(err) } | ||
25 | } |
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 @@ | ||
import db.sqlite | ||
import rand | ||
import time | ||
|
||
@[table: 'parameter_tables'] | ||
struct ParameterTable { | ||
id string = rand.ulid() @[primary] | ||
name string @[unique: 'client_table'] | ||
description string | ||
table_type string = 'parameter' | ||
client_id string @[unique: 'client_table'] | ||
created time.Time @[default: 'CURRENT_TIMESTAMP'; sql_type: 'datetime'] | ||
} | ||
|
||
fn main() { | ||
mut db := sqlite.connect('test.db')! | ||
db.synchronization_mode(sqlite.SyncMode.off)! | ||
db.journal_mode(sqlite.JournalMode.memory)! | ||
sql db { | ||
create table ParameterTable | ||
}! | ||
sql db { | ||
delete from ParameterTable where client_id == client_id && name == name | ||
} or { panic(err) } | ||
} |