Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Is this 2000 Visual Basic code (book) any good for SQL Server 2008 R2

$
0
0

This book has code on a CD.  I haven't got the book in printed form. Question: How useful would this book be to me in developing a custom conflict resolver for Merge replication in SQL Server 2008 R2, cost $3.75. The metods are discribed in the book.

http://www.abebooks.com/servlet/BookDetailsPL?bi=2418783972&cm_ven=PFX&cm_cat=affiliates&cm_pla=links&cm_ite=k46974&afn_sr=gan&pfxid=a_826357900

Microsoft SQL Server 2000 Resource Kit
by  Microsoft Corporation 

Chapter 30: Creating Merge Replication Custom Conflict Resolvers Using Visual Basic


Using the Microsoft SQL Replication Conflict Resolver Library
To write a merge replication custom conflict resolver, use the Microsoft SQL Replication Conflict Resolver Library. It is a DLL file that is installed as part of SQL Server 2000. This library of methods enables your application to respond as changes are applied during synchronization.

The Microsoft SQL Replication Conflict Resolver Library contains methods available to retrieve data and commit data between servers. To use the library in your merge replication custom conflict resolver applications, you need to:

The Microsoft SQL Replication Conflict Resolver Library file is replrec.dll. It provides methods to return information from SQL Server to the application, including information about changes, details on how the rows are affected, details on which columns differ, and connection information about the Publisher and Subscriber.

It also contains methods that perform actions, such as evaluating a change to a table, determining winning data and placing it into a table, or removing data from a table.

Summary of Methods in IReplRowChange

Method

Description

CopyColumnFromSource

Sets the destination column to contain the same value as the respective source column.

CopyRowFromSource

Sets the destination row to contain the same data as is contained in the source row.

DeleteRow

Deletes the destination row.

DoDummyUpdate

Updates source or destination row meta data . This allows a subsequent merge process to pick up a change as a new change.

ForceRememberChange

Called before invoking IReplRowChange operations that alter the destination row.

GetChangeType

Returns information regarding the type of change that occurred.

GetColumnAttributes

Returns a bitmap indicating if column is an identity column and/or updatable.

GetColumnDatatype

Returns the column type.

GetColumnName

Returns the column name.

GetColumnStatus

Returns the column status.

GetDestinationColumnValue

Returns the value of the column from the destination table.

GetDestinationConnectionInfo

Returns connection information about the destination.

GetDestinationOwnerName

Returns the owner name of the destination table.

GetErrorInfo

Returns a detailed error code and description if the resolver has been invoked to handle an error situation.

GetExtendedError

Returns additional information about the error, such as whether the error was a duplicate key or a unique index violation.

GetNumColumns

Returns the number of columns in the base table.

GetPriorityWinner

Returns a value indicating which one has the higher priority, the source or the destination.

GetResolverProcedureName

Returns the resolver-specific information (for example, a column name).

GetRowGuidColName

Returns the name of the column in the base table that is the uniqueidentifier column used in merge replication.

GetRowIdentifier

Returns the uniqueidentifier for the row in conflict.

GetSourceColumnValue

Returns the value of the column from the source table.

GetSourceConnectionInfo

Returns connection information about the source.

GetTableName

Returns the name of the table in conflict.

GetTableOwnerName

Returns the owner name of the table.

InsertRow

Inserts the row at the destination.

LogConflict

Indicates whether the conflict should be logged, where, and what message to include.

LogError

Logs the error and an optional description.

UpdateRow

Updates the destination row.

Summary of Methods in IConnectionInfo

Method

Description

GetApplicationName

Returns the name of the application using the connection.

GetBcpBatchSize

Returns a value that indicates the setting of the batch size of commit.

GetCatalog

Returns the name of the catalog.

GetCodePage

Returns the current CodePage setting for theserver.

GetComparisonStyle

Returns a value that indicates theSQL collation.

GetConnectName

Returns the connection name.

GetDatabase

Returns the database name.

GetDatabaseStatus

Returns the database status.

GetDatasource

Returns the data source name.

GetDatasourcePath

Returns the path to the .mdb file.

GetDataSourceType

Returns the type of data source.

GetDBCreatedThisSession

Returns a value that indicates whether or not the database has been created in this session.

GetHostName

Returns the host name being used in the IConnectionInfo object.

GetInternetAddress

Returns the Internet address.

GetInternetNetwork

Returns the NetLibrary to use when connecting.

GetLCID

Returns the preferred locale ID value.

GetLogin

Returns into Login the login currently in use if usingSQLServer Authentication. If using Windows Authentication, the value returned to the Login parameter is an empty string.

GetLoginTimeout

Returns the number of seconds the system will wait before returning from a failed login attempt.

GetMajorVersion

Returns the product major version number.

GetMinorVersion

Returns the product minor version number.

GetPacketSize

Returns the packet size, in bytes.

GetPassword

Returns the current IConnectionInfo object password.

GetProviderName

Returns the OLE DB provider name.

GetProviderString

Returns the OLE DB property provider string.

GetQueryTimeout

Returns the number of seconds of the time-out value for queries against aserver.

GetSecurityMode

Returns the security mode being employed to connect toSQLServer by the Windows user or group of users.

GetServerName

Returns the server name.

GetServerRole

Returns a string that indicates whether theserver role is as a Subscriber, Distributor, or Publisher.

GetUseInprocLoader

Returns a value indicating whether or not the agent is using inproc loader (BULK INSERT statement) to load the data from bcp files into tables.

To Register a Merge Replication Custom Conflict Resolver

In Visual Basic, go to the File menu and click Make <yourproject>.DLL. This will compile and register the application on the current computer. If the .DLL needs to be registered on a different computer, runREGSVR32 <yourproject>.DLL from the command prompt. The .DLL must be registered on the computer that is invoking the merge agent. If you are using this application with a push subscription, the resolver must be registered at the Distributor that is invoking the merge agent. Similarly, for pull subscriptions, the resolver must be registered at the Subscriber that is invoking the merge agent. To ensure the resolver is registered properly, runsp_enumcustomresolvers on the computer on which it is registered. If the application name is returned in the result set, it is registered properly.

Registering Custom Resolvers on a Cluster

When using custom conflict resolvers with merge replication on a failover cluster, register the custom resolver on all nodes of the failover cluster. This ensures the custom resolver will be able to load the resolver properly after a failover. Merge replication conflict resolvers that come with SQLServer are automatically registered.

Merge Replication Custom Conflict Resolver Samples

The Merge Replication Custom Conflict Resolver (SampleResolver) sample is available on theSQLServer 2000 Resource Kit CD-ROM in the folder, \ToolsAndSamples\SampleResolver. The samples demonstrate the implementation of theSQL Replication Conflict Resolver Library in merge replication custom conflict resolver applications. Samples included are:

  • Additive Resolver

  • Minimum Resolver

The samples contain a SQL Script that will register the custom conflict resolvers.

Thanks,



Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>