Welcome! Log In Create A New Profile

Advanced

Online Offline

Posted by Carlo Hermus 
Carlo Hermus
Online Offline
March 21, 2008 01:30AM
Hi all,

I have a question. I have an application connected to a MySQL server and I want to generate a synchronisation offline (HF classic).

Without giving the end user the replication software how can I procede to program a button synchronize that will do this for the enduser. If possible I don't want to use the replication program command line based.

Is it possible to program this within WinDev?

Regards,
Carlo
Fabrice Harari
Re: Online Offline
March 21, 2008 11:02AM
Hi Carlo...

of course it's possible :-)

Look in the help at 'Replica' and 'Replication'...

Basically:
- you first have to setup your DB for replication (needs journalisation, unique keys, uniques subset of keys for each DB,etc)
- Then you 'declare' your secondary DB
- Finally, when clicking the button, you create the transportable replica file for the client DB

Best regards

Fabrice Harari
WinDev, WebDev, WinDev Mobile Video Courses
Carlo Hermus
Re: Online Offline
April 05, 2008 03:56PM
Fabrice,

I tried severall times, but I cannot make it work. Do you have a example, I know there is a email replication example. But I like to do it directly to the (My)SQL/HF c/s server and to the HF classic files.

Cheers,

Carlo
Peter H.
Re: Online Offline
April 05, 2008 06:28PM
Hi,

WX XII has a new replication wizard that allows teh setup and execution of heterogeneous replication without almost any coding. Maybe you can await this?

Cheers,

Peter H.
Carlo Hermus
Re: Online Offline
April 06, 2008 04:00PM
Well,

I actually can not wait.

But here is my button code, can someone tell me what I am doing wrong?

HFCSConnection is Connection

HFCSConnection..User = "Admin"
HFCSConnection..Password = ""
HFCSConnection..Server = "127.0.0.1" 
HFCSConnection..Database = "STS"
HFCSConnection..Provider = hAccessHFClientServer
HFCSConnection..Access = hOReadWrite
HFCSConnection..ExtendedInfo = "Extended Information"
HFCSConnection..CursorOptions = hClientCursor

HFCLConnection is Connection

HFCLConnection..Provider = hAccessHF7

ResultRepl is boolean
nResultSub is int
SyncDateTime is DateTime = Today()+Now()

HOpenConnection(HFCSConnection)
HChangeConnection("*",HFCSConnection)
HChangeDir("*",".")
ResultRepl=HCreateMasterReplica(fTempPath()+"STS\Master")

HChangeConnection("*",HFCLConnection)
HChangeDir("*",STSDirectory)
nResultSub=HCreateSubscriberReplica(fTempPath()+"STS\Master",fTempPath()+"STS\Subscribe",SyncDateTime,1)
ResultRepl = HSynchronizeReplica(fTempPath()+"STS\Master",fTempPath()+"STS\"+SyncDateTime+"\"+gpwGetUserInfo(gpwInfoLogin)+".STS", rplBidirectional,rplMasterFirst)
Merijn
Re: Online Offline
April 06, 2008 10:09PM
Carlo, Just a thought...You could also write your own replication scheme:
1. Create 3 tables: UpdCounter, UpdTable, UpdColumn
2. With every HAdd, HModify, HDelete:
- Add 1 record to UpdTable: tablename, updtype (add, mod,del), updnum
- add: Add x records to UpdColumn for every field with fieldname, value, updnum
- mod: Add x records to UpdColumn for every changed field the fieldname, value, updnum
- del: Add 1 record to UpdColumn for a unique field the fieldname, value, updnum
- Increment the MasterCounter to updnum
3. Every Client maintains also a record inside UpdCounter
4. Construct an INSERT, UPDATE or DELETE SQL statement from UpdTable and UpdColumn if a new update is detected
5. The client with the lowest updatenumber deletes old update information inside tables: UpdTable and UpdColumn.

HTH
Carlo Hermus
Re: Online Offline
April 07, 2008 01:10AM
Merijn,

Thank you. This will be helpful for the future. I see the posibilities but also the problems and lost of work it has stored into it. I will use this, but within a week I need the replication ( I think my code has to be adjusted just a bit I think). I am only a partime programmer and cannot afford this kind of work now, but I will try it in the next release.

Thanks,

Anyone like to comment my previous code?
Peter H.
Re: Online Offline
April 07, 2008 08:03PM
If you know French you might have a look to these WinDev 9 video's providing an example on how to set up an heterogeneous replication scheme:
PART 1: [www.pcsoft-windev-webdev.com]
PART2: [www.pcsoft-windev-webdev.com]

Cheers,

Peter
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: