mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: handle unknown tbale names
This commit is contained in:
parent
3dea698c93
commit
219ecd18b5
@ -2711,6 +2711,10 @@ fn (mut c Checker) sql_expr(mut node ast.SqlExpr) table.Type {
|
|||||||
c.inside_sql = false
|
c.inside_sql = false
|
||||||
}
|
}
|
||||||
sym := c.table.get_type_symbol(node.table_type)
|
sym := c.table.get_type_symbol(node.table_type)
|
||||||
|
if sym.kind == .placeholder {
|
||||||
|
c.error('orm: unknown type `$sym.name`', node.pos)
|
||||||
|
return table.void_type
|
||||||
|
}
|
||||||
c.cur_orm_ts = sym
|
c.cur_orm_ts = sym
|
||||||
info := sym.info as table.Struct
|
info := sym.info as table.Struct
|
||||||
fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
|
fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
|
||||||
@ -2751,7 +2755,14 @@ fn (mut c Checker) sql_stmt(mut node ast.SqlStmt) table.Type {
|
|||||||
defer {
|
defer {
|
||||||
c.inside_sql = false
|
c.inside_sql = false
|
||||||
}
|
}
|
||||||
|
if node.table_type == 0 {
|
||||||
|
c.error('orm: unknown type `$node.table_name`', node.pos)
|
||||||
|
}
|
||||||
sym := c.table.get_type_symbol(node.table_type)
|
sym := c.table.get_type_symbol(node.table_type)
|
||||||
|
if sym.kind == .placeholder {
|
||||||
|
c.error('orm: unknown type `$sym.name`', node.pos)
|
||||||
|
return table.void_type
|
||||||
|
}
|
||||||
c.cur_orm_ts = sym
|
c.cur_orm_ts = sym
|
||||||
info := sym.info as table.Struct
|
info := sym.info as table.Struct
|
||||||
fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
|
fields := c.fetch_and_verify_orm_fields(info, node.pos, node.table_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user