Пример #1
0
        public override string GetVariableDeclaration(QueryType type, bool suppressSize)
        {
            // TODO: !!!

            var sb = new StringBuilder();
            var sqlType = (DbQueryType)type;
            var sqlDbType = sqlType.SqlDbType;

            switch (sqlDbType) {
                case SqlDbType.Bit: {
                    sb.Append("BOOLEAN");
                    break;
                }
                case SqlDbType.SmallInt: {
                    sb.Append("SMALLINT");
                    break;
                }
                case SqlDbType.Xml: {
                    sb.Append("XMLNODE");
                    break;
                }
            }

            return sb.ToString();
        }
Пример #2
0
        public override string GetVariableDeclaration(QueryType type, bool suppressSize)
        {
            StringBuilder sb = new StringBuilder();
            DbQueryType sqlType = (DbQueryType)type;
            SqlDbType sqlDbType = sqlType.SqlDbType;

            switch (sqlDbType) {
                case SqlDbType.BigInt:
                case SqlDbType.Bit:
                case SqlDbType.DateTime:
                case SqlDbType.Int:
                case SqlDbType.Money:
                case SqlDbType.SmallDateTime:
                case SqlDbType.SmallInt:
                case SqlDbType.SmallMoney:
                case SqlDbType.Timestamp:
                case SqlDbType.TinyInt:
                case SqlDbType.UniqueIdentifier:
                case SqlDbType.Variant:
                case SqlDbType.Xml:
                    sb.Append(sqlDbType);
                    break;
                case SqlDbType.Binary:
                case SqlDbType.Char:
                case SqlDbType.NChar:
                    sb.Append(sqlDbType);
                    if (type.Length > 0 && !suppressSize) {
                        sb.Append("(");
                        sb.Append(type.Length);
                        sb.Append(")");
                    }

                    break;
                case SqlDbType.Image:
                case SqlDbType.NText:
                case SqlDbType.NVarChar:
                case SqlDbType.Text:
                case SqlDbType.VarBinary:
                case SqlDbType.VarChar:
                    sb.Append(sqlDbType);
                    if (type.Length > 0 && !suppressSize) {
                        sb.Append("(");
                        sb.Append(type.Length);
                        sb.Append(")");
                    }

                    break;
                case SqlDbType.Decimal:
                    sb.Append("Currency");
                    break;
                case SqlDbType.Float:
                case SqlDbType.Real:
                    sb.Append(sqlDbType);
                    if (type.Precision != 0) {
                        sb.Append("(");
                        sb.Append(type.Precision);
                        if (type.Scale != 0) {
                            sb.Append(",");
                            sb.Append(type.Scale);
                        }

                        sb.Append(")");
                    }

                    break;
            }

            return sb.ToString();
        }
Пример #3
0
 public QueryParameter(string name, Type type, QueryType queryType)
 {
     this.name = name;
     this.type = type;
     this.queryType = queryType;
 }
Пример #4
0
 protected virtual OleDbType GetOleDbType(QueryType type)
 {
     return ToOleDbType(((DbQueryType)type).SqlDbType);
 }
Пример #5
0
            protected override OleDbType GetOleDbType(QueryType type)
            {
                DbQueryType sqlType = type as DbQueryType;
                if (sqlType != null)
                {
                    return ToOleDbType(sqlType.SqlDbType);
                }

                return base.GetOleDbType(type);
            }
Пример #6
0
 public abstract string GetVariableDeclaration(QueryType type, bool suppressSize);
Пример #7
0
 public QueryParameter(string name, Type type, QueryType queryType)
 {
     this.Name      = name;
     this.Type      = type;
     this.QueryType = queryType;
 }
Пример #8
0
 public VariableExpression(string name, Type type, QueryType queryType)
 {
     this.Name      = name;
     this.Type      = type;
     this.QueryType = queryType;
 }
Пример #9
0
 public VariableDeclaration(string name, QueryType queryType, Expression expression)
 {
     this.Name       = name;
     this.QueryType  = queryType;
     this.Expression = expression;
 }
Пример #10
0
 public VariableExpression(string name, Type type, QueryType queryType)
     : base((ExpressionType)DbExpressionType.Variable, type)
 {
     this.name      = name;
     this.queryType = queryType;
 }
Пример #11
0
 public VariableDeclaration(string name, QueryType type, Expression expression)
 {
     this.name       = name;
     this.type       = type;
     this.expression = expression;
 }
Пример #12
0
 public DbColumnExpression(Type type, QueryType queryType, TableAlias alias, string name) : base(DbExpressionType.Column, type)
 {
     this.Alias     = alias;
     this.QueryType = queryType ?? throw new ArgumentNullException("queryType");
     this.Name      = name ?? throw new ArgumentNullException("name");
 }
Пример #13
0
 public DbNamedValueExpression(string name, QueryType queryType, Expression value) : base(DbExpressionType.NamedValue, value.Type)
 {
     this.Name      = name ?? throw new ArgumentNullException("name");
     this.QueryType = queryType;
     this.Value     = value ?? throw new ArgumentNullException("value");
 }
Пример #14
0
 public DbColumnDeclaration(string name, Expression expression, QueryType queryType)
 {
     this.Name       = name ?? throw new ArgumentNullException("name");
     this.Expression = expression ?? throw new ArgumentNullException("expression");
     this.QueryType  = queryType ?? throw new ArgumentNullException("queryType");
 }
Пример #15
0
        public override string GetVariableDeclaration(QueryType type, bool suppressSize)
        {
            StringBuilder sb = new StringBuilder();
            DbQueryType sqlType = (DbQueryType)type;
            SqlDbType sqlDbType = sqlType.SqlDbType;

            switch (sqlDbType)
            {
                case SqlDbType.BigInt:
                case SqlDbType.SmallInt:
                case SqlDbType.Int:
                case SqlDbType.TinyInt:
                    sb.Append("INTEGER");
                    break;
                case SqlDbType.Bit:
                    sb.Append("BOOLEAN");
                    break;
                case SqlDbType.SmallDateTime:
                    sb.Append("DATETIME");
                    break;
                case SqlDbType.Char:
                case SqlDbType.NChar:
                    sb.Append("CHAR");
                    if (type.Length > 0 && !suppressSize)
                    {
                        sb.Append("(");
                        sb.Append(type.Length);
                        sb.Append(")");
                    }
                    break;
                case SqlDbType.Variant:
                case SqlDbType.Binary:
                case SqlDbType.Image:
                case SqlDbType.UniqueIdentifier: //There is a setting to make it string, look at later
                    sb.Append("BLOB");
                    if (type.Length > 0 && !suppressSize)
                    {
                        sb.Append("(");
                        sb.Append(type.Length);
                        sb.Append(")");
                    }
                    break;
                case SqlDbType.Xml:
                case SqlDbType.NText:
                case SqlDbType.NVarChar:
                case SqlDbType.Text:
                case SqlDbType.VarBinary:
                case SqlDbType.VarChar:
                    sb.Append("TEXT");
                    if (type.Length > 0 && !suppressSize)
                    {
                        sb.Append("(");
                        sb.Append(type.Length);
                        sb.Append(")");
                    }
                    break;
                case SqlDbType.Decimal:
                case SqlDbType.Money:
                case SqlDbType.SmallMoney:
                    sb.Append("NUMERIC");
                    if (type.Precision != 0)
                    {
                        sb.Append("(");
                        sb.Append(type.Precision);
                        sb.Append(")");
                    }
                    break;
                case SqlDbType.Float:
                case SqlDbType.Real:
                    sb.Append("FLOAT");
                    if (type.Precision != 0)
                    {
                        sb.Append("(");
                        sb.Append(type.Precision);
                        sb.Append(")");
                    }
                    break;
                case SqlDbType.Date:
                case SqlDbType.DateTime:
                case SqlDbType.Timestamp:
                default:
                    sb.Append(sqlDbType);
                    break;
            }
            return sb.ToString();
        }