1

I read about a lib named WebSqlSync as an answer to this question: Best way to synchronize local HTML5 DB (WebSQL Storage, SQLite) with a server (2 way sync)

When reading the documentation I understood that it was only possible to have a single key field to identify the row to sync. As the example given suggests:

TABLES_TO_SYNC = [
    {tableName : 'table1', idName : 'the_id'},
    {tableName : 'table2'} //if idName not specified, it will assume that it's "id"
];

I wonders if it would accept several keys to identify the row if a table uses several fields as component of the key, so it would look like this:

{tableName : 'table1', idName : 'id_1,id_2,id_3'},
Community
  • 1
  • 1
nyluje
  • 3,573
  • 7
  • 37
  • 67

1 Answers1

1

Not possible without modifying the library.

A simpler solution would be to create a computed/virtual column like "ComposedId" composed with the concatenation of the values of the ids (ex. "ComposedId" = "id_1Value+id_2Value+id_3Value").

And then, you would declare the table with only 1 ID : {tableName : 'table1', idName : 'ComposedId'},

Hope this helps

Samuel
  • 5,439
  • 6
  • 31
  • 43