Sync Inspector Tool - Inspecting Client DB state for pending Changes

Its been a while since I got a chance to post. I've been knee deep in developer mode - fun fun. A lot of work has been around Ado.Net Sync Services v2.

One of the issues I face during debugging Sync issues is analysis of the SQL Server CE database state. So ! Here's Inspector Synk to help me around with getting a little insight into the database state.

Just select the sdf file, and the Inspector will give you some basic (very basic) information about the tables and their pending changes status. I would imagine this could be useful in a production scenario to analyze changes left over on the client that need to be sent to the server. I have a bunch of ideas on enhancing this - Maybe over the weekend.

 

Some of the code might be of interest to people digging into the internals of change tracking in SSCE 3.5 with Sync Service.

__sysSyncArticles : internal tables that keeps a list of tables being tracked for changes along with each table's sync (excuse the resolution)

THE QUERY - to retrieve if table has pending changes or not. Its a little tedious to go into the details, but the most important part is the @LCSN which is the watermark for the last received anchor.

select count(*) from {0} Tbl where (((Tbl.__sysInsertTxBsn IS NOT NULL) AND ((Tbl.__sysInsertTxBsn NOT IN
(SELECT __systxbsn
FROM __systxcommitsequence)

AND Tbl.__sysInsertTxBsn > @LCSN) OR (exists
(SELECT __systxbsn
FROM __systxcommitsequence
WHERE tbl.__sysinserttxbsn = __systxbsn
AND __systxcsn > @LCSN)

)))
OR
((Tbl.__sysChangeTxBsn IS NOT NULL) AND ((Tbl.__sysChangeTxBsn NOT IN
(SELECT __systxbsn
FROM __systxcommitsequence)

AND Tbl.__sysChangeTxBsn > @LCSN) OR (exists
(SELECT __systxbsn
FROM __systxcommitsequence
WHERE tbl.__syschangetxbsn = __systxbsn
AND __systxcsn > @LCSN)

))))

There are the basis of Inspector Synk (yes - i insist on calling it that :-) )

 

 

hope this helps you happy syncers. Code Attached. Watch out for updates

InspectorSynk.zip