Example #1
0
        public override void Assembly(Assembler asm)
        {
            asm.Begin(this);
            asm.AddToken("IF");
            asm.AddSpace();
            asm.Add(Condition);
            asm.AddSpace();
            asm.AddToken("THEN");
            asm.AddSpace();
            asm.IncreaseIndentation();
            asm.NewLine();
            asm.Add(TrueStatement);
            asm.DecreaseIndentation();
            if (FalseStatement.Count() != 0)
            {
                asm.NewLine();
                asm.AddToken("ELSE");
                asm.AddSpace();
                asm.IncreaseIndentation();
                asm.NewLine();
            }

            // This is needed in order to process comments after FalseStatement.
            asm.Add(FalseStatement);

            if (FalseStatement.Count() != 0)
            {
                asm.DecreaseIndentation();
            }
            asm.NewLine();
            asm.AddToken("END IF");
            asm.End(this);
        }
Example #2
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     AddNote(Note.STRINGIFIER, ResStr.NO_TRY_CATCH_STATEMENT);
     asm.Add(TryStatements);
     asm.Add(CatchStatements);
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.Add(Variable);
     asm.AddSpace();
     asm.Add(Variable.Value + "_TYPE");
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.Add(Value);
     if (Exponent != 0)
     {
         asm.AddToken("e");
         asm.Add(Exponent);
     }
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.SetFlag(Assembler.FLAG_HANA_CONCAT);
     asm.Add(LeftExpression);
     asm.AddSpace();
     asm.Add("||");
     asm.AddSpace();
     asm.Add(RightExpression);
     asm.ClearFlag(Assembler.FLAG_HANA_CONCAT);
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("CURSOR");
     asm.AddSpace();
     asm.Add(Name);
     asm.AddSpace();
     asm.AddToken("FOR");
     asm.AddSpace();
     asm.Add(Statement);
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     if (Name != null)
     {
         asm.Add(Name);
     }
     else if (VarName != null)
     {
         asm.Add(VarName);
     }
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.Add(Variable);
     asm.AddSpace();
     asm.Add(Type);
     if (Value != null)
     {
         asm.AddSpace();
         asm.AddToken(":=");
         asm.AddSpace();
         asm.Add(Value);
     }
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     // HANA does not support money type with currency.
     asm.Begin(this);
     asm.Add(Value);
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("SET SCHEMA ");
     asm.Add(Database);
     asm.End(this);
 }
        override public void Assembly(Assembler asm)
        {
            asm.Begin(this);
            asm.AddToken("decimal");

            if (Precision != PrecisionDefault || Scale != ScaleDefault)
            {
                asm.AddToken("(");
                asm.Add(Precision);
                asm.AddToken(",");
                asm.AddSpace();
                asm.Add(Scale);
                asm.AddToken(")");
            }
            asm.End(this);
        }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddSpace();
     asm.Add("### UNSUPPORTED ALTER PROCEDURE ###");
     asm.AddSpace();
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddSpace();
     asm.Add("### UNSUPPORTED STATEMENT ###");
     asm.AddSpace();
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("SELECT");
     asm.AddSpace();
     foreach (SelectVariableItem item in Items)
     {
         asm.Add(item.Expression);
         if (item != Items.Last())
         {
             asm.AddToken(", ");
         }
     }
     asm.AddSpace();
     asm.AddToken("INTO");
     asm.AddSpace();
     foreach (SelectVariableItem item in Items)
     {
         asm.Add(item.Variable);
         if (item != Items.Last())
         {
             asm.AddToken(", ");
         }
     }
     asm.AddSpace();
     if (FromClause != null)
     {
         asm.AddToken("FROM");
         asm.AddSpace();
         foreach (TableSource table in FromClause)
         {
             asm.Add(table);
             if (table != FromClause.Last())
             {
                 asm.AddToken(",");
                 asm.AddSpace();
                 asm.NewLine();
             }
         }
     }
     else
     {
         asm.AddToken("FROM DUMMY");
     }
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("CLOSE");
     asm.AddSpace();
     asm.Add(Source);
     asm.End(this);
 }
Example #16
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("WHILE");
     asm.AddSpace();
     asm.Add(Condition);
     asm.AddSpace();
     asm.AddToken("DO");
     asm.AddSpace();
     asm.IncreaseIndentation();
     asm.NewLine();
     asm.Add(Statement);
     asm.DecreaseIndentation();
     asm.NewLine();
     asm.AddToken("END WHILE");
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddSpace();
     asm.Add("### UNSUPPORTED WITH CLAUSE ###");
     asm.AddSpace();
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken(this.Type == StringLiteralType.Unicode ? "n" : "");
     asm.AddToken("'");
     asm.Add(this.String.Replace("'", "''"));
     asm.AddToken("'");
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("SELECT");
     asm.AddSpace();
     asm.Add(Expression);
     asm.AddSpace();
     asm.AddToken("FROM DUMMY");
     asm.End(this);
 }
        override public void Assembly(Assembler asm)
        {
            asm.Begin(this);
            switch (Name.Name.ToLowerInvariant())
            {
            case "xml":
                AddNote(Note.STRINGIFIER, ResStr.NO_TYPE_XML);
                break;

            default:
                if (Schema != null)
                {
                    asm.Add(Schema);
                    asm.AddToken(".");
                }
                asm.Add(Name);
                break;
            }
            asm.End(this);
        }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("float");
     if (Mantissa != MantissaDefault)
     {
         asm.AddToken("(");
         asm.Add(Mantissa);
         asm.AddToken(")");
     }
     asm.End(this);
 }
 override public void Assembly(Assembler asm)
 {
     asm.Begin(this);
     foreach (Identifier i in Identifiers)
     {
         asm.Add(i);
         if (i != Identifiers.Last())
         {
             asm.AddToken(".");
         }
     }
     asm.End(this);
 }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("FETCH");
     asm.AddSpace();
     asm.Add(Source);
     if (VariableList != null)
     {
         asm.AddSpace();
         asm.AddToken("INTO");
         asm.AddSpace();
         foreach (VariableExpression var in VariableList)
         {
             asm.Add(var);
             if (var != VariableList.Last())
             {
                 asm.AddToken(",");
             }
         }
     }
     asm.End(this);
 }
        override public void Assembly(Assembler asm)
        {
            asm.Begin(this);
            switch (this.Type)
            {
            case IdentifierType.Plain:
                asm.Add(this.Name);
                break;

            case IdentifierType.Bracketed:
                asm.AddToken("[");
                asm.Add(this.Name);
                asm.AddToken("]");
                break;

            case IdentifierType.Quoted:
                asm.AddToken("\"");
                asm.Add(this.Name.Replace("\"", "\"\""));
                asm.AddToken("\"");
                break;
            }
            asm.End(this);
        }
Example #25
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     if (Statements != null)
     {
         foreach (Statement stmt in Statements)
         {
             asm.Add(stmt);
             if (stmt != Statements.Last())
             {
                 asm.NewLine();
             }
         }
     }
     asm.End(this);
 }
        public override void Assembly(Assembler asm)
        {
            asm.Add(Name);
            switch (Direction)
            {
            case OrderDirection.Nothing:
                asm.AddToken("");
                break;

            case OrderDirection.Ascending:
                asm.AddToken(" ASC");
                break;

            case OrderDirection.Descending:
                asm.AddToken(" DESC");
                break;
            }
        }
        override public void Assembly(Assembler asm)
        {
            switch (Type)
            {
            case StringWithLengthDataTypeType.Char:
                asm.AddToken("char");
                break;

            case StringWithLengthDataTypeType.NChar:
                asm.AddToken("nchar");
                break;

            case StringWithLengthDataTypeType.Binary:
                asm.AddToken("binary");
                break;

            case StringWithLengthDataTypeType.VarChar:
                asm.AddToken("varchar");
                break;

            case StringWithLengthDataTypeType.NVarChar:
                asm.AddToken("nvarchar");
                break;

            case StringWithLengthDataTypeType.VarBinary:
                asm.AddToken("varbinary");
                break;
            }

            if (Length == -1)
            {
                asm.AddToken("(");
                asm.AddToken(Type == StringWithLengthDataTypeType.Binary ? "MAX" : "5000");
                asm.AddToken(")");
            }
            else if (Length != 0)
            {
                asm.AddToken("(");
                asm.Add(Length);
                asm.AddToken(")");
            }
        }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.Add(Declarations[0]);
     asm.End(this);
 }
        public override void Assembly(Assembler asm)
        {
            asm.Begin(this);
            switch (Operator)
            {
            case AssignmentType.XorAssign:
                AddNote(Note.STRINGIFIER, ResStr.NO_BITWISE_XOR_OPERATOR);
                asm.End(this);
                return;

            case AssignmentType.OrAssign:
                AddNote(Note.STRINGIFIER, ResStr.NO_BITWISE_OR_OPERATOR);
                asm.End(this);
                return;
            }
            asm.Add(Variable);
            asm.AddSpace();
            asm.AddToken(":=");
            asm.AddSpace();
            switch (Operator)
            {
            case AssignmentType.AddAssign:
                asm.AddToken(":");
                asm.Add(Variable);
                asm.AddToken(" + ");
                asm.Add(Expression);
                break;

            case AssignmentType.AndAssign:
                asm.AddToken("BITAND(");
                asm.AddToken(":");
                asm.Add(Variable);
                asm.AddToken(", ");
                asm.Add(Expression);
                asm.AddToken(")");
                break;

            case AssignmentType.Assign:
                asm.Add(Expression);
                break;

            case AssignmentType.DivAssign:
                asm.AddToken(":");
                asm.Add(Variable);
                asm.AddToken(" / ");
                asm.Add(Expression);
                break;

            case AssignmentType.ModAssign:
                asm.AddToken("MOD(");
                asm.AddToken(":");
                asm.Add(Variable);
                asm.AddToken(", ");
                asm.Add(Expression);
                asm.AddToken(")");
                break;

            case AssignmentType.MulAssign:
                asm.AddToken(":");
                asm.Add(Variable);
                asm.AddToken(" * ");
                asm.Add(Expression);
                break;

            case AssignmentType.SubAssign:
                asm.AddToken(":");
                asm.Add(Variable);
                asm.AddToken(" - ");
                asm.Add(Expression);
                break;
            }
            asm.End(this);
        }