Ejemplo n.º 1
0
        public SQLCreateTable(List <string> stmt) : base(StmtType.CREATE_TABLE, stmt)
        {
            TbName = stmt[2];

            int lParenPos = stmt.IndexOf("(");
            int rParenPos = stmt.IndexOf(")");

            if (lParenPos == -1 || rParenPos == -1 || (rParenPos - lParenPos) < 3)
            {
                throw new SyntaxErrorExc();
            }
            stmt       = stmt.GetRange(lParenPos + 1, rParenPos - lParenPos - 1);
            ColumnDefs = stmt.Split(s => s == ",").ToDictionary(expr => expr[0], expr => SQLParser.ToDbDataType(expr[1]));
            // todo: handle table constraints
        }