Example #1
0
        public void Type_Precision()
        {
            ISqlType type = sql.Type("DECIMAL", 10, 2);

            QueryResult result = engine.Compile(type);

            Assert.Equal("DECIMAL(10, 2)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Example #2
0
        public void Type_Length()
        {
            ISqlType type = sql.Type("VARCHAR", 50);

            QueryResult result = engine.Compile(type);

            Assert.Equal("VARCHAR(50)", result.Sql);
            Assert.Equal(new Dictionary <string, object>(), result.Parameters);
        }
Example #3
0
        public object GetDefaultValue(DataColumn col, ISqlType sqlType)
        {
            if (col?.ColumnID == null)
            {
                return(null);
            }

            if (_cachedDefaultValues.TryGetValue(col.ColumnID.Value, out var defaultValue))
            {
                return(defaultValue);
            }

            if (!_defaultConstraints.TryGetValue(col.ColumnID.Value, out var defaultConstraint))
            {
                return(null);
            }

            defaultValue = sqlType.GetDefaultValue(defaultConstraint);

            _cachedDefaultValues[col.ColumnID.Value] = defaultValue;

            return(defaultValue);
        }
Example #4
0
        public void To_String()
        {
            ISqlType type = sql.Type("DECIMAL", 10, 2);

            Assert.Equal("DECIMAL(10, 2)", type.ToString());
        }
Example #5
0
 public LineProcessor(ISqlType from, ISqlType to)
 {
     _from = from;
     _to   = to;
 }
Example #6
0
 public Statement And(ISqlType field, string oper, ISqlType otherField)
 {
     And(field.FullName, oper, otherField.FormatValue());
     return(Next);
 }
Example #7
0
 public Statement And(ISqlType field, string oper, string value)
 {
     And(field.FullName, oper, value);
     return(Next);
 }
Example #8
0
 public Statement Where(ISqlType field, string oper, ISqlType otherField)
 {
     Where($"{field.Parent.Name}.{field.Name}", oper, otherField.FormatValue());
     return(Next);
 }
Example #9
0
 public Statement Where(ISqlType field, string oper, string value)
 {
     Where($"{field.Parent.Name}.{field.Name}", oper, value);
     return(Next);
 }
Example #10
0
 public Statement OrderBy(ISqlType field, string order = Operators.Ascending)
 {
     OrderBy(field.FullName, order);
     return(Next);
 }
Example #11
0
 public ScriptConversor(ISqlType from, ISqlType to)
 {
     _from = from;
     _to   = to;
 }