예제 #1
0
 public SqlBytes(SqlBinary value)
 {
     if (value.IsNull)
     {
         this.notNull = false;
         this.buffer = null;
     }
     else
     {
         this.notNull = true;
         this.buffer = value.Value;
         this.storage = StorageState.Buffer;
     }
 }
 public static SqlBoolean GreaterThanOrEqual(SqlBinary x, SqlBinary y)
 {
     return(x >= y);
 }
 public static SqlBoolean GreaterThan(SqlBinary x, SqlBinary y)
 {
     return(x > y);
 }
 public static SqlBoolean Equals(SqlBinary x, SqlBinary y)
 {
     return(x == y);
 }
 public static SqlBinary Concat(SqlBinary x, SqlBinary y)
 {
     return(x + y);
 }
 public static SqlBinary Add(SqlBinary x, SqlBinary y)
 {
     return(x + y);
 }
예제 #7
0
 public int CompareTo(SqlBinary value)
 {
     if (value.IsNull)
     {
         return 1;
     }
     else
     {
         return Compare(this, value);
     }
 }
 public static SqlBoolean NotEquals(SqlBinary x, SqlBinary y)
 {
     return(x != y);
 }
예제 #9
0
 public static SqlBoolean LessThanOrEqual(SqlBinary x, SqlBinary y)
 {
     return (x <= y);
 }
예제 #10
0
 public static SqlBoolean LessThan(SqlBinary x, SqlBinary y)
 {
     return (x < y);
 }
예제 #11
0
 public static SqlBoolean GreaterThanOrEqual(SqlBinary x, SqlBinary y)
 {
     return (x >= y);
 }
예제 #12
0
 public static SqlBoolean GreaterThan(SqlBinary x, SqlBinary y)
 {
     return (x > y);
 }
예제 #13
0
 public static SqlBoolean Equals(SqlBinary x, SqlBinary y)
 {
     return (x == y);
 }
예제 #14
0
 public static SqlBinary Concat(SqlBinary x, SqlBinary y)
 {
     return (x + y);
 }
예제 #15
0
 public static SqlBoolean LessThan(SqlBinary x, SqlBinary y)
 {
     return(x < y);
 }
예제 #16
0
 public static SqlBoolean LessThanOrEqual(SqlBinary x, SqlBinary y)
 {
     return(x <= y);
 }
예제 #17
0
 public static SqlBoolean NotEquals(SqlBinary x, SqlBinary y)
 {
     return (x != y);
 }
예제 #18
0
        // Helper method to Compare methods and operators.
        // Returns 0 if x == y
        //         1 if x > y
        //        -1 if x < y
        private static int Compare(SqlBinary x, SqlBinary y)
        {
            int LengthDiff = 0;

            // If they are different size test are bytes something else than 0
            if (x.Value.Length != y.Value.Length)
            {
                LengthDiff = x.Value.Length - y.Value.Length;

                // If more than zero, x is longer
                if (LengthDiff > 0)
                {
                    for (int i = x.Value.Length - 1; i > x.Value.Length - LengthDiff; i--)
                    {
                        // If byte is more than zero the x is bigger
                        if (x.Value[i] != 0)
                        {
                            return 1;
                        }
                    }
                }
                else
                {
                    for (int i = y.Value.Length - 1; i > y.Value.Length - LengthDiff; i--)
                    {
                        // If byte is more than zero then y is bigger
                        if (y.Value[i] != 0)
                        {
                            return -1;
                        }
                    }
                }
            }

            // choose shorter
            int lenght = (LengthDiff > 0) ? y.Value.Length : x.Value.Length;

            for (int i = lenght - 1; i > 0; i--)
            {
                byte X = x.Value[i];
                byte Y = y.Value[i];

                if (X > Y)
                {
                    return 1;
                }
                else if (X < Y)
                {
                    return -1;
                }
            }

            // If we are here, x and y were same size
            return 0;
        }
예제 #19
0
 public static SqlBinary Add(SqlBinary x, SqlBinary y)
 {
     return (x + y);
 }