mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
orm: add table creation (#9621)
This commit is contained in:
@@ -127,6 +127,25 @@ fn (mut p Parser) sql_stmt() ast.SqlStmt {
|
||||
kind = .delete
|
||||
} else if n == 'update' {
|
||||
kind = .update
|
||||
} else if n == 'create' {
|
||||
kind = .create
|
||||
table := p.check_name()
|
||||
if table != 'table' {
|
||||
p.error('expected `table` got `$table`')
|
||||
return ast.SqlStmt{}
|
||||
}
|
||||
typ := p.parse_type()
|
||||
typ_pos := p.tok.position()
|
||||
p.check(.rcbr)
|
||||
return ast.SqlStmt{
|
||||
db_expr: db_expr
|
||||
kind: kind
|
||||
pos: pos.extend(p.prev_tok.position())
|
||||
table_expr: ast.TypeNode{
|
||||
typ: typ
|
||||
pos: typ_pos
|
||||
}
|
||||
}
|
||||
}
|
||||
mut inserted_var_name := ''
|
||||
mut table_type := ast.Type(0)
|
||||
|
||||
Reference in New Issue
Block a user