1
0
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:
Louis Schmieder
2021-04-07 15:27:02 +02:00
committed by GitHub
parent 3a07fbc653
commit ab03357a6e
5 changed files with 129 additions and 2 deletions

View File

@@ -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)