Ejemplo n.º 1
0
        public void Parse()
        {
            Assert.Throws <ArgumentNullException>(() => SqlGuid.Parse(null));

            Assert.Throws <FormatException>(() => SqlGuid.Parse("not-a-number"));

            Assert.Throws <FormatException>(() => SqlGuid.Parse("9e400"));

            Assert.Equal(new Guid("87654321-0000-0000-0000-000000000000"), SqlGuid.Parse("87654321-0000-0000-0000-000000000000").Value);
        }
Ejemplo n.º 2
0
        public virtual void SetSqlGuid(int ordinal, SqlGuid value)
        {
            // ******** OBSOLETING from SMI -- use ITypedSettersV3 method instead
            //  Intended to be removed prior to RTM.

            // Implement body with throw because there are only a couple of ways to get to this code:
            //  1) Client is calling this method even though the server negotiated for V3+ and dropped support for V2-.
            //  2) Server didn't implement V2- on some interface and negotiated V2-.
            throw System.Data.Common.ADP.InternalError(System.Data.Common.ADP.InternalErrorCode.UnimplementedSMIMethod);
        }
Ejemplo n.º 3
0
 public static void CreateQueue(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString queueName,
     SqlInt32 timeoutSeconds,
     SqlGuid xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureQueueService aqs = new AzureQueueService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     aqs.CreateQueue(queueName.Value, timeoutSeconds.Value,
                     xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
 }
Ejemplo n.º 4
0
        public static void BulkInsertRandomGuids(int number, ref List <Statistics> statsList, string connectionString)
        {
            DataTable insertDataTable = new DataTable();

            insertDataTable.Columns.Add("UUID", typeof(SqlGuid));
            for (int i = 0; i < number; i++)
            {
                SqlGuid myGuid = Guid.NewGuid();

                DataRow row = insertDataTable.NewRow();
                row["UUID"] = myGuid;
                insertDataTable.Rows.Add(row);
            }



            Stopwatch  stopwatch = new Stopwatch();
            Statistics stats     = new Statistics();

            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                stopwatch.Start();

                using (SqlBulkCopy bulkCopy = new SqlBulkCopy(con))
                {
                    bulkCopy.BulkCopyTimeout      = 3600;
                    bulkCopy.DestinationTableName =
                        "[dbo].[RandomGuidTestTable]";

                    // Write from the source to the destination.
                    bulkCopy.WriteToServer(insertDataTable);
                }
                stopwatch.Stop();

                SqlCommand getRowCount = new SqlCommand("GetRowcountFromTable", con);
                getRowCount.CommandType = CommandType.StoredProcedure;
                getRowCount.Parameters.Add(new SqlParameter("@schema_name", "dbo"));
                getRowCount.Parameters.Add(new SqlParameter("@table_name", "RandomGuidTestTable"));

                SqlParameter pvRowCount = new SqlParameter();
                pvRowCount.ParameterName = "@row_count";
                pvRowCount.DbType        = DbType.Int32;
                pvRowCount.Direction     = ParameterDirection.Output;
                getRowCount.Parameters.Add(pvRowCount);
                getRowCount.ExecuteNonQuery();
                //int rowCount = int.Parse(getRowCount.Parameters["@row_count"].Value.ToString());
                int rowCount = Convert.ToInt32(getRowCount.Parameters["@row_count"].Value);

                stats.NumberOfRowsInTable    = rowCount;
                stats.Operation              = System.Reflection.MethodBase.GetCurrentMethod().Name;
                stats.DurationInMilliseconds = stopwatch.ElapsedMilliseconds;
                statsList.Add(stats);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Create special db table for bulk insert
        /// </summary>
        private object CreateSubcontractProfilePaymentDataTable(IEnumerable <SubcontractProfile.WebApi.Services.Model.SubcontractProfilePayment> SubcontractProfilePaymentList)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("payment_id", typeof(SqlString));
            dt.Columns.Add("payment_no", typeof(SqlString));
            dt.Columns.Add("payment_channal", typeof(SqlString));
            dt.Columns.Add("payment_datetime", typeof(SqlDateTime));
            dt.Columns.Add("amount_transfer", typeof(SqlDecimal));
            dt.Columns.Add("bank_transfer", typeof(SqlString));
            dt.Columns.Add("bank_branch", typeof(SqlString));
            dt.Columns.Add("slip_attach_file", typeof(SqlString));
            dt.Columns.Add("contact_name", typeof(SqlString));
            dt.Columns.Add("contact_phone_no", typeof(SqlString));
            dt.Columns.Add("contact_email", typeof(SqlString));
            dt.Columns.Add("remark", typeof(SqlString));
            dt.Columns.Add("status", typeof(SqlString));
            dt.Columns.Add("create_date", typeof(SqlDateTime));
            dt.Columns.Add("create_by", typeof(SqlString));
            dt.Columns.Add("modified_by", typeof(SqlString));
            dt.Columns.Add("modified_date", typeof(SqlDateTime));
            dt.Columns.Add("training_id", typeof(SqlString));
            dt.Columns.Add("company_id", typeof(SqlString));

            if (SubcontractProfilePaymentList != null)
            {
                foreach (var curObj in SubcontractProfilePaymentList)
                {
                    DataRow row = dt.NewRow();
                    row["payment_id"]       = new SqlString(curObj.PaymentId);
                    row["payment_no"]       = new SqlString(curObj.PaymentNo);
                    row["payment_channal"]  = new SqlString(curObj.PaymentChannal);
                    row["payment_datetime"] = new SqlDateTime(curObj.PaymentDatetime);
                    row["amount_transfer"]  = new SqlDecimal(curObj.AmountTransfer);
                    row["bank_transfer"]    = new SqlString(curObj.BankTransfer);
                    row["bank_branch"]      = new SqlString(curObj.BankBranch);
                    row["slip_attach_file"] = new SqlString(curObj.SlipAttachFile);
                    row["contact_name"]     = new SqlString(curObj.ContactName);
                    row["contact_phone_no"] = new SqlString(curObj.ContactPhoneNo);
                    row["contact_email"]    = new SqlString(curObj.ContactEmail);
                    row["remark"]           = new SqlString(curObj.Remark);
                    row["status"]           = new SqlString(curObj.Status);
                    row["create_date"]      = curObj.CreateDate == null ? SqlDateTime.Null : new SqlDateTime(curObj.CreateDate.Value);
                    row["create_by"]        = new SqlString(curObj.CreateBy);
                    row["modified_by"]      = new SqlString(curObj.ModifiedBy);
                    row["modified_date"]    = curObj.ModifiedDate == null ? SqlDateTime.Null : new SqlDateTime(curObj.ModifiedDate.Value);
                    row["training_id"]      = new SqlGuid(curObj.TrainingId);
                    row["company_id"]       = new SqlGuid(curObj.CompanyId);

                    dt.Rows.Add(row);
                }
            }

            return(dt.AsTableValuedParameter());
        }
Ejemplo n.º 6
0
        public void EqualsMethods()
        {
            Assert.False(_test1.Equals(_test2));
            Assert.False(_test2.Equals(_test4));
            Assert.False(_test2.Equals(new SqlString("TEST")));
            Assert.True(_test2.Equals(_test3));

            // Static Equals()-method
            Assert.True(SqlGuid.Equals(_test2, _test3).Value);
            Assert.False(SqlGuid.Equals(_test1, _test2).Value);
        }
Ejemplo n.º 7
0
 public static object Box(SqlGuid a)
 {
     if (a.IsNull)
     {
         return(null);
     }
     else
     {
         return(a.Value);
     }
 }
Ejemplo n.º 8
0
        public static void RemoveEndpointFromPersistentVM(
            SqlString certificateThumbprint,
            SqlGuid sgSubscriptionId,
            SqlString serviceName,
            SqlString deploymentSlots,
            SqlString vmName,
            SqlString EndpointName,
            SqlBoolean fBlocking)
        {
            X509Certificate2 certificate = RetrieveCertificateInStore(certificateThumbprint.Value);

            Azure.Management.Deployment result = Azure.Internal.Management.GetDeployments(
                certificate,
                sgSubscriptionId.Value,
                serviceName.Value,
                deploymentSlots.Value);

            var vmToAdd = (ITPCfSQL.Azure.Management.PersistentVMRole)result.RoleList.FirstOrDefault(item => item.RoleName == vmName.Value);

            if (vmToAdd == null)
            {
                throw new ArgumentException("No PersistentVMRole with name " + vmName.Value + " found in sgSubscriptionId = " +
                                            sgSubscriptionId.Value + ", serviceName = " + serviceName.Value + ", deploymentSlots = "
                                            + deploymentSlots.Value + ".");
            }

            // Remove the endpoint
            ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint[] driiesTemp = new
                                                                                                                  ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint[vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints.Length - 1];
            int iTemp = 0;

            foreach (ITPCfSQL.Azure.Management.DeploymentRoleConfigurationSetsConfigurationSetInputEndpoint ie in vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints)
            {
                if (!(ie.Name == EndpointName.Value))
                {
                    driiesTemp[iTemp++] = ie;
                }
            }

            vmToAdd.ConfigurationSets.ConfigurationSet.InputEndpoints = driiesTemp;

            var output = ITPCfSQL.Azure.Internal.Management.UpdatePersistentVMRole(
                certificate,
                sgSubscriptionId.Value,
                serviceName.Value,
                result.Name,
                vmToAdd);

            PushOperationStatus(
                certificate,
                sgSubscriptionId.Value,
                new Guid(output[ITPCfSQL.Azure.Internal.Constants.HEADER_REQUEST_ID]),
                fBlocking.IsNull ? false : fBlocking.Value);
        }
Ejemplo n.º 9
0
 public void Greaters()
 {
     // GreateThan ()
     Assert.False(SqlGuid.GreaterThan(_test1, _test2).Value);
     Assert.True(SqlGuid.GreaterThan(_test2, _test1).Value);
     Assert.False(SqlGuid.GreaterThan(_test2, _test3).Value);
     // GreaterTharOrEqual ()
     Assert.False(SqlGuid.GreaterThanOrEqual(_test1, _test2).Value);
     Assert.True(SqlGuid.GreaterThanOrEqual(_test2, _test1).Value);
     Assert.True(SqlGuid.GreaterThanOrEqual(_test2, _test3).Value);
 }
Ejemplo n.º 10
0
        public void SqlGuidToSqlBinary()
        {
            byte[] TestByteArray = new byte[16];
            TestByteArray[0] = 15;
            TestByteArray[1] = 200;
            SqlGuid TestGuid = new SqlGuid(TestByteArray);

            SqlBinary TestBinary = (SqlBinary)TestGuid;

            Assert.Equal((byte)15, TestBinary[0]);
        }
Ejemplo n.º 11
0
        public static int Compare(Guid guidA, Guid guidB, int mode)
        {
            if (mode == 1)
            {
                SqlGuid sqlGuidA = guidA;
                SqlGuid sqlGuidB = guidB;
                return(sqlGuidA.CompareTo(sqlGuidB));
            }

            return(String.Compare(guidA.ToString(), guidB.ToString()));
        }
Ejemplo n.º 12
0
        public void TableSortGuidFileGdb()
        {
            IFeatureWorkspace featureWs =
                WorkspaceUtils.OpenFileGdbFeatureWorkspace(TestData.GetArealeFileGdbPath());
            //IFeatureWorkspace featureWs = OpenTestWorkspace();

            ITable table = DatasetUtils.OpenTable(featureWs, "TLM_NUTZUNGSAREAL");

            ITableSort tableSort = new TableSortClass();

            tableSort.Table  = table;
            tableSort.Fields = "UUID";

            tableSort.Sort(null);

            ICursor cursor = tableSort.Rows;

            IRow row;
            Guid lastValue = Guid.Empty;

            while ((row = cursor.NextRow()) != null)
            {
                object value = row.get_Value(1);

                Assert.False(value == DBNull.Value, "Empty UUID field");

                var         currentGuid  = new Guid((string)value);
                IComparable currentValue = currentGuid;

                Console.WriteLine(currentValue);

                if (lastValue != Guid.Empty)
                {
                    // ITableSort on a GUID field in a file GDB does not sort the byte array or at least not in an obvious way
                    byte[] currentGuidAsByteArray = currentGuid.ToByteArray();
                    byte[] lastGuidAsByteArray    = lastValue.ToByteArray();
                    int    byteArrayCompare       = ByteArrayCompare(currentGuidAsByteArray,
                                                                     lastGuidAsByteArray);
                    //Assert.True(byteArrayCompare > 0, "Different compare algorithm from byte array");

                    // ITableSort on a GUID field in a file GDB does not sort the same way as SqlGuid in .NET (i.e. SQL Server sorting)
                    var sqlGuid        = new SqlGuid(currentGuid);
                    int sqlGuidCompare = sqlGuid.CompareTo(new SqlGuid(lastValue));
                    //Assert.True(sqlGuidCompare < 0, "Different compare algorithm from sql server");

                    // ITableSort on a GUID field in a file GDB does not sort the same way as Guid in .NET
                    IComparable comparableGuid = lastValue;
                    int         guidCompare    = comparableGuid.CompareTo(currentValue);
                    //Assert.True(guidCompare < 0, "Different compare algorithm from .Net.");
                }

                lastValue = currentGuid;
            }
        }
Ejemplo n.º 13
0
        public void SqlGuidToSqlString()
        {
            byte[] b = new byte[16];
            b[0] = 100;
            b[1] = 64;
            SqlGuid testGuid = new SqlGuid(b);

            Assert.Equal("00004064-0000-0000-0000-000000000000", ((SqlString)testGuid).Value);

            Assert.Throws <SqlNullValueException>(() => ((SqlString)SqlGuid.Null).Value);
        }
Ejemplo n.º 14
0
        public void SqlGuidToSqlBinary()
        {
            byte[] testByteArray = new byte[16];
            testByteArray[0] = 15;
            testByteArray[1] = 200;
            SqlGuid testGuid = new SqlGuid(testByteArray);

            SqlBinary testBinary = (SqlBinary)testGuid;

            Assert.Equal((byte)15, testBinary[0]);
        }
Ejemplo n.º 15
0
        public void InsertRepeat(SqlInt32 index, SqlGuid value, SqlInt32 count)
        {
            if (count.IsNull)
            {
                return;
            }

            int indexValue = !index.IsNull ? index.Value : _list.Count;

            _list.InsertRepeat(indexValue, value.IsNull ? default(Guid?) : value.Value, count.Value);
        }
Ejemplo n.º 16
0
 public static void GuidListFillRow(object row, out SqlGuid id)
 {
     try
     {
         id = new SqlGuid(row.ToString().Trim());
     }
     catch
     {
         id = SqlGuid.Null;
     }
 }
Ejemplo n.º 17
0
 public void Greaters()
 {
     // GreateThan ()
     Assert.IsTrue(!SqlGuid.GreaterThan(Test1, Test2).Value, "#H01");
     Assert.IsTrue(SqlGuid.GreaterThan(Test2, Test1).Value, "#H02");
     Assert.IsTrue(!SqlGuid.GreaterThan(Test2, Test3).Value, "#H03");
     // GreaterTharOrEqual ()
     Assert.IsTrue(!SqlGuid.GreaterThanOrEqual(Test1, Test2).Value, "#H04");
     Assert.IsTrue(SqlGuid.GreaterThanOrEqual(Test2, Test1).Value, "#H05");
     Assert.IsTrue(SqlGuid.GreaterThanOrEqual(Test2, Test3).Value, "#H06");
 }
Ejemplo n.º 18
0
        public static void CreateQueue_Embedded(
            SqlString logicalConnectionName,
            SqlString queueName,
            SqlInt32 timeoutSeconds,
            SqlGuid xmsclientrequestId)
        {
            Configuration.EmbeddedConfiguration config = Configuration.EmbeddedConfiguration.GetConfigurationFromEmbeddedFile(logicalConnectionName.Value);

            CreateQueue(config.AccountName, config.SharedKey, config.UseHTTPS,
                        queueName, timeoutSeconds, xmsclientrequestId);
        }
Ejemplo n.º 19
0
        public void EqualsMethods()
        {
            Assert.IsTrue(!Test1.Equals(Test2), "#E01");
            Assert.IsTrue(!Test2.Equals(Test4), "#E02");
            Assert.IsTrue(!Test2.Equals(new SqlString("TEST")), "#E03");
            Assert.IsTrue(Test2.Equals(Test3), "#E04");

            // Static Equals()-method
            Assert.IsTrue(SqlGuid.Equals(Test2, Test3).Value, "#E05");
            Assert.IsTrue(!SqlGuid.Equals(Test1, Test2).Value, "#E06");
        }
        public override object ConvertXmlToObject(string s)
        {
            SqlGuid          guid         = new SqlGuid();
            StringReader     input        = new StringReader("<col>" + s + "</col>");
            IXmlSerializable serializable = guid;

            using (XmlTextReader reader = new XmlTextReader(input))
            {
                serializable.ReadXml(reader);
            }
            return((SqlGuid)serializable);
        }
Ejemplo n.º 21
0
        public static System.Collections.IEnumerable ListQueues_Embedded(
            SqlString logicalConnectionName,
            SqlString prefix,
            SqlBoolean IncludeMetadata,
            SqlInt32 timeoutSeconds,
            SqlGuid xmsclientrequestId)
        {
            Configuration.EmbeddedConfiguration config = Configuration.EmbeddedConfiguration.GetConfigurationFromEmbeddedFile(logicalConnectionName.Value);

            return(ListQueues(config.AccountName, config.SharedKey, config.UseHTTPS,
                              prefix, IncludeMetadata, timeoutSeconds, xmsclientrequestId));
        }
Ejemplo n.º 22
0
        public static void ListQueuesProc_Embedded(
            SqlString logicalConnectionName,
            SqlString prefix,
            SqlBoolean IncludeMetadata,
            SqlInt32 timeoutSeconds,
            SqlGuid xmsclientrequestId)
        {
            Configuration.EmbeddedConfiguration config = Configuration.EmbeddedConfiguration.GetConfigurationFromEmbeddedFile(logicalConnectionName.Value);

            ListQueuesProc(config.AccountName, config.SharedKey, config.UseHTTPS,
                           prefix, IncludeMetadata, timeoutSeconds, xmsclientrequestId);
        }
Ejemplo n.º 23
0
        public static void DequeueMessage_Embedded(
            SqlString logicalConnectionName,
            SqlString queueName,
            SqlInt32 visibilityTimeoutSeconds, // we won't support peek so we should do it fast
            SqlInt32 timeoutSeconds,
            SqlGuid xmsclientrequestId)
        {
            Configuration.EmbeddedConfiguration config = Configuration.EmbeddedConfiguration.GetConfigurationFromEmbeddedFile(logicalConnectionName.Value);

            DequeueMessage(config.AccountName, config.SharedKey, config.UseHTTPS,
                           queueName, visibilityTimeoutSeconds, timeoutSeconds, xmsclientrequestId);
        }
        override public object ConvertXmlToObject(string s)
        {
            SqlGuid      newValue  = new SqlGuid();
            string       tempStr   = string.Concat("<col>", s, "</col>"); // this is done since you can give fragmet to reader, bug 98767
            StringReader strReader = new  StringReader(tempStr);

            IXmlSerializable tmp = newValue;

            using (XmlTextReader xmlTextReader = new XmlTextReader(strReader)) {
                tmp.ReadXml(xmlTextReader);
            }
            return((SqlGuid)tmp);
        }
Ejemplo n.º 25
0
        public static void Write(this BinaryWriter writer, SqlGuid value)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write(!value.IsNull);
            if (!value.IsNull)
            {
                writer.Write(value.Value.ToByteArray());
            }
        }
Ejemplo n.º 26
0
        public static void Write(this Stream stream, SqlGuid value)
        {
            if (stream == null)
            {
                throw new ArgumentNullException("stream");
            }

            stream.Write(!value.IsNull);
            if (!value.IsNull)
            {
                stream.Write(value.Value.ToByteArray());
            }
        }
Ejemplo n.º 27
0
        public void Lessers()
        {
            // LessThan()
            Assert.False(SqlGuid.LessThan(_test2, _test3).Value);
            Assert.False(SqlGuid.LessThan(_test2, _test1).Value);
            Assert.True(SqlGuid.LessThan(_test1, _test2).Value);

            // LessThanOrEqual ()
            Assert.True(SqlGuid.LessThanOrEqual(_test1, _test2).Value);
            Assert.False(SqlGuid.LessThanOrEqual(_test2, _test1).Value);
            Assert.True(SqlGuid.LessThanOrEqual(_test2, _test3).Value);
            Assert.True(SqlGuid.LessThanOrEqual(_test4, SqlGuid.Null).IsNull);
        }
Ejemplo n.º 28
0
 public static void EnqueueMessage(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString queueName,
     SqlXml xmlMessage,
     SqlInt32 timeoutSeconds,
     SqlGuid xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureQueueService aqs = new AzureQueueService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ITPCfSQL.Azure.Queue             q   = aqs.GetQueue(queueName.Value);
     q.PutMessage(new Message(xmlMessage.Value),
                  timeoutSeconds.IsNull ? 60 : timeoutSeconds.Value,
                  xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
 }
Ejemplo n.º 29
0
        public static void BreakContainerLeaseImmediately_Embedded(
            SqlString logicalConnectionName,
            SqlString containerName,
            SqlInt32 timeoutSeconds,
            SqlGuid xmsclientrequestId)
        {
            Configuration.EmbeddedConfiguration config = Configuration.EmbeddedConfiguration.GetConfigurationFromEmbeddedFile(logicalConnectionName.Value);

            BreakContainerLeaseImmediately(
                config.AccountName, config.SharedKey, config.UseHTTPS,
                containerName,
                timeoutSeconds, xmsclientrequestId);
        }
Ejemplo n.º 30
0
        public void Lessers()
        {
            // LessThan()
            Assert.IsTrue(!SqlGuid.LessThan(Test2, Test3).Value, "#I01");
            Assert.IsTrue(!SqlGuid.LessThan(Test2, Test1).Value, "#I02");
            Assert.IsTrue(SqlGuid.LessThan(Test1, Test2).Value, "#I03");

            // LessThanOrEqual ()
            Assert.IsTrue(SqlGuid.LessThanOrEqual(Test1, Test2).Value, "#I04");
            Assert.IsTrue(!SqlGuid.LessThanOrEqual(Test2, Test1).Value, "#I05");
            Assert.IsTrue(SqlGuid.LessThanOrEqual(Test2, Test3).Value, "#I06");
            Assert.IsTrue(SqlGuid.LessThanOrEqual(Test4, SqlGuid.Null).IsNull, "#I07");
        }
Ejemplo n.º 31
0
 public static SqlBoolean NotEquals(SqlGuid x, SqlGuid y)
 {
     return (x != y);
 }
Ejemplo n.º 32
0
        public void SqlTypes_SqlGuid()
        {
            NpgsqlParameter parameter;
            SqlGuid value = new SqlGuid(Guid.NewGuid());

#if NET_2_0
            parameter = new NpgsqlParameter ();
            parameter.NpgsqlValue = value;
            Assert.AreEqual (NpgsqlDbType.UniqueIdentifier, parameter.NpgsqlDbType, "#A:NpgsqlDbType");
            Assert.AreEqual (value, parameter.NpgsqlValue, "#A:NpgsqlValue");
            Assert.AreEqual (value, parameter.Value, "#A:Value");

            parameter = new NpgsqlParameter ();
            parameter.NpgsqlValue = SqlGuid.Null;
            Assert.AreEqual (NpgsqlDbType.UniqueIdentifier, parameter.NpgsqlDbType, "#B:NpgsqlDbType");
            Assert.AreEqual (SqlGuid.Null, parameter.NpgsqlValue, "#B:NpgsqlValue");
            Assert.AreEqual (SqlGuid.Null, parameter.Value, "#B:Value");
#endif

            parameter = new NpgsqlParameter();
            parameter.Value = value;
            Assert.AreEqual(NpgsqlDbType.UniqueIdentifier, parameter.NpgsqlDbType, "#C:NpgsqlDbType");
#if NET_2_0
            Assert.AreEqual (value, parameter.NpgsqlValue, "#C:NpgsqlValue");
#endif
            Assert.AreEqual(value, parameter.Value, "#C:Value");
        }
Ejemplo n.º 33
0
        public int CompareTo(SqlGuid value)
        {
            if (value.IsNull)
            {
                return 1;
            }
            else
            {
                // LAMESPEC : ms.net implementation actually compares all the 16 bytes.
                // This code is kept for future changes, if required.
                /*
				{
					//MSDN documentation says that CompareTo is different from 
					//Guid's CompareTo. It uses the SQL Server behavior where
                                        //only the last 6 bytes of value are evaluated	
					byte[] compareValue = ((SqlGuid)value).GetLastSixBytes();
					byte[] currentValue = GetLastSixBytes();
					for (int i = 0; i < 6; i++)
					{
						if (currentValue[i] != compareValue[i]) {
			                              return Compare(currentValue[i], compareValue[i]);
                        			}
					}
			                return 0;
				}
                                */
                return this.value.CompareTo(value.Value);
            }
        }
Ejemplo n.º 34
0
 public static SqlBoolean Equals(SqlGuid x, SqlGuid y)
 {
     return (x == y);
 }
Ejemplo n.º 35
0
 public static SqlBoolean GreaterThan(SqlGuid x, SqlGuid y)
 {
     return (x > y);
 }
Ejemplo n.º 36
0
 public static SqlBoolean GreaterThanOrEqual(SqlGuid x, SqlGuid y)
 {
     return (x >= y);
 }
Ejemplo n.º 37
0
 public static SqlBoolean LessThan(SqlGuid x, SqlGuid y)
 {
     return (x < y);
 }
Ejemplo n.º 38
0
 public static SqlBoolean LessThanOrEqual(SqlGuid x, SqlGuid y)
 {
     return (x <= y);
 }