Wrapper class for a byte array.

Namespace:  RedGate.SQLDataCompare.Engine
Assembly:  RedGate.SQLDataCompare.Engine (in RedGate.SQLDataCompare.Engine.dll)

Syntax

Visual Basic (Declaration)
Public Class Blob _
	Implements IComparable, IDisposable
C#
public class Blob : IComparable, IDisposable
Visual C++
public ref class Blob : IComparable, IDisposable

Remarks

The Blob object is used internally by SQL Data Compare to represent a byte array. Use the ByteArray property to access the underlying data.

Examples

C# Copy Code
            using System;
            using RedGate.SQLCompare.Engine;
            using RedGate.SQLDataCompare.Engine;
            using RedGate.SQLDataCompare.Engine.ResultsStore;
             
            namespace SQLDataCompareCodeSnippets
            {
                public class BlobExample
                {
                    public void RunExample()
                    {
                        Database db1=new Database();
                        Database db2=new Database();
             
                        // Register the databases
                        db1.RegisterForDataCompare(new ConnectionProperties(".", "WidgetDev"));
                        db2.RegisterForDataCompare(new ConnectionProperties(".", "WidgetLive"));
             
                        using (ComparisonSession session = new ComparisonSession())
                        {
                            // Create the schema mappings used to compare the database
                            SchemaMappings mappings = new SchemaMappings();
                            mappings.CreateMappings(db1, db2);
             
                            session.CompareDatabases(db1, db2, mappings);
             
                            // Get the reader for the different rows in the results
                            Reader different=session.TableDifferences["[dbo].[WidgetDescriptions]"].ResultsStore.GetReader(Row.RowType.Different);
             
                            // get the first row in the ResultsStore Reader for the different rows.
             
                            Row currentRow=different.GetRow(0);
             
                            //field1 and field2 contain the position of the two BLOBs in the ResultsStore
                            int field1 = different.Fields["Picture"].OrdinalInResults1;
                            int field2 = different.Fields["Picture"].OrdinalInResults2;
             
                            Blob blob1=(Blob)currentRow.Values[field1];
                            Blob blob2=(Blob)currentRow.Values[field2];
             
                            // Output the first 20 bytes
                            for (int i=0; i<20; i++)
                            {
                                Console.Write("{0:X} ", blob1.ByteArray[i]);
                            }
                            Console.WriteLine();
                
                            // Output the first 20 bytes
                            for (int i=0; i<20; i++)
                            {
                                Console.Write("{0:X} ", blob2.ByteArray[i]);
                            }
                            Console.WriteLine();
                        }
                        db1.Dispose();
                        db2.Dispose();
                    }
                }
            }
                
Visual Basic Copy Code
            Option Explicit On 
            
            Imports RedGate.SQLCompare.Engine
            Imports RedGate.SQLDataCompare.Engine
            Imports RedGate.SQLDataCompare.Engine.ResultsStore
             
            Class BlobExample
                Sub RunExample()
                    Dim session As New ComparisonSession
             
                    'register the databases for comparison
                    Dim db1 As New Database
                    Dim db2 As New Database
             
                    db1.RegisterForDataCompare(New ConnectionProperties(".", "WidgetDev"))
                    db2.RegisterForDataCompare(New ConnectionProperties(".", "WidgetLive"))
             
                    'create the schema mappings used to compare the database
                    Dim mappings As New SchemaMappings
                    mappings.CreateMappings(db1, db2)
             
                    'compare the databases
                    session.CompareDatabases(db1, db2, mappings)
             
                    Dim different As Reader = session.TableDifferences("[dbo].[WidgetDescriptions]").ResultsStore.GetReader(Row.RowType.Different)
             
                    'work out the two positions in the fields
                    Dim field1 As Integer = different.Fields("Picture").OrdinalInResults1
                    Dim field2 As Integer = different.Fields("Picture").OrdinalInResults2
             
                    'get the first row in the ResultsStore
                    Dim currentRow As Row = different.GetRow(0)
             
                    'field1 and field2 contain the position of the two BLOBs in the ResultsStore
                    Dim blob1 As Blob = currentRow.Values(field1)
                    Dim blob2 As Blob = currentRow.Values(field2)
             
                    Dim i As Integer
             
                    For i = 0 To 20
                        Console.Write("{0:X} ", blob1.ByteArray(i))
                    Next
                    Console.WriteLine()
             
                    For i = 0 To 20
                        Console.Write("{0:X} ", blob2.ByteArray(i))
                    Next
                    Console.WriteLine()
             
                    'dispose of the objects to delete temporary files
                    session.Dispose()
                    db1.Dispose()
                    db2.Dispose()
                End Sub
            End Class
                

Inheritance Hierarchy

System..::.Object
  RedGate.SQLDataCompare.Engine..::.Blob
    RedGate.SQLDataCompare.Engine..::.CLR

See Also