You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// the good news is that the query can be computed in SQLite without the need to do any extra computation from the host language
328
-
constchar*sql="WITH table_names AS ("
329
-
"SELECT format('%w', name) as tbl_name "
330
-
"FROM sqlite_master "
331
-
"WHERE type='table' "
332
-
"AND name LIKE '%_cloudsync'"
333
-
"), "
334
-
"query_parts AS ("
335
-
"SELECT 'SELECT max(db_version) as version FROM \"' || tbl_name || '\"' as part FROM table_names"
336
-
"), "
337
-
"combined_query AS ("
338
-
"SELECT GROUP_CONCAT(part, ' UNION ALL ') || ' UNION SELECT value as version FROM cloudsync_settings WHERE key = ''pre_alter_dbversion''' as full_query FROM query_parts"
339
-
") "
340
-
"SELECT 'SELECT max(version) as version FROM (' || full_query || ');' FROM combined_query;";
"DROP TABLE IF EXISTS cloudsync_schema_versions; ";
69
69
70
+
// MARK: - CloudSync -
71
+
72
+
constchar*constSQL_DBVERSION_BUILD_QUERY=
73
+
"WITH table_names AS ("
74
+
"SELECT format('%w', name) as tbl_name "
75
+
"FROM sqlite_master "
76
+
"WHERE type='table' "
77
+
"AND name LIKE '%_cloudsync'"
78
+
"), "
79
+
"query_parts AS ("
80
+
"SELECT 'SELECT max(db_version) as version FROM \"' || tbl_name || '\"' as part FROM table_names"
81
+
"), "
82
+
"combined_query AS ("
83
+
"SELECT GROUP_CONCAT(part, ' UNION ALL ') || ' UNION SELECT value as version FROM cloudsync_settings WHERE key = ''pre_alter_dbversion''' as full_query FROM query_parts"
84
+
") "
85
+
"SELECT 'SELECT max(version) as version FROM (' || full_query || ');' FROM combined_query;";
86
+
87
+
constchar*constSQL_SITEID_SELECT_ROWID0=
88
+
"SELECT site_id FROM cloudsync_site_id WHERE rowid=0;";
89
+
90
+
constchar*constSQL_DATA_VERSION=
91
+
"PRAGMA data_version;";
92
+
93
+
constchar*constSQL_SCHEMA_VERSION=
94
+
"PRAGMA schema_version;";
95
+
96
+
constchar*constSQL_SITEID_GETSET_ROWID_BY_SITEID=
97
+
"INSERT INTO cloudsync_site_id (site_id) VALUES (?) "
98
+
"ON CONFLICT(site_id) DO UPDATE SET site_id = site_id "
0 commit comments