[sqlite] Database sybchronisation

2015-08-13 Thread Jean-Christophe Deschamps
simon, >This is normally resolved by logging the time each command was issued Not "when it was issued" but when exactly it was finally commited. When one or more update statements are part of a transcation, you now have to use sqlite3_profile to log when exactly the transaction ended (i.e.

[sqlite] Database sybchronisation

2015-08-13 Thread Simon Slavin
On 13 Aug 2015, at 5:28pm, Tim Streater wrote: > Presumably all the OP needs to do (in the future, at any rate) is: > > open first db > attach second db > start transaction > do updates to first db; > do identical updates to second db > commit transaction > close connection > > or some

[sqlite] Database sybchronisation

2015-08-13 Thread Rob Willett
Simon, Your example is a very simple, yet elegant example of why database synchronisation is a ?difficult? problem to solve. As you say at the bottom of your e-mail, for the database to be correct, it has to determine the intentions of two sets of users to work out the solution. Even if

[sqlite] Database sybchronisation

2015-08-13 Thread Tim Streater
On 13 Aug 2015 at 16:20, Simon Slavin wrote: > On 13 Aug 2015, at 4:03pm, sqlite-mail wrote: > >> With that would be trivial to log the statements that change the database to >> replicate elsewhere. > > As Jean-Christophe wrote, it's not that simple. There are huge books written > on the

[sqlite] Database sybchronisation

2015-08-13 Thread sqlite-mail
Hello ! ? This request is a common requirement and in my opinion would be better solved by an extension to the actual sqlite3 api functions. ? Actually there is sqlite3_trace that can be used to watch all sql statements executed on a given session. ? One possible way would be to

[sqlite] Database sybchronisation

2015-08-13 Thread Simon Slavin
On 13 Aug 2015, at 4:03pm, sqlite-mail wrote: > With that would be trivial to log the statements that change the database to > replicate elsewhere. As Jean-Christophe wrote, it's not that simple. There are huge books written on the problems involved in synchronising two copies of a

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
Thanks TIm On 13 August 2015 at 15:31, Tim Streater wrote: > On 13 Aug 2015 at 11:34, Chris Parsonson wrote: > > > Has anybody ever used this ATTTACH command? > > Here's what I do to move a row from one database to another (same > table/column defs). I have to go via a temporary db (I use the

[sqlite] Database sybchronisation

2015-08-13 Thread Tim Streater
On 13 Aug 2015 at 11:34, Chris Parsonson wrote: > Has anybody ever used this ATTTACH command? Here's what I do to move a row from one database to another (same table/column defs). I have to go via a temporary db (I use the :memory: one) since the primary key needs a new value in the second

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
Has anybody ever used this ATTTACH command? Still doesn't work Dim dbConnection As New SQLiteConnection Dim dbDataSet As New DataSet Dim SQLStmt As String Dim sDBPath As String = Application.StartupPath & "\wolfpro.db3" Dim sUpdateDBPath As String =

[sqlite] Database sybchronisation

2015-08-13 Thread Jean-Christophe Deschamps
Hi Simon, >Method 2 > > >Ignore Method 1. In each copy of your database keep a log of all >INSERT and UPDATE commands executed since the last 'synchronize': > >CREATE TABLE commandsSinceLastSynch (theCommand TEXT) > >To synchronise the two copies, play back the log for copy A to copy B

[sqlite] Database sybchronisation

2015-08-13 Thread Simon Slavin
On 13 Aug 2015, at 11:34am, Chris Parsonson wrote: > Has anybody ever used this ATTTACH command? > Still doesn't work The code shown does not read the row back again once it is written. What makes you think your new row is not being stored ? What does it do when it doesn't work ?

[sqlite] Database sybchronisation

2015-08-13 Thread Dominique Devienne
On Thu, Aug 13, 2015 at 11:12 AM, wrote: > On Thu Aug 13, 2015 at 10:06:44AM +0200, Dominique Devienne wrote: > > The new RBU [1] extension, coupled with the new sqldiff utility, might > be of interest too.--DD > > Is there a table of contents or index of SQLite extensions somewhere on > the

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
In fact I found the database in the Documents folder. "C:\Users\Chris\Documents\UpdateWolfpro.db3" but it made no difference. But the ATTACH gives no error in either my first attempt or this second one. On 13 August 2015 at 10:45, R.Smith wrote: > > > On 2015-08-13 10:26 AM, Chris Parsonson

[sqlite] Database sybchronisation

2015-08-13 Thread no...@null.net
On Thu Aug 13, 2015 at 10:06:44AM +0200, Dominique Devienne wrote: > > The new RBU [1] extension, coupled with the new sqldiff utility, > might be of interest too.--DD > > [1] http://www.sqlite.org/rbu.html Is there a table of contents or index of SQLite extensions somewhere on the main

[sqlite] Database sybchronisation

2015-08-13 Thread Simon Slavin
On 13 Aug 2015, at 10:16am, Chris Parsonson wrote: > the ATTACH gives no error in either my first > attempt or this second one. Then it's probably working. >SQLStmt = "ATTACH '" & sUpdateDBPath & "' AS UPD;" So after you've done that, write some code to insert a new row into a

[sqlite] Database sybchronisation

2015-08-13 Thread Kevin Benson
On Thu, Aug 13, 2015 at 4:05 AM, Chris Parsonson wrote: > So can someone give me a working example of two database ATTACHed and a > simple select using columns from a table in each database C:\SQLite3>sqlite3 C:\SQLite3\UpdateWolfpro.db3 SQLite version 3.8.11.1 2015-07-29 20:00:57 Enter

[sqlite] Database sybchronisation

2015-08-13 Thread R.Smith
On 2015-08-13 10:26 AM, Chris Parsonson wrote: > OK here's my code which is just test code, not intended to do anything > useful. It runs without error, but the DELETE just doesn't do anything > Dim dbConnection As New SQLiteConnection > Dim dbDataSet As New DataSet >

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
OK here's my code which is just test code, not intended to do anything useful. It runs without error, but the DELETE just doesn't do anything Dim dbConnection As New SQLiteConnection Dim dbDataSet As New DataSet Dim SQLStmt As String Dim sDBPath As String =

[sqlite] Database sybchronisation

2015-08-13 Thread Tim Streater
On 13 Aug 2015 at 09:05, Chris Parsonson wrote: > So can someone give me a working example of two database ATTACHed and a > simple select using columns from a table in each database Why not try the sequence you want using the sqlite3 CLI program, on a simple example that mimics the essence of

[sqlite] Database sybchronisation

2015-08-13 Thread R.Smith
To Attach a second Database is fairly straightforward and shouldn't fail unless there is a physical problem with either of the files. The Attach command example is like this (on a WinX machine): ATTACH DATABASE 'C:\Documents\OtherDatabase.db' AS "DB2"; Execute that as a standard SQL statement.

[sqlite] Database sybchronisation

2015-08-13 Thread Dominique Devienne
On Thu, Aug 13, 2015 at 4:52 AM, Chris Parsonson wrote: > I need to be able to synchronise some fairly simple table in two databases. > Can someone help please > The new RBU [1] extension, coupled with the new sqldiff utility, might be of interest too.--DD [1] http://www.sqlite.org/rbu.html

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
So can someone give me a working example of two database ATTACHed and a simple select using columns from a table in each database On 13 August 2015 at 07:13, Chris Parsonson wrote: > Now we get down to the first real problem that of the ATTACH. I have never > been able to get that to work. If I

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
Now we get down to the first real problem that of the ATTACH. I have never been able to get that to work. If I could have got the ATTACH to work I probably would never have had to ask the synchronisation question. Although I have never had to do it before in SQLite, I have worked a lot with SQL

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
The tables are very simple. They have a primary key, but no relationship between tables in the sense that you mean. Synchronisation will be add new rows, and update some rows, no deletions On 13 August 2015 at 05:53, Simon Slavin wrote: > > On 13 Aug 2015, at 3:52am, Chris Parsonson wrote: > >

[sqlite] Database sybchronisation

2015-08-13 Thread Simon Slavin
On 13 Aug 2015, at 5:55am, Chris Parsonson wrote: > The tables are very simple. They have a primary key, but no relationship > between tables in the sense that you mean. Synchronisation will be add new > rows, and update some rows, no deletions To access two different databases with one

[sqlite] Database sybchronisation

2015-08-13 Thread Simon Slavin
On 13 Aug 2015, at 3:52am, Chris Parsonson wrote: > I need to be able to synchronise some fairly simple table in two databases. Are both copies of a table being changed between synchronisations ? Are the changes just the adding of new rows, or do you sometimes delete or update rows ? Is the

[sqlite] Database sybchronisation

2015-08-13 Thread Chris Parsonson
Hi SQLite people, I need to be able to synchronise some fairly simple table in two databases. Can someone help please Regards, Chris -- Chris Parsonson 083 777 9261