Ejemplo n.º 1
0
 public static SqlBinary MergePHkeys(SqlBinary oldPHkeys, SqlInt16 newSnap, SqlInt32 newPHkey)
 {
     SqlIntArray keyArray = new SqlIntArray(oldPHkeys);
     int[] keys = keyArray.ToArray();
     keys[(short) newSnap] = (int) newPHkey;
     return SqlIntArray.FromArray(keys).ToSqlBuffer();
 }
Ejemplo n.º 2
0
 // non-generic methods to extract the value of a nullable type and box it
 public static object Box(SqlInt16 a)
 {
     if (a.IsNull)
         return null;
     else
         return a.Value;
 }
Ejemplo n.º 3
0
		public void ArithmeticMethods ()
		{
			SqlInt16 Test64 = new SqlInt16 (64);
			SqlInt16 Test0 = new SqlInt16 (0);
			SqlInt16 Test164 = new SqlInt16 (164);
			SqlInt16 TestMax = new SqlInt16 (SqlInt16.MaxValue.Value);

			// Add()
			Assert.AreEqual ((short) 64, SqlInt16.Add (Test64, Test0).Value, "Test#1");
			Assert.AreEqual ((short) 228, SqlInt16.Add (Test64, Test164).Value, "Test#2");
			Assert.AreEqual ((short) 164, SqlInt16.Add (Test0, Test164).Value, "Test#3");
			Assert.AreEqual ((short) SqlInt16.MaxValue, SqlInt16.Add (TestMax, Test0).Value, "Test#4");

			try {
				SqlInt16.Add (TestMax, Test64);
				Assert.Fail ("Test#5");
			} catch (OverflowException e) {
				Assert.AreEqual (typeof (OverflowException), e.GetType (), "Test#6");
			}

			// Divide()
			Assert.AreEqual ((short) 2, SqlInt16.Divide (Test164, Test64).Value, "Test#7");
			Assert.AreEqual ((short) 0, SqlInt16.Divide (Test64, Test164).Value, "Test#8");
			try {
				SqlInt16.Divide (Test64, Test0);
				Assert.Fail ("Test#9");
			} catch (DivideByZeroException e) {
				Assert.AreEqual (typeof (DivideByZeroException), e.GetType (), "Test#10");
			}

			// Mod()
			Assert.AreEqual ((SqlInt16) 36, SqlInt16.Mod (Test164, Test64), "Test#11");
			Assert.AreEqual ((SqlInt16) 64, SqlInt16.Mod (Test64, Test164), "Test#12");

			// Multiply()
			Assert.AreEqual ((short) 10496, SqlInt16.Multiply (Test64, Test164).Value, "Test#13");
			Assert.AreEqual ((short) 0, SqlInt16.Multiply (Test64, Test0).Value, "Test#14");

			try {
				SqlInt16.Multiply (TestMax, Test64);
				Assert.Fail ("Test#15");
			} catch (OverflowException e) {
				Assert.AreEqual (typeof (OverflowException), e.GetType (), "Test#16");
			}

			// Subtract()
			Assert.AreEqual ((short) 100, SqlInt16.Subtract (Test164, Test64).Value, "Test#17");

			try {
				SqlInt16.Subtract (SqlInt16.MinValue, Test164);
				Assert.Fail ("Test#18");
			} catch (OverflowException e) {
				Assert.AreEqual (typeof (OverflowException), e.GetType (), "Test#19");
			}

			// Modulus ()
			Assert.AreEqual ((SqlInt16)36, SqlInt16.Modulus (Test164, Test64), "Test#20");
			Assert.AreEqual ((SqlInt16)64, SqlInt16.Modulus (Test64, Test164), "Test#21");
		}
Ejemplo n.º 4
0
    public static IEnumerable FindPHkeysAndSlots(SqlInt16 partsnap, SqlInt16 fofsnap, SqlString temp_partid_table_name, SqlInt32 numparts)
    {
        //string temp_partid_table = "#temp_partid_list";
        List<PhkeySlot> keysAndSlots = new List<PhkeySlot>();
        using (SqlConnection connection = new SqlConnection("context connection=true"))
        {
            connection.Open();
            string getFoFGroupIDsCommandString = "select partid from " + temp_partid_table_name.ToString();
            SqlCommand getFoFGroupIDsListCommand = new SqlCommand(getFoFGroupIDsCommandString, connection);
            SqlDataReader getFOFGroupIDsReader = getFoFGroupIDsListCommand.ExecuteReader();
            Int64[] partids = new Int64[(int) numparts];
            int numlines = 0;
            while (getFOFGroupIDsReader.Read())
            {
                partids[numlines] = Int64.Parse(getFOFGroupIDsReader["partid"].ToString());
                ++numlines;
            }
            getFOFGroupIDsReader.Close();
            // Find the index blocks we need to look in
            HashSet<Int64> blocks = new HashSet<Int64>();
            foreach (Int64 id in partids)
            {
                blocks.Add((id - 1) / 1024 / 1024);
            }

            //means we want all snaps
            string rawCommand = "";
            if (partsnap < 0)
            {
                rawCommand = "select a.snap, a.phkey, a.slot from particleDB.dbo.index{0} a, " + temp_partid_table_name.ToString() + " b "
                    + " where a.partid = b.partid";
            }
            else
            {
                rawCommand = "select a.snap, a.phkey, a.slot from particleDB.dbo.index{0} a, " + temp_partid_table_name.ToString() + " b "
                    + " where a.partid = b.partid and a.snap = @partsnap";
            }

            foreach (Int64 blockID in blocks)
            {
                string joinFoFGroupIndexCommandString = string.Format(rawCommand, blockID);
                SqlCommand joinFofGroupIndexCommand = new SqlCommand(joinFoFGroupIndexCommandString, connection);
                SqlParameter partsnapParam = new SqlParameter("@partsnap", System.Data.SqlDbType.SmallInt);
                partsnapParam.Value = partsnap;
                joinFofGroupIndexCommand.Parameters.Add(partsnapParam);
                SqlDataReader joinReader = joinFofGroupIndexCommand.ExecuteReader();
                while (joinReader.Read())
                {
                    int snap = Int32.Parse(joinReader["snap"].ToString());
                    int phkey = Int32.Parse(joinReader["phkey"].ToString());
                    short slot = Int16.Parse(joinReader["slot"].ToString());
                    PhkeySlot current = new PhkeySlot(snap, phkey, slot);
                    keysAndSlots.Add(current);
                }
                joinReader.Close();
            }
        }
        return keysAndSlots;
    }
Ejemplo n.º 5
0
 public void Properties()
 {
         SqlInt16 Test5443 = new SqlInt16 (5443);
         SqlInt16 Test1 = new SqlInt16 (1);
         Assert ("Test#1", SqlInt16.Null.IsNull);
         AssertEquals ("Test#2", (short)5443, Test5443.Value);
         AssertEquals ("Test#3", (short)1, Test1.Value);
 }
Ejemplo n.º 6
0
		public void Create ()
		{
			SqlInt16 TestShort = new SqlInt16 (29);
			Assert.AreEqual ((short) 29, TestShort.Value, "Test#1");

			TestShort = new SqlInt16 (-9000);
			Assert.AreEqual ((short) -9000, TestShort.Value, "Test#2");
		}
Ejemplo n.º 7
0
 public static SqlBinary MergeSlots(SqlBinary oldSlots, SqlInt16 newSnap, SqlInt16 newSlot)
 {
     //short[] slots = oldSlots.ToArray();
     SqlSmallIntArray slotArray = new SqlSmallIntArray(oldSlots);
     short[] slots = slotArray.ToArray();
     slots[(short) newSnap] = (short) newSlot;
     return SqlSmallIntArray.FromArray(slots).ToSqlBuffer();
 }
Ejemplo n.º 8
0
 public void Properties()
 {
     SqlInt16 Test5443 = new SqlInt16(5443);
     SqlInt16 Test1 = new SqlInt16(1);
     Assert.True(SqlInt16.Null.IsNull);
     Assert.Equal((short)5443, Test5443.Value);
     Assert.Equal((short)1, Test1.Value);
 }
Ejemplo n.º 9
0
		public void Properties ()
		{
			SqlInt16 Test5443 = new SqlInt16 (5443);
			SqlInt16 Test1 = new SqlInt16 (1);
			Assert.IsTrue (SqlInt16.Null.IsNull, "Test#1");
			Assert.AreEqual ((short) 5443, Test5443.Value, "Test#2");
			Assert.AreEqual ((short) 1, Test1.Value, "Test#3");
		}
Ejemplo n.º 10
0
                public void Create()
                {
                        SqlInt16 TestShort = new SqlInt16 (29);
                        AssertEquals ("Test#1", (short)29, TestShort.Value);

                        TestShort = new SqlInt16 (-9000);
                        AssertEquals ("Test#2", (short)-9000, TestShort.Value);
                }
Ejemplo n.º 11
0
    public static void AddToFilterFillRow(Object obj, out SqlInt16 snap, out SqlInt32 outPHKey, out SqlBinary finalFilter, out SqlInt32 hashFunctions, out SqlInt32 expectedCap)
    {
        object[] row = (object[])obj;
            finalFilter = new SqlBinary((byte[])row[2]);
            snap = new SqlInt16((short) row[0]);// (SqlInt16)row[10];
            outPHKey = new SqlInt32((int) row[1]);

            hashFunctions = new SqlInt32((int)row[3]);
            expectedCap = new SqlInt32((int)row[4]);
    }
Ejemplo n.º 12
0
    public static SqlString RegexMatch(SqlString text, SqlString pattern, SqlInt16 groupIndex)
    {
        var patternValue = pattern.IsNull ? null : pattern.Value;
        if (patternValue == null)
            throw new ArgumentNullException("pattern");

        var textValue = text.IsNull ? null : text.Value;
        if (textValue == null) return SqlString.Null;

        var groupIndexValue = groupIndex.IsNull ? 0 : groupIndex.Value;

        var match = Regex.Match(text.Value, pattern.Value, RegexOptions.Compiled /*| RegexOptions.IgnoreCase*/);
        if (!match.Success) return SqlString.Null;

        var group = match.Groups[groupIndexValue];
        if (!group.Success) return SqlString.Null;

        return new SqlString(group.Value, text.LCID);
    }
Ejemplo n.º 13
0
    public void Accumulate(SqlDouble value, SqlInt16 percentile)
    {
        // Put your code here
        if (value.IsNull != true)
        {
            doubleList.Add(value.Value);
        }

        if (percentile.IsNull != true)
        {
            if (percentile.Value > 100)
            {
                this.percentile = 100;
            }
            else
            {
                this.percentile = percentile.Value;
            }
        }
    }
Ejemplo n.º 14
0
 // Alternative method for operator |
 public static SqlInt16 BitwiseOr(SqlInt16 x, SqlInt16 y)
 {
     return(x | y);
 }
Ejemplo n.º 15
0
        /**
         * The division operator divides the first SqlInt16 operand by the second.
         * @param x A SqlInt16 instance.
         * @param y A SqlInt16 instance.
         * @return A SqlInt16 instance containing the results of the division operation.
         * If one of the parameters is null or null value - return SqlInt16.Null.
         */
        public static SqlInt16 Divide(SqlInt16 x, SqlInt16 y)
        {
            int val = x._value / y._value;

            return(new SqlInt16(val));
        }
Ejemplo n.º 16
0
		public void SqlInt16ToSqlByte()
	        {
			SqlInt16 TestInt1664 = new SqlInt16(64);
			SqlInt16 TestInt16900 = new SqlInt16(900);
			
			Assert.AreEqual((byte)64, ((SqlByte)TestInt1664).Value, "SqlInt16ToByte" + Error);

			try {
				SqlByte test = (SqlByte)TestInt16900;
				Assert.Fail("SqlInt16ToByte 2" + Error);
			} catch (Exception e) {

				Assert.AreEqual(typeof(OverflowException), e.GetType(), "OverflowException");
			}

		}
Ejemplo n.º 17
0
        //  implements SqlClient 1.1-compatible GetSqlValue() semantics for everything except output parameters
        internal static object GetSqlValue(
            SmiEventSink_Default    sink,
            ITypedGettersV3         getters,
            int                     ordinal,
            SmiMetaData             metaData,
            SmiContext              context
            ) {
            object result = null;
            if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
                if (SqlDbType.Udt == metaData.SqlDbType) {
                    result = NullUdtInstance(metaData);
                }
                else {
                    result = __typeSpecificNullForSqlValue[(int)metaData.SqlDbType];
                }
            }
            else {
                switch( metaData.SqlDbType ) {
                    case SqlDbType.BigInt:
                        result = new SqlInt64( GetInt64_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Binary:
                        result = GetSqlBinary_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.Bit:
                        result = new SqlBoolean( GetBoolean_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Char:
                        result = new SqlString( GetString_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.DateTime:
                        result = new SqlDateTime( GetDateTime_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Decimal:
                        result = GetSqlDecimal_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.Float:
                        result = new SqlDouble( GetDouble_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Image:
                        result = GetSqlBinary_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.Int:
                        result = new SqlInt32( GetInt32_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Money:
                        result = GetSqlMoney_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.NChar: 
                        result = new SqlString( GetString_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.NText: 
                        result = new SqlString( GetString_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.NVarChar: 
                        result = new SqlString( GetString_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Real:
                        result = new SqlSingle( GetSingle_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.UniqueIdentifier:
                        result = new SqlGuid( GetGuid_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.SmallDateTime:
                        result = new SqlDateTime( GetDateTime_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.SmallInt:
                        result = new SqlInt16( GetInt16_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.SmallMoney:
                        result = GetSqlMoney_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.Text:
                        result = new SqlString( GetString_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Timestamp:
                        result = GetSqlBinary_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.TinyInt:
                        result = new SqlByte( GetByte_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.VarBinary:
                        result = GetSqlBinary_Unchecked( sink, getters, ordinal );
                        break;
                    case SqlDbType.VarChar:
                        result = new SqlString( GetString_Unchecked( sink, getters, ordinal ) );
                        break;
                    case SqlDbType.Variant:
                        metaData = getters.GetVariantType( sink, ordinal );
                        sink.ProcessMessagesAndThrow();
                        Debug.Assert( SqlDbType.Variant != metaData.SqlDbType, "Variant-within-variant causes endless recursion!" );
                        result = GetSqlValue( sink, getters, ordinal, metaData, context );
                        break;
                    case SqlDbType.Xml: 
                        result = GetSqlXml_Unchecked( sink, getters, ordinal, context );
                        break;
                    case SqlDbType.Udt:
                        result = GetUdt_LengthChecked( sink, getters, ordinal, metaData );
                        break;
                }
            }

            return result;
        }
Ejemplo n.º 18
0
 private static void SetSqlInt16_Unchecked( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SqlInt16 value ) {
     if ( value.IsNull ) {
         setters.SetDBNull( sink, ordinal );
     }
     else {
         setters.SetInt16( sink, ordinal, value.Value ); 
     }
     sink.ProcessMessagesAndThrow();
 }
Ejemplo n.º 19
0
 /**
  * Converts this SqlString structure to SqlInt16.
  * @return A SqlInt16 structure whose Value equals the Value of this SqlString structure.
  */
 public SqlInt16 ToSqlInt16()
 {
     return(SqlInt16.Parse(_value));
 }
Ejemplo n.º 20
0
        /**
         * The ones complement operator performs a bitwise one's complement operation on its SqlInt16 operand.
         * @param x A SqlInt16 instance
         * @return A SqlInt16 instance whose Value property contains the ones complement of the SqlInt16 parameter.
         */
        public static SqlInt16 OnesComplement(SqlInt16 x)
        {
            int res = x._value ^ 0xFFFF;

            return(new SqlInt16(res));
        }
Ejemplo n.º 21
0
 // Alternative method for operator >=
 public static SqlBoolean GreaterThanOrEqual(SqlInt16 x, SqlInt16 y)
 {
     return(x >= y);
 }
Ejemplo n.º 22
0
 // Alternative method for operator >
 public static SqlBoolean GreaterThan(SqlInt16 x, SqlInt16 y)
 {
     return(x > y);
 }
Ejemplo n.º 23
0
 // Alternative method for operator !=
 public static SqlBoolean NotEquals(SqlInt16 x, SqlInt16 y)
 {
     return(x != y);
 }
Ejemplo n.º 24
0
 public int CompareTo(SqlInt16 value)
 {
     return(CompareSqlInt16(value));
 }
Ejemplo n.º 25
0
        /**
         * Performs a bitwise exclusive-OR operation on the supplied parameters.
         * @param x A SqlInt16 instance
         * @param y A SqlInt16 instance
         * @return The results of the XOR operation.
         */
        public static SqlInt16 Xor(SqlInt16 x, SqlInt16 y)
        {
            int res = x._value ^ y._value;

            return(new SqlInt16(res));
        }
Ejemplo n.º 26
0
        /**
         * The subtraction operator the second SqlInt16 operand from the first.
         * @param x A SqlInt16 instance
         * @param y A SqlInt16 instance
         * @return The results of the subtraction operation.
         */
        public static SqlInt16 Subtract(SqlInt16 x, SqlInt16 y)
        {
            int res = x._value - y._value;

            return(new SqlInt16(res));
        }
Ejemplo n.º 27
0
 // Alternative method for operator ^
 public static SqlInt16 Xor(SqlInt16 x, SqlInt16 y)
 {
     return(x ^ y);
 }
Ejemplo n.º 28
0
 // Alternative method for operator ==
 public static SqlBoolean Equals(SqlInt16 x, SqlInt16 y)
 {
     return(x == y);
 }
Ejemplo n.º 29
0
 // Alternative method for operator <
 public static SqlBoolean LessThan(SqlInt16 x, SqlInt16 y)
 {
     return (x < y);
 }
Ejemplo n.º 30
0
 // Alternative method for operator <
 public static SqlBoolean LessThan(SqlInt16 x, SqlInt16 y)
 {
     return(x < y);
 }
Ejemplo n.º 31
0
 // Alternative method for operator <=
 public static SqlBoolean LessThanOrEqual(SqlInt16 x, SqlInt16 y)
 {
     return (x <= y);
 }
Ejemplo n.º 32
0
 // Alternative method for operator <=
 public static SqlBoolean LessThanOrEqual(SqlInt16 x, SqlInt16 y)
 {
     return(x <= y);
 }
Ejemplo n.º 33
0
        public int CompareTo(SqlInt16 value)
        {
            // If both Null, consider them equal.
            // Otherwise, Null is less than anything.
            if (IsNull)
                return value.IsNull ? 0 : -1;
            else if (value.IsNull)
                return 1;

            if (this < value) return -1;
            if (this > value) return 1;
            return 0;
        }
Ejemplo n.º 34
0
 // Alternative method for operator !=
 public static SqlBoolean NotEquals(SqlInt16 x, SqlInt16 y)
 {
     return (x != y);
 }
Ejemplo n.º 35
0
			public override void SetSqlInt16   (object o, SqlInt16    value) { var obj = GetObject(o); if (obj != null) _mapper.SetSqlInt16   (obj, value); }
Ejemplo n.º 36
0
 // Alternative method for operator >
 public static SqlBoolean GreaterThan(SqlInt16 x, SqlInt16 y)
 {
     return (x > y);
 }
Ejemplo n.º 37
0
        private Boolean ReadValues(System.IO.BinaryReader r)
        {
            Int32 count;
              if(r.BaseStream.Length == 0) return false;
              count = Sql.Read7BitEncodedInt(r);

              if (count == 0) return true;

              for (Int32 i = 0; i < count; i++)
              {
            String    name  = r.ReadString();
            SqlDbType LType = (SqlDbType)r.ReadUInt16();
            Object    value = null;
            Int32 len;
            //Int32 lcid;
            //SqlCompareOptions co;

            switch (LType)
            {
              case SqlDbType.Bit      : value = new SqlBoolean(r.ReadBoolean()); break;
              case SqlDbType.TinyInt  : value = new SqlByte(r.ReadByte()); break;
              case SqlDbType.SmallInt : value = new SqlInt16((Int16)r.ReadInt16()); break;
              case SqlDbType.Int      : value = new SqlInt32((Int32)r.ReadInt32()); break;
              case SqlDbType.BigInt   : value = new SqlInt64(r.ReadInt64()); break;

              case SqlDbType.Binary   :
              case SqlDbType.VarBinary: len = r.ReadUInt16(); value = new SqlBytes(r.ReadBytes(len)); break;

              case SqlDbType.Char     :
              case SqlDbType.VarChar  : //value = new Sql.SqlAnsiString(r); break;
              case SqlDbType.NChar:
              case SqlDbType.NVarChar:
            //co = (SqlCompareOptions)r.ReadUInt16();
            //lcid = r.ReadInt32();
            //value = new SqlString(r.ReadString(), lcid, co);
            value = new SqlString(r.ReadString());
            break;

              case SqlDbType.DateTime     : value = new SqlDateTime(DateTime.FromBinary(r.ReadInt64())); break;
              case SqlDbType.SmallDateTime:
              case SqlDbType.Date         :
              case SqlDbType.DateTime2    : value = DateTime.FromBinary(r.ReadInt64()); break;
              case SqlDbType.Time         : value = TimeSpan.FromTicks(r.ReadInt64()); break;
              case SqlDbType.DateTimeOffset:
            DateTime LDateTime = DateTime.FromBinary(r.ReadInt64());
            value = new DateTimeOffset(LDateTime, TimeSpan.FromTicks(r.ReadInt64()));
            break;

              case SqlDbType.Decimal: value = new SqlDecimal(r.ReadDecimal()); break;
              case SqlDbType.Float  : value = new SqlDouble(r.ReadDouble()); break;
              // Not support SqlDbType.Image
              case SqlDbType.Money  : value = new SqlMoney(r.ReadDecimal()); break;
              case SqlDbType.Real   : value = new SqlSingle(r.ReadDouble()); break;
              case SqlDbType.SmallMoney: value = new SqlMoney(r.ReadDecimal()); break;
              // Not support SqlDbType.Structured
              // Not support SqlDbType.Text
              // Not support SqlDbType.Timestamp
              case SqlDbType.UniqueIdentifier: value = new SqlGuid(r.ReadString()); break;
              // Not support SqlDbType.Variant
              case SqlDbType.Xml:
            XmlReader rXml = XmlReader.Create(new System.IO.StringReader(r.ReadString()));
            value = new SqlXml(rXml);
            break;

              case SqlDbType.Udt:
            // TODO: Пока поддержа только TParams
            //String LTypeName = r.ReadString();
            //value = CreateUdtObject(LTypeName);
            //if (value is IBinarySerialize)
            //  (value as IBinarySerialize).Read(r);
            //else
            //  throw new Exception(String.Format("Невозможно прочитать данные типа UDT '{0}' - не поддерживается IBinarySerialize", LTypeName));
            value = new SqlUdt(r);
            break;

              default:
            throw new Exception(String.Format("Невозможно прочитать данные, тип '{0}' не поддерживается текущей версией {1}", LType.ToString(), this.GetType().Name));
              // Not support SqlDbType.NText
            }
            if (value != null) FData.Add(name, value);
              }

              return true;
        }
Ejemplo n.º 38
0
 // Alternative method for operator >=
 public static SqlBoolean GreaterThanOrEqual(SqlInt16 x, SqlInt16 y)
 {
     return (x >= y);
 }
Ejemplo n.º 39
0
        //--------------------------------------------------
        // Alternative methods for overloaded operators
        //--------------------------------------------------

        // Alternative method for operator ~
        public static SqlInt16 OnesComplement(SqlInt16 x)
        {
            return(~x);
        }
Ejemplo n.º 40
0
		public virtual void SetSqlInt16   (object o, SqlInt16    value) { MemberAccessor.SetSqlInt16   (o, value); }
Ejemplo n.º 41
0
 // Alternative method for operator +
 public static SqlInt16 Add(SqlInt16 x, SqlInt16 y)
 {
     return(x + y);
 }
Ejemplo n.º 42
0
		public void SetSqlInt16 (int i, SqlInt16 value)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 43
0
 // Alternative method for operator -
 public static SqlInt16 Subtract(SqlInt16 x, SqlInt16 y)
 {
     return(x - y);
 }
Ejemplo n.º 44
0
        internal static void SetSqlInt16( SmiEventSink_Default sink, ITypedSettersV3 setters, int ordinal, SmiMetaData metaData, SqlInt16 value ) {
            ThrowIfInvalidSetterAccess( metaData, ExtendedClrTypeCode.SqlInt16 );

            SetSqlInt16_Unchecked( sink, setters, ordinal, value ); 
        }
Ejemplo n.º 45
0
 // Alternative method for operator *
 public static SqlInt16 Multiply(SqlInt16 x, SqlInt16 y)
 {
     return(x * y);
 }
Ejemplo n.º 46
0
        internal static SqlInt16 GetSqlInt16( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) {
            SqlInt16 result;
            if ( CanAccessGetterDirectly( metaData, ExtendedClrTypeCode.SqlInt16 ) ) {
                if ( IsDBNull_Unchecked( sink, getters, ordinal ) ) {
                    result = SqlInt16.Null;
                }
                else {
                    Int16 temp = GetInt16_Unchecked( sink, getters, ordinal );
                    result = new SqlInt16( temp );
                }
            }
            else {
                object obj = GetSqlValue( sink, getters, ordinal, metaData, null  );
                if (null == obj) {
                    throw ADP.InvalidCast();
                }
                result = (SqlInt16) obj;
            }

            return result;
        }
Ejemplo n.º 47
0
 // Alternative method for operator /
 public static SqlInt16 Divide(SqlInt16 x, SqlInt16 y)
 {
     return(x / y);
 }
Ejemplo n.º 48
0
		public void SqlInt16ToSqlInt64 ()
		{
			SqlInt16 Test64 = new SqlInt16 (64);
			Assert.AreEqual ((long) 64, ((SqlInt64) Test64).Value, "#AC01");
		}
Ejemplo n.º 49
0
 public static SqlInt16 Modulus(SqlInt16 x, SqlInt16 y)
 {
     return(x % y);
 }
Ejemplo n.º 50
0
 public SqlInt16 Adjust(SqlInt16 value)
 {
     if (SqlDbType.SmallInt != SqlDbType)
         ThrowInvalidType();
     return value;
 }
Ejemplo n.º 51
0
 // Alternative method for operator &
 public static SqlInt16 BitwiseAnd(SqlInt16 x, SqlInt16 y)
 {
     return(x & y);
 }