public void DetermineInDelTest()
 {
     SqlString indel = new SqlString("30-TCTC	47-T	59+A	74-C	");
     SqlInt64 posStart = new SqlInt64(47152571);
     IEnumerable resultList = UserDefinedFunctions.DetermineInDel(posStart, indel);
     Assert.AreEqual(4, ((ArrayList)resultList).Count);
 }
Example #2
0
		public void ArithmeticMethods ()
		{
			SqlInt64 Test64 = new SqlInt64 (64);
			SqlInt64 Test0 = new SqlInt64 (0);
			SqlInt64 Test164 = new SqlInt64 (164);
			SqlInt64 TestMax = new SqlInt64 (SqlInt64.MaxValue.Value);

			// Add()
			Assert.AreEqual ((long) 64, SqlInt64.Add (Test64, Test0).Value, "#D01");
			Assert.AreEqual ((long) 228, SqlInt64.Add (Test64, Test164).Value, "#D02");
			Assert.AreEqual ((long) 164, SqlInt64.Add (Test0, Test164).Value, "#D03");
			Assert.AreEqual ((long) SqlInt64.MaxValue, SqlInt64.Add (TestMax, Test0).Value, "#D04");

			try {
				SqlInt64.Add (TestMax, Test64);
				Assert.Fail ("#D05");
			} catch (OverflowException e) {
				Assert.AreEqual (typeof (OverflowException), e.GetType (), "#D06");
			}

			// Divide()
			Assert.AreEqual ((long) 2, SqlInt64.Divide (Test164, Test64).Value, "#D07");
			Assert.AreEqual ((long) 0, SqlInt64.Divide (Test64, Test164).Value, "#D08");

			try {
				SqlInt64.Divide (Test64, Test0);
				Assert.Fail ("#D09");
			} catch (DivideByZeroException e) {
				Assert.AreEqual (typeof (DivideByZeroException), e.GetType (), "#D10");
			}

			// Mod()
			Assert.AreEqual ((SqlInt64) 36, SqlInt64.Mod (Test164, Test64), "#D11");
			Assert.AreEqual ((SqlInt64) 64, SqlInt64.Mod (Test64, Test164), "#D12");

			// Multiply()
			Assert.AreEqual ((long) 10496, SqlInt64.Multiply (Test64, Test164).Value, "#D13");
			Assert.AreEqual ((long) 0, SqlInt64.Multiply (Test64, Test0).Value, "#D14");

			try {
				SqlInt64.Multiply (TestMax, Test64);
				Assert.Fail ("#D15");
			} catch (OverflowException e) {
				Assert.AreEqual (typeof (OverflowException), e.GetType (), "#D16");
			}

			// Subtract()
			Assert.AreEqual ((long) 100, SqlInt64.Subtract (Test164, Test64).Value, "#D17");

			try {
				SqlInt64.Subtract (SqlInt64.MinValue, Test164);
				Assert.Fail ("#D18");
			} catch (OverflowException e) {
				Assert.AreEqual (typeof (OverflowException), e.GetType (), "#D19");
			}

			// Modulus ()
			Assert.AreEqual ((SqlInt64)36, SqlInt64.Modulus (Test164, Test64), "#D20");
			Assert.AreEqual ((SqlInt64)64, SqlInt64.Modulus (Test64, Test164), "#D21");
		}
Example #3
0
 public static SqlInt32 IsNucX(SqlInt64 posStart, SqlString misMNuc, SqlInt64 refPos, SqlString refNuc, SqlString countNuc)
 {
     SqlInt32 result;
     Dictionary<long, string> mutationPositions = new Dictionary<long, string>();
     string mutationPattern = @"[0-9]+ [ACGTN]+";
     MatchCollection matches = Regex.Matches(misMNuc.Value, mutationPattern);
     foreach (Match match in matches)
     {
         var foundMutation = match.Value;
         string[] foundMutParts = foundMutation.Split(' ');
         long mutStartPos = posStart.Value + Int32.Parse(foundMutParts[0]);
         var mutNuc = foundMutParts[1];
         mutationPositions.Add(mutStartPos, mutNuc);
     }
     string mutValue;
     if (mutationPositions.TryGetValue(refPos.Value, out mutValue))
     {
         result = new SqlInt32(countNuc.Value.Equals(mutValue) ? 1 : 0);
     }
     else
     {
         result = new SqlInt32(countNuc.Value.Equals(refNuc.Value) ? 1 : 0);
     }
     return result;
 }
Example #4
0
 public static IEnumerable DetRefPosCov(SqlInt64 refPosStart, SqlBinary refSeq, SqlInt64 sreadPosStart, SqlInt64 sreadPosEnd,
     SqlString misMNuc, SqlString indel)
 {
     ArrayList result = new ArrayList();
     // The following contains plus one because of length-determination:
     int sreadSeqLength = (int)(sreadPosEnd.Value - sreadPosStart.Value) + 1;
     List<long> deletionPositions = DetermineDelPositions(sreadPosStart.Value, indel.Value);
     long actRefPos = sreadPosStart.Value;
     int refIndex = 0;
     while (refIndex < sreadSeqLength)
     {
         if (deletionPositions.Contains(actRefPos))
         {
             result.Add(new RefPosCoverage
             {
                 refPos = actRefPos,
                 coverage = 0
             });
         }
         else
         {
             result.Add(new RefPosCoverage
             {
                 refPos = actRefPos,
                 coverage = 1
             });
         }
         refIndex++;
         actRefPos++;
     }
     return result;
 }
Example #5
0
    public static void FillRowFromSeqStartEnd(object tableTypeObject, out SqlString substr, out SqlInt64 cnt)
    {
        var tableType = (SubstrCount)tableTypeObject;

        substr = tableType.Substr;
        cnt = tableType.Cnt;
    }
Example #6
0
 public static object Box(SqlInt64 a)
 {
     if (a.IsNull)
         return null;
     else
         return a.Value;
 }
Example #7
0
    public static void Shop_AddProductVariant(string StoreName, string APIKey, string Password, long ProductID, string JsonString, out SqlInt64 VariantID)
    {
        ShopifyClient sp = new ShopifyClient(StoreName, APIKey, Password);
        VariantID = sp.AddProductVariant(ProductID, JsonString);

        if (!String.IsNullOrEmpty(sp.ErrMsg))
            RaiseErr(sp.ErrMsg);
    }
Example #8
0
        public void Create()
        {
            SqlInt64 TestLong = new SqlInt64(29);
            Assert.Equal(29, TestLong.Value);

            TestLong = new SqlInt64(-9000);
            Assert.Equal(-9000, TestLong.Value);
        }
Example #9
0
    public static SqlGuid ToGuid(SqlInt64 numTop, SqlInt64 numBottom)
    {
        if (numTop.IsNull || numBottom.IsNull) return SqlGuid.Null;

        var guid = ConvertToGuid(numTop.Value, numBottom.Value);

        return new SqlGuid(guid);
    }
                public void Create()
                {
                        SqlInt64 TestLong = new SqlInt64 (29);
                        AssertEquals ("#A01", (long)29, TestLong.Value);

                        TestLong = new SqlInt64 (-9000);
                        AssertEquals ("#A02", (long)-9000, TestLong.Value);
                 }
Example #11
0
		public void Create ()
		{
			SqlInt64 TestLong = new SqlInt64 (29);
			Assert.AreEqual ((long) 29, TestLong.Value, "#A01");

			TestLong = new SqlInt64 (-9000);
			Assert.AreEqual ((long) -9000, TestLong.Value, "#A02");
		}
Example #12
0
		public void Properties ()
		{
			SqlInt64 Test5443 = new SqlInt64 (5443);
			SqlInt64 Test1 = new SqlInt64 (1);

			Assert.IsTrue (SqlInt64.Null.IsNull, "#C01");
			Assert.AreEqual ((long) 5443, Test5443.Value, "#C02");
			Assert.AreEqual ((long) 1, Test1.Value, "#C03");
		}
Example #13
0
        public void Properties()
        {
            SqlInt64 Test5443 = new SqlInt64(5443);
            SqlInt64 Test1 = new SqlInt64(1);

            Assert.True(SqlInt64.Null.IsNull);
            Assert.Equal(5443, Test5443.Value);
            Assert.Equal(1, Test1.Value);
        }
                public void Properties()
                {
                        SqlInt64 Test5443 = new SqlInt64 (5443);
                        SqlInt64 Test1 = new SqlInt64 (1);

                        Assert ("#C01", SqlInt64.Null.IsNull);
                        AssertEquals ("#C02", (long)5443, Test5443.Value);
                        AssertEquals ("#C03", (long)1, Test1.Value);
                }
Example #15
0
    public static void FillRowFromExtraAndMissingNuc(object tableTypeObject, out SqlInt64 inDelStartPos, out SqlBoolean inDel, out SqlInt32 chainLen, out SqlString nucChain)
    {
        var tableType = (InDelRow)tableTypeObject;

        inDelStartPos = tableType.InDelStartPos;
        inDel = tableType.InDel;
        chainLen = tableType.ChainLen;
        nucChain = tableType.NucChain;
    }
Example #16
0
    public static SqlGuid ToGuidFromHash(SqlInt64 numTop, SqlString text)
    {
        if (numTop.IsNull || text.IsNull) return SqlGuid.Null;

        var hash = text.Value.GetHashCode();

        var guid = ConvertToGuid(numTop.Value, hash);

        return new SqlGuid(guid);
    }
 public static IEnumerable ObtainMismatchAndInDelBin(SqlBinary refSeq, SqlInt64 refPosStart, SqlBinary sreadSeq, SqlInt64 sreadPosStart,
     SqlString insPos, SqlString delPos)
 {
     Dictionary<int, int> insOffsetLen = DetermineOffsetLen(insPos);
     Dictionary<int, int> delOffsetLen = DetermineOffsetLen(delPos);
     string decodedRelatedRefSeqBlock = BinaryNucleotideCodecUtil.DetermineDecodedRelatedRefSeqBlock(sreadSeq.Length, sreadPosStart.Value,
         refPosStart.Value, refSeq.Value);
     string decodedSreadSeq = BinaryNucleotideCodecUtil.DetermineDecodedSeq(sreadSeq.Value);
     return DetermineMismatchInDelRow(insOffsetLen, delOffsetLen, decodedRelatedRefSeqBlock, decodedSreadSeq);
 }
Example #18
0
    public static void Refunds_FillRow(object tableObject, out SqlInt64 RefundID, out SqlDateTime CreatedAt, out SqlString Note, out SqlBoolean Restock, out SqlInt64 UserID,
        out SqlInt32 RefundLineItems, out SqlInt32 Transactions)
    {
        Refund r = (Refund)tableObject;
        RefundID = r.id;
        CreatedAt = r.created_at != null ? Convert.ToDateTime(r.created_at) : SqlDateTime.Null;
        Note = r.note != null ? r.note.ToString() : SqlString.Null;
        Restock = Convert.ToBoolean(r.restock);
        UserID = r.user_id;

        RefundLineItems = r.refund_line_items.Count;
        Transactions = r.transactions.Count;
    }
 public void Accumulate(SqlString currentRefNuc, SqlInt64 currentPos)
 {
     var refNucChars = currentRefNuc.Value.ToCharArray();
     char refNucChar;
     if (refNucChars.Length == 1)
     {
         refNucChar = refNucChars[0];
     }
     else
     {
         throw new InvalidDataException("The input reference nucleotide contains only one character.");
     }
     intermediateResult[currentPos.Value] = refNucChar;
 }
Example #20
0
 public static void Fulfillments_FillRow(object tableObject, out SqlInt64 ID, out SqlInt64 OrderID, out SqlString Status, out SqlDateTime CreatedAt,
     out SqlString Service, out SqlDateTime UpdatedAt, out SqlString TrackingCompany, out SqlString TrackingNumber, out SqlString TrackingURL)
 {
     Fulfillment f = (Fulfillment)tableObject;
     ID = f.id;
     OrderID = f.order_id;
     Status = f.status;
     CreatedAt = f.created_at != null ? Convert.ToDateTime(f.created_at) : SqlDateTime.Null;
     Service = f.service;
     UpdatedAt = f.updated_at != null ? Convert.ToDateTime(f.updated_at) : SqlDateTime.Null;
     TrackingCompany = f.tracking_company != null ? f.tracking_company.ToString() : SqlString.Null;
     TrackingNumber = f.tracking_number;
     TrackingURL = f.tracking_url;
 }
Example #21
0
 public static void Risks_FillRow(object tableObject, out SqlInt64 RiskID, out SqlInt64 OrderID, 
     out SqlInt64 CheckOutID, out SqlString Source, out SqlString Score, out SqlString Recommendation, out SqlBoolean Display, 
     out SqlString CauseCancel, out SqlString Message, out SqlString MerchantMessage)
 {
     OrderRisk r = (OrderRisk)tableObject;
     RiskID = r.id;
     OrderID = r.order_id;
     CheckOutID = r.checkout_id;
     Source = r.source;
     Score = r.score;
     Recommendation = r.recommendation;
     Display = r.display;
     CauseCancel = r.cause_cancel != null ? r.cause_cancel.ToString() : SqlString.Null;
     Message = r.message;
     MerchantMessage = r.merchant_message;
 }
Example #22
0
 public static IEnumerable DetermineInDel(SqlInt64 posStart, SqlString indel)
 {
     ArrayList resultList = new ArrayList();
     string patternForIndelEntry = @"[0-9]+[-\+]+[a-zA-Z]+";
     MatchCollection matches = Regex.Matches(indel.Value, patternForIndelEntry);
     foreach (Match match in matches)
     {
         var foundIndel = match.Value;
         var isInsertion = Regex.IsMatch(foundIndel, @"^[0-9]+[\+]+[a-zA-Z]+$");
         char splittingChar = isInsertion ? '+' : '-';
         string[] foundIndelParts = foundIndel.Split(splittingChar);
         long inDelStartPos = posStart.Value + Int32.Parse(foundIndelParts[0]);
         var nucChainValue = foundIndelParts[1];
         resultList.Add(new InDelRow { InDelStartPos = inDelStartPos, InDel = isInsertion, ChainLen = nucChainValue.Length, NucChain = nucChainValue });
     }
     return resultList;
 }
Example #23
0
 public static SqlBoolean IsDel(SqlInt64 posStart, SqlString indel, SqlInt64 refPos)
 {
     List<long> deletionPositions = new List<long>();
     string deletionPattern = @"[0-9]+-[ACGTN]+";
     MatchCollection matches = Regex.Matches(indel.Value, deletionPattern);
     foreach (Match match in matches)
     {
         var foundDeletion = match.Value;
         string[] foundDelParts = foundDeletion.Split('-');
         long delStartPos = posStart.Value + Int32.Parse(foundDelParts[0]) + 1;
         var delLen = foundDelParts[1].Length;
         for (int index = 0; index < delLen; index++)
         {
             deletionPositions.Add(delStartPos + index);
         }
     }
     return new SqlBoolean(deletionPositions.Contains(refPos.Value));
 }
Example #24
0
 public static IEnumerable DetNucDistr(SqlInt64 refPosStart, SqlBinary refSeq, SqlInt64 sreadPosStart, SqlInt64 sreadPosEnd,
     SqlString misMNuc, SqlString indel)
 {
     ArrayList result = new ArrayList();
     // The following is used because of triplet:
     string decodedRelatedRefSeqBlock = BinaryNucleotideCodecUtil.DetermineRefSeqBlockWithPrecAndSuccNucs(sreadPosStart.Value,
         sreadPosEnd.Value, refPosStart.Value, refSeq.Value);
     List<long> deletionPositions = DetermineDelPositions(sreadPosStart.Value, indel.Value);
     Dictionary<long, string> mutationPositions = DetermineMutPositions(sreadPosStart.Value, misMNuc.Value);
     long actRefPos = sreadPosStart.Value;
     // The refIndex is one-based because of triplet:
     int refIndex = 1;
     // The last element of decodedRelatedRefSeqBlock is not needed because it is only triplet:
     while (refIndex < decodedRelatedRefSeqBlock.Length - 1)
     {
         RecordActNucDetail(result, decodedRelatedRefSeqBlock, deletionPositions, mutationPositions, actRefPos, refIndex);
         refIndex++;
         actRefPos++;
     }
     return result;
 }
		public static void GeneratorCreate(SqlString code, SqlInt64 seed, SqlInt32 offset) {
			CheckSystemLock();
			if (code.IsNull) {
				throw new ArgumentException("code");
			}
			if (seed.IsNull) {
				throw new ArgumentException("seed");
			}
			if (offset.IsNull) {
				throw new ArgumentException("offset");
			}

			var filename = Path.Combine(GeneratorsDirectory, code.Value + ".xml");
			if (File.Exists(filename)) {
				throw new IOException("generator with given code already existed");
			}
			using (var f = new FileLock(filename)) {
				f.WriteFile(DefineGeneratorXml(seed.Value, offset.Value).ToString());
			}
			SqlContext.Pipe.Send("generator created sucessfully");
		}
Example #26
0
        private static int ProcessEntity(SqlBytes data, SqlConnection cn, SqlTransaction transaction, 
            out SqlInt64 insertID, out Guid typeID)
        {
            Entity ent = new Entity(data.Stream, false);
            typeID = ent.tid;
            string[] entityType = ent.mcType.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            if (entityType.Length < 2)
                throw new InvalidAQNException(string.Format("AQN is invalid: {0}", ent.mcType));

            //Add the base entity
            SqlCommand sqlCmd;
            insertID = SqlInt64.Null;

            if (transaction!=null)
                sqlCmd = new SqlCommand(EntityCreateSQL, cn, transaction);
            else
                sqlCmd = new SqlCommand(EntityCreateSQL, cn);

            sqlCmd.CommandType = CommandType.Text;

            sqlCmd.Parameters.Add("@Entity_Version_ID", SqlDbType.UniqueIdentifier).Value = ent.vid;
            sqlCmd.Parameters.Add("@Entity_Content_ID", SqlDbType.UniqueIdentifier).Value = ent.cid;
            sqlCmd.Parameters.Add("@Entity_Type_ID", SqlDbType.UniqueIdentifier).Value = typeID;
            sqlCmd.Parameters.Add("@Assembly_Qualified_Name", SqlDbType.NVarChar, 255).Value = entityType[0] + ", " + entityType[1];
            sqlCmd.Parameters.Add("@Create_Date", SqlDbType.DateTime).Value = DateTime.Now;

            using (SqlDataReader reader = sqlCmd.ExecuteReader(CommandBehavior.SingleRow))
            {
                if (reader.HasRows && reader.Read())
                {
                    insertID = reader.GetSqlInt64(0);
                }
            }

            if (insertID.IsNull)
                return 515;

            return 200;
        }
    public static SqlString CollectNucsFromNeighborhoodOfRefSeqPos(SqlInt32 pupID, SqlInt64 pos, SqlInt32 posRadius)
    {
        using (SqlConnection conn = new SqlConnection("context connection=true"))
        {
            string beginOfSelection = "SELECT refNuc FROM [dbo].[coverageEnc]"
                + "WHERE [pupID] = " + pupID.ToString();
            conn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;
            long centerRefPos = pos.Value;
            int radius = posRadius.Value;
            string posList = "";
            for (long i = centerRefPos - radius; i <= centerRefPos + radius; i++)
            {
                posList += i.ToString() + ",";
            }
            // The last comma is ignored:
            posList = posList.Substring(0, posList.Length - 1);
            long actualRefPos = pos.Value - posRadius.Value;
            cmd.CommandText = beginOfSelection + "AND [pos] in (" + posList + ")";

            string result = "";
            using (SqlDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    string actualRefNuc = reader.GetString(0);
                    result += actualRefNuc;
                }
            }

            if (result.Length != 2 * posRadius + 1)
            {
                result = HandleMissingPos(conn, beginOfSelection, centerRefPos, radius, result);
            }

            return new SqlString(result);
        }
    }
Example #28
0
 public static SqlString DetDecRefSeq(SqlInt32 posRadius, SqlInt64 pos, SqlInt64 refPosStart, SqlBinary refSeq)
 {
     if (posRadius.Value > 128)
     {
         throw new InvalidExpressionException("The posRadius is too long. It should be less than 129.");
     }
     else if (posRadius.Value < 0)
     {
         throw new InvalidExpressionException("The posRadius should be non-negative.");
     }
     long relatedPosStartValue = pos.Value - posRadius.Value;
     long relatedPosEndValue = pos.Value + posRadius.Value - 1;
     int relatedByteSeqLength = posRadius.Value;
     // If the relatedPosStartValue is not aligned to the beginning of the given byte exactly
     // then the size of byte array should be increased:
     relatedByteSeqLength = (Math.Abs(relatedPosStartValue - refPosStart.Value) % 2 == 1)
         ? (relatedByteSeqLength + 1) : relatedByteSeqLength;
     string decodedRelatedRefSeqBlock = BinaryNucleotideCodecUtil.DetermineDecodedRelatedRefSeqBlock(relatedByteSeqLength,
         relatedPosStartValue, refPosStart.Value, refSeq.Value);
     decodedRelatedRefSeqBlock = BinaryNucleotideCodecUtil.ComplementSucceedingNuc(relatedPosEndValue, refPosStart.Value,
         refSeq.Value, decodedRelatedRefSeqBlock);
     return new SqlString(decodedRelatedRefSeqBlock);
 }
Example #29
0
 public int CompareTo(SqlInt64 value)
 {
     return(CompareSqlInt64((SqlInt64)value));
 }
Example #30
0
 public static SqlBoolean GreaterThanOrEqual(SqlInt64 x, SqlInt64 y)
 {
     return(x >= y);
 }
Example #31
0
 public static SqlBoolean LessThanOrEqual(SqlInt64 x, SqlInt64 y)
 {
     return(x <= y);
 }
Example #32
0
 /**
  * Converts this SqlString structure to SqlInt64.
  * @return A SqlInt64 structure whose Value equals the Value of this SqlString structure.
  */
 public SqlInt64 ToSqlInt64()
 {
     return(SqlInt64.Parse(_value));
 }
Example #33
0
        //--------------------------------------------------
        // Alternative methods for overloaded operators
        //--------------------------------------------------

        // Alternative method for operator ~
        public static SqlInt64 OnesComplement(SqlInt64 x)
        {
            return(~x);
        }
Example #34
0
 // Alternative method for operator ==
 public static SqlBoolean Equals(SqlInt64 x, SqlInt64 y)
 {
     return(x == y);
 }
Example #35
0
 // Alternative method for operator |
 public static SqlInt64 BitwiseOr(SqlInt64 x, SqlInt64 y)
 {
     return(x | y);
 }
Example #36
0
 // Alternative method for operator ^
 public static SqlInt64 Xor(SqlInt64 x, SqlInt64 y)
 {
     return(x ^ y);
 }
Example #37
0
 // Alternative method for operator *
 public static SqlInt64 Multiply(SqlInt64 x, SqlInt64 y)
 {
     return(x * y);
 }
Example #38
0
 // Alternative method for operator /
 public static SqlInt64 Divide(SqlInt64 x, SqlInt64 y)
 {
     return(x / y);
 }
Example #39
0
 // Alternative method for operator >
 public static SqlBoolean GreaterThan(SqlInt64 x, SqlInt64 y)
 {
     return(x > y);
 }
Example #40
0
        /**
         * Performs a bitwise exclusive-OR operation on the supplied parameters.
         * @param x A SqlInt64 instance
         * @param y A SqlInt64 instance
         * @return The results of the XOR operation.
         */
        public static SqlInt64 Xor(SqlInt64 x, SqlInt64 y)
        {
            long res = x._value ^ y._value;

            return(new SqlInt64(res));
        }
Example #41
0
 // Alternative method for operator &
 public static SqlInt64 BitwiseAnd(SqlInt64 x, SqlInt64 y)
 {
     return(x & y);
 }
Example #42
0
 // Alternative method for operator +
 public static SqlInt64 Add(SqlInt64 x, SqlInt64 y)
 {
     return(x + y);
 }
Example #43
0
        /**
         * The ones complement operator performs a bitwise one's complement operation on its SqlInt64 operand.
         * @param x A SqlInt64 instance
         * @return A SqlInt64 instance whose Value property contains the ones complement of the SqlInt64 parameter.
         */
        public static SqlInt64 OnesComplement(SqlInt64 x)
        {
            ulong res = (ulong)x._value ^ 0xFFFFFFFFFFFFFFFF;

            return(new SqlInt64((long)res));
        }
Example #44
0
		public void SqlInt64ToSqlByte()
		{
			SqlInt64 TestInt6464 = new SqlInt64(64);
			SqlInt64 TestInt64900 = new SqlInt64(900);

			Assert.AreEqual((byte)64, ((SqlByte)TestInt6464).Value, "SqlInt64ToByte" + Error);

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

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

		}
Example #45
0
        /**
         * The division operator divides the first SqlInt64 operand by the second.
         * @param x A SqlInt64 instance.
         * @param y A SqlInt64 instance.
         * @return A SqlInt64 instance containing the results of the division operation.
         * If one of the parameters is null or null value - return SqlInt64.Null.
         */
        public static SqlInt64 Divide(SqlInt64 x, SqlInt64 y)
        {
            long val = x._value / y._value;

            return(new SqlInt64(val));
        }
Example #46
0
 // Alternative method for operator -
 public static SqlInt64 Subtract(SqlInt64 x, SqlInt64 y)
 {
     return(x - y);
 }
Example #47
0
 // Alternative method for operator !=
 public static SqlBoolean NotEquals(SqlInt64 x, SqlInt64 y)
 {
     return(x != y);
 }
Example #48
0
 public static SqlInt64 Modulus(SqlInt64 x, SqlInt64 y)
 {
     return(x % y);
 }
Example #49
0
 public SqlInt64 Adjust(SqlInt64 value)
 {
     if (SqlDbType.BigInt != SqlDbType)
         ThrowInvalidType();
     return value;
 }
Example #50
0
 // Alternative method for operator <
 public static SqlBoolean LessThan(SqlInt64 x, SqlInt64 y)
 {
     return(x < y);
 }