Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I thought of this answer, but Im still confused if its better to go with it than with the other solutions above. All queries in workspace B are executed immidiatly on the local database and also sent to the central database and then sent to workspace A, however queries on workspace A are not immidiatly executed on the local database, they are sent to the central database then the central sends them to workspace B, and when workspace B executes these queries, then it notifies the central and then workspace A is notified, then it can execute the queries which were stored. So that way workspace B is allowed to execute its queries normally, but workspace A is only allowed to execute its queries only when it knows when workspace B has executed those queries, since before workspace B executes the queries of A, it sends its own new queries, and then executes the queries of A, so after A is notified that B executed its queries, it checks if B sent any new queries of its own and executes them then it executes its own queries. That way all autoincrememted id's will be the same in both workspaces. Example:</p> <p>Workspace A: </p> <pre><code> q1= insert into stock (name) values ('A') not executed q2= insert into stock (name) values ('B') not executed </code></pre> <p>Database of A: (EMPTY)</p> <p>Workspace A sends q1 &amp; q2 to central and is the waiting for central to confirm that B has executed those queries so it can execute them itself</p> <p>Workspace B:</p> <pre><code> q3= insert into stock (name) values ('C') executed id=1 q4= insert into stock (name) values ('D') executed id=2 </code></pre> <p>Database of B: (1,'C') , (2,'D')</p> <p>Workspace B after sending q3 &amp; q4 to central, it is notified of q1 and q2,</p> <p>Workspace B executes q1 &amp; q2 </p> <pre><code> q1= insert into stock (name) values ('A') executed id=3 q2= insert into stock (name) values ('B') executed id=4 </code></pre> <p>Database B: (1,'C') , (2,'D'), (3,'A') , (4,'B')</p> <p>Workspace A is notified that B has executed its q1 &amp; q2, but it is told that it must execute q3 &amp; q4 before it can execute q1 &amp; q2</p> <p>Workspace A:</p> <pre><code> q3= insert into stock (name) values ('C') executed id=1 q4= insert into stock (name) values ('D') executed id=2 q1= insert into stock (name) values ('A') executed id=3 q2= insert into stock (name) values ('B') executed id=4 </code></pre> <p>Database of B: (1,'C') , (2,'D'), (3,'A') , (4,'B')</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload