当前位置: 首页>>代码示例>>C#>>正文


C# ISqlObject类代码示例

本文整理汇总了C#中ISqlObject的典型用法代码示例。如果您正苦于以下问题:C# ISqlObject类的具体用法?C# ISqlObject怎么用?C# ISqlObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISqlObject类属于命名空间,在下文中一共展示了ISqlObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConvertTo

        public override object ConvertTo(ISqlObject obj, Type destType)
        {
            if (obj == null || obj.IsNull)
                return null;

            throw new InvalidCastException();
        }
开发者ID:furesoft,项目名称:deveeldb,代码行数:7,代码来源:NullType.cs

示例2: Add

        public override ISqlObject Add(ISqlObject a, ISqlObject b)
        {
            if (!(a is SqlNumber))
                throw new ArgumentException();
            if (b is SqlNull || b.IsNull)
                return SqlNumber.Null;

            var num1 = (SqlNumber) a;
            SqlNumber num2;

            if (b is SqlBoolean) {
                if ((SqlBoolean) b) {
                    num2 = SqlNumber.One;
                } else if (!(SqlBoolean) b) {
                    num2 = SqlNumber.Zero;
                } else {
                    num2 = SqlNumber.Null;
                }
            } else if (b is SqlNumber) {
                num2 = (SqlNumber) b;
            } else {
                throw new ArgumentException();
            }

            return num1.Add(num2);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:26,代码来源:NumericType.cs

示例3: And

        public override ISqlObject And(ISqlObject a, ISqlObject b)
        {
            if (a.IsNull || b.IsNull)
                return SqlBoolean.Null;

            var b1 = (SqlBoolean) a;
            var b2 = (SqlBoolean) b;

            return b1.And(b2);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:10,代码来源:BooleanType.cs

示例4: SerializeObject

        public override void SerializeObject(Stream stream, ISqlObject obj)
        {
            var writer = new BinaryWriter(stream);

            if (obj is SqlNull) {
                writer.Write((byte)1);
            } else if (obj == null || obj.IsNull) {
                writer.Write((byte) 2);
            } else {
                throw new FormatException();
            }
        }
开发者ID:furesoft,项目名称:deveeldb,代码行数:12,代码来源:NullType.cs

示例5: BuildName

        public string BuildName(ISqlObject sqlObject)
        {
            var sb = new StringBuilder();
            var schemaMember = sqlObject as ISchemaMember;
            if (schemaMember != null)
            {
                sb.Append(GetSchemaNameSql(schemaMember))
                    .Append(".");
            }
            sb.Append(keywordEncoder.Encode(sqlObject.Name));

            return sb.ToString();
        }
开发者ID:footcha,项目名称:DbTracer,代码行数:13,代码来源:FullNameWithSchemaBuilder.cs

示例6: QueryResultRow

        public QueryResultRow(ISqlObject[] values, int[] valueSizes)
        {
            if (values == null)
                throw new ArgumentNullException("values");
            if (valueSizes == null)
                throw new ArgumentNullException("valueSizes");

            if (values.Length != valueSizes.Length)
                throw new ArgumentException();

            Values = values;
            ValueSizes = valueSizes;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:13,代码来源:QueryResultRow.cs

示例7: ConvertTo

        public override object ConvertTo(ISqlObject obj, Type destType)
        {
            var xmlNode = obj as SqlXmlNode;
            if (xmlNode == null || xmlNode.IsNull)
                return null;

            if (destType == typeof (string))
                return xmlNode.ToString();
            if (destType == typeof (XmlNode))
                return xmlNode.ToXmlNode();
            if (destType == typeof (byte[]))
                return xmlNode.ToBytes();

            return base.ConvertTo(obj, destType);
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:15,代码来源:XmlNodeType.cs

示例8: QueryParameter

        public QueryParameter(string name, SqlType sqlType, ISqlObject value)
        {
            if (sqlType == null)
                throw new ArgumentNullException("sqlType");

            if (String.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            if (!String.Equals(name, Marker, StringComparison.Ordinal) &&
                name[0] != NamePrefix)
                throw new ArgumentException(String.Format("The parameter name '{0}' is invalid: must be '{1}' or starting with '{2}'", name, Marker, NamePrefix));

            Name = name;
            SqlType = sqlType;
            Value = value;
            Direction = QueryParameterDirection.In;
        }
开发者ID:furesoft,项目名称:deveeldb,代码行数:17,代码来源:QueryParameter.cs

示例9: SerializeObject

        public override void SerializeObject(Stream stream, ISqlObject obj)
        {
            var writer = new BinaryWriter(stream, Encoding.Unicode);

            var queryPlanObj = (SqlQueryObject) obj;
            if (queryPlanObj.IsNull) {
                writer.Write((byte) 0);
            } else {
                writer.Write((byte)1);
                var nodeTypeString = queryPlanObj.QueryPlan.GetType().AssemblyQualifiedName;
                if (String.IsNullOrEmpty(nodeTypeString))
                    throw new InvalidOperationException();

                writer.Write(nodeTypeString);
                SerializePlan(queryPlanObj.QueryPlan, writer);
            }
        }
开发者ID:ArsenShnurkov,项目名称:deveeldb,代码行数:17,代码来源:QueryType.cs

示例10: CastTo

        public override ISqlObject CastTo(ISqlObject value, SqlType destType)
        {
            var sqlType = destType.TypeCode;
            var binary = ((ISqlBinary) value);

            ISqlObject casted;

            switch (sqlType) {
                case SqlTypeCode.Bit:
                case SqlTypeCode.Boolean:
                    casted = ToBoolean(binary);
                    break;
                    // TODO: All other casts
                default:
                    throw new InvalidCastException();
            }

            return casted;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:19,代码来源:BinaryType.cs

示例11: QueryParameter

        public QueryParameter(string name, SqlType sqlType, ISqlObject value)
        {
            if (sqlType == null)
                throw new ArgumentNullException("sqlType");

            if (String.IsNullOrEmpty(name))
                throw new ArgumentNullException("name");

            if (!String.Equals(name, Marker, StringComparison.Ordinal) &&
                name[0] == NamePrefix) {
                name = name.Substring(1);

                if (String.IsNullOrEmpty(name))
                    throw new ArgumentException("Cannot specify only the variable bind prefix as parameter.");
            }

            Name = name;
            SqlType = sqlType;
            Value = value;
            Direction = QueryParameterDirection.In;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:21,代码来源:QueryParameter.cs

示例12: CastTo

        public override ISqlObject CastTo(ISqlObject value, SqlType destType)
        {
            var bValue = ((SqlBoolean) value);
            if (destType is StringType) {
                if (bValue.IsNull)
                    return SqlString.Null;

                string s;
                if (TypeCode == SqlTypeCode.Bit) {
                    s = bValue ? "1" : "0";
                } else {
                    s = bValue ? "true" : "false";
                }

                return new SqlString(s);
            }
            if (destType is NumericType) {
                SqlNumber num;
                if (bValue == SqlBoolean.Null) {
                    num = SqlNumber.Null;
                } else if (bValue) {
                    num = SqlNumber.One;
                } else {
                    num = SqlNumber.Zero;
                }

                return num;
            }
            if (destType is BinaryType) {
                var bytes = new[] {bValue ? (byte)1 : (byte)0};
                return new SqlBinary(bytes);
            }

            if (destType is BooleanType)
                return value;

            return base.CastTo(value, destType);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:38,代码来源:BooleanType.cs

示例13: IsSmallerThan

        public override SqlBoolean IsSmallerThan(ISqlObject a, ISqlObject b)
        {
            if (!(a is SqlNumber) ||
                !(b is SqlNumber))
                throw new ArgumentException();

            if (b.IsNull)
                return SqlBoolean.Null;

            if (a.IsNull)
                return SqlBoolean.Null;

            var num1 = (SqlNumber) a;
            var num2 = (SqlNumber) b;

            return num1 < num2;
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:17,代码来源:NumericType.cs

示例14: IsNotEqualTo

 public override SqlBoolean IsNotEqualTo(ISqlObject a, ISqlObject b)
 {
     return !IsEqualTo(a, b);
 }
开发者ID:deveel,项目名称:deveeldb,代码行数:4,代码来源:NumericType.cs

示例15: IsEqualTo

        public override SqlBoolean IsEqualTo(ISqlObject a, ISqlObject b)
        {
            if (!(a is SqlNumber) ||
                !(b is SqlNumber))
                throw new ArgumentException();

            if (b.IsNull)
                return a.IsNull;

            if (a.IsNull)
                return b.IsNull;

            var num1 = (SqlNumber) a;
            var num2 = (SqlNumber) b;

            return num1.Equals(num2);
        }
开发者ID:deveel,项目名称:deveeldb,代码行数:17,代码来源:NumericType.cs


注:本文中的ISqlObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。