Example #1
0
        public StringBuilder Visit(ConflictClauseNode conflictClauseNode)
        {
            var sb = new StringBuilder();

            sb.Append("ON CONFLICT ");
            switch (conflictClauseNode.Choice)
            {
            case ConflictChoice.Abort:
                sb.Append("ABORT");
                break;

            case ConflictChoice.Fail:
                sb.Append("FAIL");
                break;

            case ConflictChoice.Ignore:
                sb.Append("IGNORE");
                break;

            case ConflictChoice.Replace:
                sb.Append("REPLACE");
                break;

            case ConflictChoice.Rollback:
                sb.Append("ROLLBACK");
                break;
            }

            return(sb);
        }
Example #2
0
        public override SQLiteParseTreeNode VisitConflict_clause(SQLiteParserSimpleParser.Conflict_clauseContext context)
        {
            //this is empty, which is possible in this strange rule
            if (context.ON() == null)
            {
                return(null);
            }

            var ret = new ConflictClauseNode(context);

            if (context.ROLLBACK() != null)
            {
                ret.Choice = ConflictChoice.Rollback;
            }
            else if (context.ABORT() != null)
            {
                ret.Choice = ConflictChoice.Abort;
            }

            else if (context.FAIL() != null)
            {
                ret.Choice = ConflictChoice.Fail;
            }
            else if (context.IGNORE() != null)
            {
                ret.Choice = ConflictChoice.Ignore;
            }
            else if (context.REPLACE() != null)
            {
                ret.Choice = ConflictChoice.Replace;
            }

            return(ret);
        }