dbTalk Databases Forums  

How resolve this problem (long)

sybase.public.sqlanywhere.mobilink sybase.public.sqlanywhere.mobilink


Discuss How resolve this problem (long) in the sybase.public.sqlanywhere.mobilink forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fantom
 
Posts: n/a

Default How resolve this problem (long) - 07-06-2006 , 06:29 AM






i write this second time. I now how works scripts etc in mobilink. But i
dont know method (not code - only logic) how resolve this problem

How resolve this type of conflict :
group of rows in more than one table is "one integrity data". For example :
1) Table Document (with columns "ID_doc"-primary key and "counthistory")
2) Table History (with column "ID_doc"-foreign key, "ID_Article","quantity")

In all databases (consolidated and remotes) exists records :
Document :
Id_doc = 1, counthistory = 3
History :
ID_Doc = 1, ID_Article = 1, quantity = 5
ID_Doc = 1, ID_Article = 2, quantity = 5
ID_Doc = 1, ID_Article = 3, quantity = 5

And two user modify this document on remote.
First user
- delete second and third row
- adding "1" to first row
Second user
-delete first row
-change quantity where id_article = 2 (adding 1).
When i dont want resolve conflict, after two synch in consolidate database i
get :

After first synch :
Document :
Id_doc = 1, counthistory = 1
History :
ID_Doc = 1, ID_Article = 1, quantity = 6
ID_Doc = 1, ID_Article = 2, quantity = 5 (active = 0)
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0)

After second synch :
Document :
Id_doc = 1, counthistory = 2
History :
ID_Doc = 1, ID_Article = 1, quantity = 6 (active = 0)
ID_Doc = 1, ID_Article = 2, quantity = 6 (active = 0)
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0)

This documnet is bad ! Counthistory = 2 but in history is not record. This
documnet not this same is in first or second user. How resolve this type of
conflict. I want that this document this same (not mix) who want second user
(or
first user).


First example : when i want that second user is priorytet and his document
is ok :
- I now how resolve problem in table document - i delete record from
consolidate and insert new
- i write new record from remote and set active = 0 to first row
- i write second record from remote (old from consolidated i deleted)

After this operation i get :
Document :
Id_doc = 1, counthistory = 2 - its ok
History :
ID_Doc = 1, ID_Article = 1, quantity = 5 (active = 0) - its ok
ID_Doc = 1, ID_Article = 2, quantity = 6 (active = 1) - its ok
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0) - this is not ok

How i may resolve this last problem ? First user 'deleted' this record, but
second user is not deleted this record and its must active after synch. How
method i must use that i know that i must set active = 1 to this tye of
record ?


Fantom


Reply With Quote
  #2  
Old   
Reg Domaratzki \(iAnywhere Solutions\)
 
Posts: n/a

Default Re: How resolve this problem (long) - 07-06-2006 , 07:57 AM






Your example where counthistory is incorrect after a conflict occurs is
covered with a sample in the documentation when explaining how conflict
resolution is handled in the Contact sample.

MobiLink Tutorials
The Contact Sample Application
Synchronization
Synchronizing products in the Contact sample

Although the schema is obviously different, it shows how conflict resolution
works in an example where two salesmen are both updating the number of
products available from two database. I believe the same technique can be
used on the counthistory column of the document table in your example (and
the quantity table in the history table as well if you want).

--
Reg Domaratzki, Sybase iAnywhere Solutions
Sybase Certified Professional - Sybase ASA Developer Version 8
Please reply only to the newsgroup

iAnywhere Developer Community : http://www.ianywhere.com/developer
iAnywhere Documentation : http://www.ianywhere.com/developer/product_manuals
ASA Patches and EBFs : http://downloads.sybase.com/swd/base.do
-> Choose SQL Anywhere Studio
-> Set filter to "Display ALL platforms IN ALL MONTHS"


"Fantom" <szczukot (AT) skasujto (DOT) poczta.onet.pl> wrote

Quote:
i write this second time. I now how works scripts etc in mobilink. But i
dont know method (not code - only logic) how resolve this problem

How resolve this type of conflict :
group of rows in more than one table is "one integrity data". For example
:
1) Table Document (with columns "ID_doc"-primary key and "counthistory")
2) Table History (with column "ID_doc"-foreign key,
"ID_Article","quantity")

In all databases (consolidated and remotes) exists records :
Document :
Id_doc = 1, counthistory = 3
History :
ID_Doc = 1, ID_Article = 1, quantity = 5
ID_Doc = 1, ID_Article = 2, quantity = 5
ID_Doc = 1, ID_Article = 3, quantity = 5

And two user modify this document on remote.
First user
- delete second and third row
- adding "1" to first row
Second user
-delete first row
-change quantity where id_article = 2 (adding 1).
When i dont want resolve conflict, after two synch in consolidate database
i
get :

After first synch :
Document :
Id_doc = 1, counthistory = 1
History :
ID_Doc = 1, ID_Article = 1, quantity = 6
ID_Doc = 1, ID_Article = 2, quantity = 5 (active = 0)
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0)

After second synch :
Document :
Id_doc = 1, counthistory = 2
History :
ID_Doc = 1, ID_Article = 1, quantity = 6 (active = 0)
ID_Doc = 1, ID_Article = 2, quantity = 6 (active = 0)
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0)

This documnet is bad ! Counthistory = 2 but in history is not record. This
documnet not this same is in first or second user. How resolve this type
of
conflict. I want that this document this same (not mix) who want second
user
(or
first user).


First example : when i want that second user is priorytet and his document
is ok :
- I now how resolve problem in table document - i delete record from
consolidate and insert new
- i write new record from remote and set active = 0 to first row
- i write second record from remote (old from consolidated i deleted)

After this operation i get :
Document :
Id_doc = 1, counthistory = 2 - its ok
History :
ID_Doc = 1, ID_Article = 1, quantity = 5 (active = 0) - its ok
ID_Doc = 1, ID_Article = 2, quantity = 6 (active = 1) - its ok
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0) - this is not ok

How i may resolve this last problem ? First user 'deleted' this record,
but
second user is not deleted this record and its must active after synch.
How
method i must use that i know that i must set active = 1 to this tye of
record ?


Fantom




Reply With Quote
  #3  
Old   
David Fishburn
 
Posts: n/a

Default Re: How resolve this problem (long) - 07-06-2006 , 08:08 AM



"Fantom" <szczukot (AT) skasujto (DOT) poczta.onet.pl> wrote in
news:44acf2b6$1@forums-2-dub of sybase.public.sqlanywhere.mobilink:

Before we answer can you:

1. Show us the result you want in the tables when all remotes have
finished resolution.
2. Show us the results you are currently getting.
3. Show us what what conflict resolution scripts you have written so
far, that give you the results you are seeing.
4. Below you mention what user 1 does, and what user 2 does. Can you
actually show the changes instead of saying them, it will help us
visualize it better.
5. Show us the state of the consolidated after EACH remote database
synchronizes. Indicate whether the end result is GOOD or BAD. If
bad tell us why it is bad and what you wanted. Again, do this
visually like you have done for other comments:
Quote:
Document :
Id_doc = 1, counthistory = 1
History :
ID_Doc = 1, ID_Article = 1, quantity = 6
ID_Doc = 1, ID_Article = 2, quantity = 5 (active = 0)
ID_Doc = 1, ID_Article = 3, quantity = 5 (active = 0)
--
David Fishburn
Certified ASA Developer Version 8
iAnywhere Solutions - Sybase
Professional Services
Please only post to the newsgroup
Please ALWAYS include version and MORE importantly BUILD number with
EACH post (dbeng9 -v).

EBFs and Maintenance Releases
http://downloads.sybase.com/

Developer Community / Whitepapers
http://www.ianywhere.com/developer

CaseXpress - to report bugs
http://casexpress.sybase.com

CodeXchange - Free samples
http://ianywhere.codexchange.sybase....ctDocumentList



Reply With Quote
  #4  
Old   
Fantom
 
Posts: n/a

Default Re: How resolve this problem (long) - 07-07-2006 , 06:08 AM



Quote:
Your example where counthistory is incorrect after a conflict occurs is
covered with a sample in the documentation when explaining how conflict
resolution is handled in the Contact sample.

MobiLink Tutorials
The Contact Sample Application
Synchronization
Synchronizing products in the Contact sample

Although the schema is obviously different, it shows how conflict
resolution
works in an example where two salesmen are both updating the number of
products available from two database. I believe the same technique can be
used on the counthistory column of the document table in your example (and
the quantity table in the history table as well if you want).
I see this example before i write first post. This method is not resolve my
problem. I dont want, that data in database is 'mixed' from users. I want
that this data is all get from one user. And from another users is removed -
replaced new 'group of data'

Fantom



Reply With Quote
  #5  
Old   
Usmanov A.
 
Posts: n/a

Default Re: How resolve this problem (long) - 07-20-2006 , 04:11 AM



If you want "that this data is all get from one user" there is one method:
You must produce Resolve_conflict event for EACH record in changed document
(both header and details), then you can write handle-procedure which right
update this doc (write/decline one/all records - how do you want).
Now this problems happened only for rows changed by second user. Second user
know nothing about first user's work. Cause in upload stream will no
recordrs modified only by first user, and resolve conflict event not
happens. If you'd force update all of document records (header too), then
you'd can solve what record is correct in resolve_conflict handler. This
will grow upload stream-size, but help you get right records.

--
Sincerely yours,
Alex Usmanov
(ASA 9.0.2.3131, MW CW 9.2)
"Fantom" <szczukot (AT) skasujto (DOT) poczta.onet.pl> ???????/???????? ? ????????
?????????: news:44ae40b4$1 (AT) forums-1-dub (DOT) ..
Quote:
Your example where counthistory is incorrect after a conflict occurs is
covered with a sample in the documentation when explaining how conflict
resolution is handled in the Contact sample.

MobiLink Tutorials
The Contact Sample Application
Synchronization
Synchronizing products in the Contact sample

Although the schema is obviously different, it shows how conflict
resolution
works in an example where two salesmen are both updating the number of
products available from two database. I believe the same technique can
be
used on the counthistory column of the document table in your example
(and
the quantity table in the history table as well if you want).

I see this example before i write first post. This method is not resolve
my
problem. I dont want, that data in database is 'mixed' from users. I want
that this data is all get from one user. And from another users is
removed -
replaced new 'group of data'

Fantom




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.