コード例 #1
0
        public override void Visit(SqlVariableDeclareStatement codeObject)
        {
            var isFirst = true;

            foreach (var variableDeclaration in codeObject.Declarations)
            {
                if (isFirst)
                {
                    isFirst = false;
                }
                else
                {
                    _stringBuilder.AppendIndentedLine();
                }

                _stringBuilder
                .Append($"DECLARE {variableDeclaration.Name} ");

                variableDeclaration.Type.Accept(this);

                if (variableDeclaration.Value != null)
                {
                    _stringBuilder.Append(" = ");

                    variableDeclaration.Value.Accept(this);
                }

                _stringBuilder.Append(";");
            }
        }
コード例 #2
0
 private void AddVariable(MemoryDbCommand command, SqlVariableDeclareStatement variableDeclaration)
 {
     foreach (var declaration in variableDeclaration.Declarations)
     {
         var column   = new Column(null, declaration.Name, declaration.Type, UserDataTypes, 1);
         var variable = new MemoryDbParameter
         {
             ParameterName = column.Name,
             DbType        = column.DbDataType,
             NetDataType   = column.NetDataType,
             Precision     = ( byte )column.Precision,
             Scale         = ( byte )column.Scale,
             Size          = column.Size,
             IsNullable    = true
         };
         command.Variables.Add(variable);
     }
 }
 public override void Visit(SqlVariableDeclareStatement codeObject)
 {
     Format(codeObject);
 }