This commit is contained in:
krchi 2025-08-19 21:24:37 +08:00
parent c68e37e3e5
commit a6af25dd1c
2 changed files with 7 additions and 5 deletions

View file

@ -61,6 +61,12 @@ fn test_print_results() {
insert account into Account insert account into Account
}! }!
i := sql db {
insert account into Account
}!
println(i)
count := sql db { count := sql db {
select count from Account select count from Account
}! }!

View file

@ -190,17 +190,13 @@ fn (mut c Checker) sql_expr(mut node ast.SqlExpr) ast.Type {
} }
c.expr(mut node.db_expr) c.expr(mut node.db_expr)
if node.is_insert { if node.is_insert {
node.typ = ast.int_type node.typ = ast.int_type.set_flag(.result)
} }
last_cur_or_expr := c.cur_or_expr last_cur_or_expr := c.cur_or_expr
c.cur_or_expr = &node.or_expr c.cur_or_expr = &node.or_expr
c.check_orm_or_expr(mut node) c.check_orm_or_expr(mut node)
c.cur_or_expr = last_cur_or_expr c.cur_or_expr = last_cur_or_expr
if node.is_insert {
return ast.int_type
}
return node.typ.clear_flag(.result) return node.typ.clear_flag(.result)
} }