/ Check-in [088a41eb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update comments in sqlite3ota.h to remove the "must have PRIMARY KEY" restriction.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ota-update
Files: files | file ages | folders
SHA1:088a41eb8c18886a260cf53fa0cca3bd1958dc05
User & Date: dan 2014-12-08 07:28:26
Context
2014-12-08
07:50
Update this branch with latest trunk changes. check-in: 69a312ad user: dan tags: ota-update
07:28
Update comments in sqlite3ota.h to remove the "must have PRIMARY KEY" restriction. check-in: 088a41eb user: dan tags: ota-update
07:22
Extra tests for the ota_rowid column. check-in: 46069393 user: dan tags: ota-update
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/ota/sqlite3ota.h.

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
..
90
91
92
93
94
95
96
97

98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
...
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
** An "OTA update" transaction is subject to the following limitations:
**
**   * The transaction must consist of INSERT, UPDATE and DELETE operations
**     only.
**
**   * INSERT statements may not use any default values.
**
**   * Non-virtual tables that do not have declared primary keys may not 
**     be updated. UPDATE and DELETE statements must identify their target 
**     rows by PRIMARY KEY values. 
**
**   * UPDATE statements may not modify PRIMARY KEY columns.
**
**   * No triggers will be fired.
**
**   * No foreign key violations are detected or reported.
**
................................................................................
**
** Then the OTA database should contain:
**
**   CREATE TABLE data_t1(a INTEGER, b TEXT, c, ota_control);
**
** The order of the columns in the data_% table does not matter.
**
** If the target database table is a virtual table, the data_% table should

** also contain a column named "ota_rowid". This column is mapped to the
** virtual tables implicit primary key column - "rowid". Virtual tables
** for which the "rowid" column does not function like a primary key value
** can not be updated using OTA. For example, if the target db contains:
**
**   CREATE VIRTUAL TABLE ft1 USING fts3(a, b);

**
** then the OTA database should contain:
**
**   CREATE TABLE data_ft1(a, b, ota_rowid, ota_control);
**
** All non-hidden columns (i.e. all columns matched by "SELECT *") of the
** target table must be present in the input table. For virtual tables,
** hidden columns are optional - they are updated by OTA if present in
** the input table, or not otherwise. For example, to write to an fts4
** table with a hidden languageid column such as:
**
................................................................................
**
**   INSERT INTO data_t1(a, b, c, ota_control) VALUES(4, NULL, 'usa', '..d');
**
** is similar to an UPDATE statement such as: 
**
**   UPDATE t1 SET c = ota_delta(c, 'usa') WHERE a = 4;
**
** If the target database table is a virtual table, the ota_control value
** should not include a character corresponding to the ota_rowid value.
** For example, this:
**
**   INSERT INTO data_ft1(a, b, ota_rowid, ota_control) 
**       VALUES(NULL, 'usa', 12, '..d');
**
** causes a result similar to:
**
**   UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
**
**
** USAGE







|
|
|







 







|
>
|
|
|
|

|
>



|







 







|
|
|


|







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
** An "OTA update" transaction is subject to the following limitations:
**
**   * The transaction must consist of INSERT, UPDATE and DELETE operations
**     only.
**
**   * INSERT statements may not use any default values.
**
**   * UPDATE and DELETE statements must identify their target rows by 
**     PRIMARY KEY values. If the table being written has no PRIMARY KEY
**     declaration, affected rows must be identified by rowid.
**
**   * UPDATE statements may not modify PRIMARY KEY columns.
**
**   * No triggers will be fired.
**
**   * No foreign key violations are detected or reported.
**
................................................................................
**
** Then the OTA database should contain:
**
**   CREATE TABLE data_t1(a INTEGER, b TEXT, c, ota_control);
**
** The order of the columns in the data_% table does not matter.
**
** If the target database table is a virtual table or a table that has no
** PRIMARY KEY declaration, the data_% table must also contain a column 
** named "ota_rowid". This column is mapped to the tables implicit primary 
** key column - "rowid". Virtual tables for which the "rowid" column does 
** not function like a primary key value cannot be updated using OTA. For 
** example, if the target db contains either of the following:
**
**   CREATE VIRTUAL TABLE x1 USING fts3(a, b);
**   CREATE TABLE x1(a, b)
**
** then the OTA database should contain:
**
**   CREATE TABLE data_x1(a, b, ota_rowid, ota_control);
**
** All non-hidden columns (i.e. all columns matched by "SELECT *") of the
** target table must be present in the input table. For virtual tables,
** hidden columns are optional - they are updated by OTA if present in
** the input table, or not otherwise. For example, to write to an fts4
** table with a hidden languageid column such as:
**
................................................................................
**
**   INSERT INTO data_t1(a, b, c, ota_control) VALUES(4, NULL, 'usa', '..d');
**
** is similar to an UPDATE statement such as: 
**
**   UPDATE t1 SET c = ota_delta(c, 'usa') WHERE a = 4;
**
** If the target database table is a virtual table or a table with no PRIMARY
** KEY, the ota_control value should not include a character corresponding 
** to the ota_rowid value. For example, this:
**
**   INSERT INTO data_ft1(a, b, ota_rowid, ota_control) 
**       VALUES(NULL, 'usa', 12, '.x');
**
** causes a result similar to:
**
**   UPDATE ft1 SET b = 'usa' WHERE rowid = 12;
**
**
** USAGE