Exemplo n.º 1
0
        public override SQLiteParseTreeNode VisitCreate_table_stmt(SQLiteParserSimpleParser.Create_table_stmtContext context)
        {
            var ret = new CreateTableNode(context)
            {
                DatabaseName = context.database_name() == null ? null :  context.database_name().GetText(),
                TableName    = context.table_name().GetText(),
                Temp         = context.TEMPORARY() != null,
                IfNotExists  = context.IF() != null
            };

            if (context.AS() != null)
            {
                //it's a select stmt
                ret.SelectStmt = context.select_stmt().GetText();
            }
            else
            {
                ret.ColumnDefinitions = context.column_def().Select(i => i.Accept(this) as ColumnDefNode).ToList();

                ret.TableConstraints =
                    context.table_constraint().Select(i => i.Accept(this) as TableConstraintNode).ToList();
                ret.WithoutRowId = context.WITHOUT() != null;
            }


            return(ret);
        }
Exemplo n.º 2
0
 public CreateTableNode(SQLiteParserSimpleParser.Create_table_stmtContext context) : base(context)
 {
 }