mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parent
9344c27021
commit
be1e40dac0
@ -45,6 +45,7 @@ const (
|
|||||||
'vlib/sqlite/sqlite_orm_test.v',
|
'vlib/sqlite/sqlite_orm_test.v',
|
||||||
'vlib/v/tests/orm_sub_struct_test.v',
|
'vlib/v/tests/orm_sub_struct_test.v',
|
||||||
'vlib/v/tests/orm_sub_array_struct_test.v',
|
'vlib/v/tests/orm_sub_array_struct_test.v',
|
||||||
|
'vlib/v/tests/sql_statement_inside_fn_call_test.v',
|
||||||
'vlib/vweb/tests/vweb_test.v',
|
'vlib/vweb/tests/vweb_test.v',
|
||||||
'vlib/vweb/request_test.v',
|
'vlib/vweb/request_test.v',
|
||||||
'vlib/net/http/request_test.v',
|
'vlib/net/http/request_test.v',
|
||||||
@ -83,6 +84,7 @@ const (
|
|||||||
'vlib/orm/orm_test.v',
|
'vlib/orm/orm_test.v',
|
||||||
'vlib/v/tests/orm_sub_struct_test.v',
|
'vlib/v/tests/orm_sub_struct_test.v',
|
||||||
'vlib/v/tests/orm_sub_array_struct_test.v',
|
'vlib/v/tests/orm_sub_array_struct_test.v',
|
||||||
|
'vlib/v/tests/sql_statement_inside_fn_call_test.v',
|
||||||
'vlib/clipboard/clipboard_test.v',
|
'vlib/clipboard/clipboard_test.v',
|
||||||
'vlib/vweb/tests/vweb_test.v',
|
'vlib/vweb/tests/vweb_test.v',
|
||||||
'vlib/vweb/request_test.v',
|
'vlib/vweb/request_test.v',
|
||||||
|
@ -759,9 +759,11 @@ fn (mut g Gen) sql_select(node ast.SqlExpr, expr string, left string) {
|
|||||||
if node.is_array {
|
if node.is_array {
|
||||||
g.write('_array')
|
g.write('_array')
|
||||||
}
|
}
|
||||||
|
if !g.inside_call {
|
||||||
g.writeln(';')
|
g.writeln(';')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn (mut g Gen) parse_db_type(expr ast.Expr) SqlType {
|
fn (mut g Gen) parse_db_type(expr ast.Expr) SqlType {
|
||||||
match expr {
|
match expr {
|
||||||
|
24
vlib/v/tests/sql_statement_inside_fn_call_test.v
Normal file
24
vlib/v/tests/sql_statement_inside_fn_call_test.v
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import sqlite
|
||||||
|
|
||||||
|
struct Movie {
|
||||||
|
id int [primary]
|
||||||
|
name string
|
||||||
|
}
|
||||||
|
|
||||||
|
fn x(m Movie) int {
|
||||||
|
return m.id
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_sql_statement_inside_fn_call() {
|
||||||
|
db := sqlite.connect(':memory:') or { panic('failed') }
|
||||||
|
sql db {
|
||||||
|
create table Movie
|
||||||
|
}
|
||||||
|
m := Movie{1, 'Maria'}
|
||||||
|
sql db {
|
||||||
|
insert m into Movie
|
||||||
|
}
|
||||||
|
dump(x(sql db {
|
||||||
|
select from Movie where id == 1
|
||||||
|
}))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user