Beispiel #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);
        }
 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)
 {
     // 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);
            switch (Type)
            {
            case DateTimePrecisionDataTypeType.DateTime2:
                asm.AddToken("timestamp");
                break;

            case DateTimePrecisionDataTypeType.DateTimeOffset:
                AddNote(Note.STRINGIFIER, ResStr.NO_DATETIMEOFFSET);
                return;

            case DateTimePrecisionDataTypeType.Time:
                asm.AddToken("time");
                break;
            }

            // DateTime2 and Time do not support precision on Hana.
            if (Precision != PrecisionDefault)
            {
                AddNote(Note.MODIFIER, ResStr.MSG_REMOVED_LENGTHS_FOR_DATETIME2);
            }
            asm.End(this);
        }
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("CLOSE");
     asm.AddSpace();
     asm.Add(Source);
     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 WITH CLAUSE ###");
     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.Add(Variable);
     asm.AddSpace();
     asm.Add(Variable.Value + "_TYPE");
     asm.End(this);
 }
Beispiel #10
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);
 }
 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);
 }
Beispiel #12
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("RETURN");
     if (Result != null)
     {
         AddNote(Note.STRINGIFIER, ResStr.NO_RETURN_VALUE);
     }
     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);
 }
Beispiel #14
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     if (Name != null)
     {
         AddNote(Note.STRINGIFIER, ResStr.NO_NAMED_TRANSACTIONS);
     }
     asm.AddToken("ROLLBACK");
     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);
 }
 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);
 }
 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);
 }
 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);
 }
 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);
 }
 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.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)
        {
            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);
        }
Beispiel #23
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.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);
 }
Beispiel #25
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);
            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);
        }
 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);
        }
        override public void Assembly(Assembler asm)
        {
            asm.Begin(this);
            switch (Type)
            {
            case SimpleBuiltinDataTypeType.BigInt:
                asm.AddToken("bigint");        // TODO check
                break;

            case SimpleBuiltinDataTypeType.Bit:
                asm.AddToken("tinyint");
                break;

            case SimpleBuiltinDataTypeType.Int:
                asm.AddToken("integer");
                break;

            case SimpleBuiltinDataTypeType.Money:
                asm.AddToken("decimal");
                break;

            case SimpleBuiltinDataTypeType.SmallInt:
                asm.AddToken("smallint");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.SmallMoney:
                asm.AddToken("smalldecimal");
                break;

            case SimpleBuiltinDataTypeType.TinyInt:
                asm.AddToken("tinyint");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.Real:
                asm.AddToken("real");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.Date:
                asm.AddToken("date");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.DateTime:
                asm.AddToken("timestamp");
                break;

            case SimpleBuiltinDataTypeType.SmallDateTime:
                asm.AddToken("seconddate");
                break;

            case SimpleBuiltinDataTypeType.Text:
                asm.AddToken("text");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.NText:
                asm.AddToken("nclob");
                return;

            case SimpleBuiltinDataTypeType.Image:
                asm.AddToken("blob");
                break;

            case SimpleBuiltinDataTypeType.HierarchyId:
                AddNote(Note.STRINGIFIER, ResStr.NO_TYPE_HIERARCHYID);
                break;

            case SimpleBuiltinDataTypeType.RowVersion:
                asm.AddToken("rowversion");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.SqlVariant:
                AddNote(Note.STRINGIFIER, ResStr.NO_TYPE_SQL_VARIANT);
                break;

            case SimpleBuiltinDataTypeType.TimeStamp:
                asm.AddToken("timestamp");
                break;        // TODO check

            case SimpleBuiltinDataTypeType.UniqueIdentifier:
                asm.AddToken("nvarchar");
                break;

            default:
                throw new Exception(ResStr.MSG_INTERNAL_ERROR);
            }
            asm.End(this);
        }
Beispiel #30
0
 public override void Assembly(Assembler asm)
 {
     asm.Begin(this);
     asm.AddToken("CONTINUE");
     asm.End(this);
 }