MobiLink Synchronization Wizard in SQL Anywhere 10 - Specifying names for Publication and Script version
(Page 6 of 8 )
This brings you to the window where you make choices regarding publication and script version. The remote tables that are going to be synchronized are grouped into a publication and the synchronization logic will be assigned a script version. The script version tracks the different synchronization logic you might create in your application for a specific publication. Both of these require names by which they can be called. These can use defaults generated by the wizard as shown. An optional description may also be added as shown in the following picture.

When you click on the Next button on the above window you will be presented with the following window. At this stage the MobiLink synchronization model Test10Sync is defined. This model may be deployed as is, or it is possible to make further changes. For this tutorial click on the Finish button as it is intended to be deployed as is. An XML file Test10Sync.mslm will be created in the chosen directory containing the details of the model.

Review of Test10Sync.mlsm file
The XML content of the file generated by the model shown in the next listing:
Listing 1: /><?xml version='1.0' encoding='UTF-8'?><sync-model filespec-version="1" version-major="10" version-minor="0" version-patch="0" version-build="2465" name="Test10Sync" description="Synchronization Model for Customers10 table in the MS SQL Server 2005's Test10 Database" script-version="Test10Sync" publication="Test10Sync"><auth-settings enabled="false" type="pop3" /><remote factory="sa"><schema><table name="Customers10" owner="dbo" catalog="Test10" type="table"><column name="CustomerID" isprimarykey="true" nullable="false" ordinal="1" category="string" jdbc="nchar" typename="nchar" length="5" /><column name="CompanyName" isprimarykey="false" nullable="false" ordinal="2" category="string" jdbc="nvarchar" typename="nvarchar" length="40" /><column name="ContactName" isprimarykey="false" nullable="true" ordinal="3" category="string" jdbc="nvarchar" typename="nvarchar" length="30" /><column name="ContactTitle" isprimarykey="false" nullable="true" ordinal="4" category="string" jdbc="nvarchar" typename="nvarchar" length="30" /><column name="Address" isprimarykey="false" nullable="true" ordinal="5" category="string" jdbc="nvarchar" typename="nvarchar" length="60" /><column name="City" isprimarykey="false" nullable="true" ordinal="6" category="string" jdbc="nvarchar" typename="nvarchar" length="15" /><column name="Region" isprimarykey="false" nullable="true" ordinal="7" category="string" jdbc="nvarchar" typename="nvarchar" length="15" /><column name="PostalCode" isprimarykey="false" nullable="true" ordinal="8" category="string" jdbc="nvarchar" typename="nvarchar" length="10" /><column name="Country" isprimarykey="false" nullable="true" ordinal="9" category="string" jdbc="nvarchar" typename="nvarchar" length="15" /><column name="Phone" isprimarykey="false" nullable="true" ordinal="10" category="string" jdbc="nvarchar" typename="nvarchar" length="24" /><column name="Fax" isprimarykey="false" nullable="true" ordinal="11" category="string" jdbc="nvarchar" typename="nvarchar" length="24" /></table></schema></remote><consolidated factory="mss"><schema name="consolidatedSchema"><table name="Customers10" owner="dbo" catalog="Test10" type="table"><column name="CustomerID" isprimarykey="true" nullable="false" ordinal="1" category="string" jdbc="nchar" typename="nchar" length="5" /><column name="CompanyName" isprimarykey="false" nullable="false" ordinal="2" category="string" jdbc="nvarchar" typename="nvarchar" length="40" /><column name="ContactName" isprimarykey="false" nullable="true" ordinal="3" category="string" jdbc="nvarchar" typename="nvarchar" length="30" /><column name="ContactTitle" isprimarykey="false" nullable="true" ordinal="4" category="string" jdbc="nvarchar" typename="nvarchar" length="30" /><column name="Address" isprimarykey="false" nullable="true" ordinal="5" category="string" jdbc="nvarchar" typename="nvarchar" length="60" /><column name="City" isprimarykey="false" nullable="true" ordinal="6" category="string" jdbc="nvarchar" typename="nvarchar" length="15" /><column name="Region" isprimarykey="false" nullable="true" ordinal="7" category="string" jdbc="nvarchar" typename="nvarchar" length="15" /><column name="PostalCode" isprimarykey="false" nullable="true" ordinal="8" category="string" jdbc="nvarchar" typename="nvarchar" length="10" /><column name="Country" isprimarykey="false" nullable="true" ordinal="9" category="string" jdbc="nvarchar" typename="nvarchar" length="15" /><column name="Phone" isprimarykey="false" nullable="true" ordinal="10" category="string" jdbc="nvarchar" typename="nvarchar" length="24" /><column name="Fax" isprimarykey="false" nullable="true" ordinal="11" category="string" jdbc="nvarchar" typename="nvarchar" length="24" /><column name="last_modified" isprimarykey="false" nullable="false" ordinal="12" category="other" jdbc="datetime" typename="datetime" /></table></schema></consolidated><notifier-settings enabled="false" isolation-level="0" poll-interval="5m" /><sync-settings conflict-detection="none" conflict-id-column="process_id" conflict-resolution="consolidated" conflict-resolution-new-table="[table]_new" conflict-resolution-old-table="[table]_old" delete-column="deleted" deleted-value="Y" delete-mode="shadow" delete-table-pattern="[table]_del" delete-timestamp-column="last_modified" delete-insert-trigger-pattern="[table]_ins" delete-delete-trigger-pattern="[table]_del" download-deletes="true" download-index-pattern="[table]_ml" download-subset="none" download-timestamp-column="last_modified" download-timestamp-from-shadow-table="false" download-timestamp-table-pattern="[table]_mod" download-timestamp-trigger-pattern-del="[table]_del" download-timestamp-trigger-pattern-ins="[table]_ins" download-timestamp-trigger-pattern-upd="[table]_upd" download-type="timestamp" merge-existing-triggers="false" merge-generated-triggers="true" non-deleted-value="N" remote-ds-join="false" remote-ds-non-join-column="sync_remote" user-ds-join="false" user-ds-non-join-column="sync_user" /><table-mappings><table-mapping remote="Test10.dbo.Customers10" consolidated="Test10.dbo.Customers10" direction="both"><sync-settings conflict-detection="none" conflict-id-column="process_id" conflict-resolution="consolidated" conflict-resolution-new-table="[table]_new" conflict-resolution-old-table="[table]_old" delete-column="deleted" deleted-value="Y" delete-mode="shadow" delete-table-pattern="[table]_del" delete-timestamp-column="last_modified" delete-insert-trigger-pattern="[table]_ins" delete-delete-trigger-pattern="[table]_del" download-deletes="true" download-index-pattern="[table]_ml" download-subset="none" download-timestamp-column="last_modified" download-timestamp-from-shadow-table="false" download-timestamp-table-pattern="[table]_mod" download-timestamp-trigger-pattern-del="[table]_del" download-timestamp-trigger-pattern-ins="[table]_ins" download-timestamp-trigger-pattern-upd="[table]_upd" download-type="timestamp" merge-existing-triggers="false" merge-generated-triggers="true" non-deleted-value="N" remote-ds-join="false" remote-ds-non-join-column="sync_remote" user-ds-join="false" user-ds-non-join-column="sync_user" /><column-mapping remote="CustomerID" consolidated="CustomerID" /><column-mapping remote="CompanyName" consolidated="CompanyName" /><column-mapping remote="ContactName" consolidated="ContactName" /><column-mapping remote="ContactTitle" consolidated="ContactTitle" /><column-mapping remote="Address" consolidated="Address" /><column-mapping remote="City" consolidated="City" /><column-mapping remote="Region" consolidated="Region" /><column-mapping remote="PostalCode" consolidated="PostalCode" /><column-mapping remote="Country" consolidated="Country" /><column-mapping remote="Phone" consolidated="Phone" /><column-mapping remote="Fax" consolidated="Fax" /></table-mapping></table-mappings><events template-checksum="1289762775"><connection-event id="begin_connection"><generated-script type="SQL" error="false">SET NOCOUNT ON </generated-script></connection-event><connection-event id="authenticate_user" /><connection-event id="end_publication" /><table-event id="download_cursor" table="Test10.dbo.Customers10"><generated-script type="SQL" error="false">SELECT "dbo"."Customers10"."CustomerID", "dbo"."Customers10"."CompanyName", "dbo"."Customers10"."ContactName", "dbo"."Customers10"."ContactTitle", "dbo"."Customers10"."Address", "dbo"."Customers10"."City", "dbo"."Customers10"."Region", "dbo"."Customers10"."PostalCode", "dbo"."Customers10"."Country", "dbo"."Customers10"."Phone", "dbo"."Customers10"."Fax" FROM "dbo"."Customers10" WHERE "dbo"."Customers10"."last_modified" >= {ml s.last_table_download} </generated-script></table-event><table-event id="upload_insert" table="Test10.dbo.Customers10"><generated-script type="SQL" error="false">/* Insert the row into the consolidated database. */ INSERT INTO "dbo"."Customers10" ( "CustomerID", "CompanyName", "ContactName", "ContactTitle", "Address", "City", "Region", "PostalCode", "Country", "Phone", "Fax" ) VALUES ( {ml r."CustomerID"}, {ml r."CompanyName"}, {ml r."ContactName"}, {ml r."ContactTitle"}, {ml r."Address"}, {ml r."City"}, {ml r."Region"}, {ml r."PostalCode"}, {ml r."Country"}, {ml r."Phone"}, {ml r."Fax"} ) </generated-script></table-event><table-event id="upload_delete" table="Test10.dbo.Customers10"><generated-script type="SQL" error="false">/* Delete the row from the consolidated database. */ DELETE FROM "dbo"."Customers10" WHERE "CustomerID" = {ml r."CustomerID"} </generated-script></table-event><table-event id="upload_update" table="Test10.dbo.Customers10"><generated-script type="SQL" error="false">/* Update the row in the consolidated database. */ UPDATE "dbo"."Customers10" SET "CompanyName" = {ml r."CompanyName"}, "ContactName" = {ml r."ContactName"}, "ContactTitle" = {ml r."ContactTitle"}, "Address" = {ml r."Address"}, "City" = {ml r."City"}, "Region" = {ml r."Region"}, "PostalCode" = {ml r."PostalCode"}, "Country" = {ml r."Country"}, "Phone" = {ml r."Phone"}, "Fax" = {ml r."Fax"} WHERE "CustomerID" = {ml r."CustomerID"} </generated-script></table-event><table-event id="upload_fetch_column_conflict" table="Test10.dbo.Customers10" /><table-event id="upload_old_row_insert" table="Test10.dbo.Customers10" /><table-event id="download_delete_cursor" table="Test10.dbo.Customers10"><generated-script type="SQL" error="false">SELECT "Customers10_del"."CustomerID" FROM "Customers10_del" WHERE "Customers10_del"."last_modified" >= {ml s.last_table_download} </generated-script></table-event><table-event id="upload_fetch" table="Test10.dbo.Customers10" /><table-event id="upload_new_row_insert" table="Test10.dbo.Customers10" /><table-event id="resolve_conflict" table="Test10.dbo.Customers10" /></events><consolidated-connection-info><connection-info classname="com.sybase.asa.logon.GenericConnectionInfo" data="UID=sa;DSN=Dev10" /></consolidated-connection-info></sync-model>
Next: Fine tuning the model using the Sybase Central Management Interface >>
More Database Code Articles
More By Jayaram Krishnaswamy