Wed, 08 Feb 2023 08:59:47 -0600
Export Account::error
I can't think of a good reason why we shouldn't expose the error property on
Accounts. But I would like to be able to set the error from the UI when there
is an error in the settings for example.
Testing Done:
Built the docs, ran the tests, used the prune connection action in the demo protocol plugin and verified everything was still working.
Reviewed at https://reviews.imfreedom.org/r/2216/
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
1 | /* |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
2 | * Purple - Internet Messaging Library |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
3 | * Copyright (C) Pidgin Developers <devel@pidgin.im> |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
4 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
9 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
14 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
16 | * along with this program; if not, see <https://www.gnu.org/licenses/>. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
17 | */ |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
18 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
19 | #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
20 | # error "only <pidgin.h> may be included directly" |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | #endif |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
22 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
23 | #ifndef PURPLE_SQLITE3_H |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
24 | #define PURPLE_SQLITE3_H |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | #include <glib.h> |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #include <gio/gio.h> |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | #include <sqlite3.h> |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | G_BEGIN_DECLS |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
33 | /** |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
34 | * PURPLE_SQLITE3_ERROR: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | * An error domain for sqlite3 errors. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
37 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
38 | * Since: 3.0.0 |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
39 | */ |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
40 | #define PURPLE_SQLITE3_DOMAIN (g_quark_from_static_string("sqlite3")) |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
42 | /** |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
43 | * PurpleSqlite3: |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
44 | * |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
45 | * A sqlite3 connection. |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
46 | * |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
47 | * This type alias exists for introspection purposes, and is no different from |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
48 | * the `sqlite3` type. |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
49 | * |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
50 | * Since: 3.0.0 |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
51 | */ |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
52 | #ifdef __GI_SCANNER__ |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
53 | typedef gpointer PurpleSqlite3; |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
54 | #else |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
55 | typedef sqlite3 PurpleSqlite3; |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
56 | #endif |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
57 | |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
58 | /** |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
59 | * purple_sqlite3_get_schema_version: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
60 | * @db: The sqlite3 connection. |
|
41881
7e1dd7e9efbb
Fix error parameter annotations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41810
diff
changeset
|
61 | * @error: Return address for a #GError, or %NULL. |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
62 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
63 | * Attempts to read the result of `PRAGMA user_version` which this API uses to |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
64 | * store the schema version. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
65 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
66 | * Returns: %TRUE on success, or %FALSE on error with @error set. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
67 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
68 | * Since: 3.0.0 |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | */ |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
70 | int purple_sqlite3_get_schema_version(PurpleSqlite3 *db, GError **error); |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
71 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
72 | /** |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | * purple_sqlite3_run_migrations_from_strings: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
74 | * @db: The sqlite3 connection. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | * @migrations: (array zero-terminated=1): A list of SQL statements, each item |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | * being its own migration. |
|
41881
7e1dd7e9efbb
Fix error parameter annotations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41810
diff
changeset
|
77 | * @error: Return address for a #GError, or %NULL. |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
78 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | * Runs the given migrations in the order they are given. The index of each |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
80 | * migration plus 1 is assumed is to be the version number of the migration, |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
81 | * which means that you can not change the order of the migrations. The |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
82 | * reasoning for the addition of 1 is because `PRAGMA user_version` defaults to |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | * 0. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | * This expects each string in @migrations to be a complete migration. That is, |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | * each string in the array should contain all of the SQL for that migration. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
87 | * For example, if you're expecting to have 2 migrations, the initial creating |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
88 | * two tables, and then adding a column to one of the existing tables, you |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
89 | * would have something like the following code. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
91 | * ```c |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
92 | * const char *migrations[] = { |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
93 | * // Our initial migration that creates user and session tables. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
94 | * "CREATE TABLE user(id INTEGER PRIMARY KEY, name TEXT);" |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | * "CREATE TABLE session(user INTEGER, token TEXT) FOREIGN KEY(user) REFERENCES user(id);", |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | * // Begin our second migration that will add a display name to the user |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
97 | * // table. Note the ',' at the end of the previous line. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
98 | * "ALTER TABLE user ADD COLUMN(display_name TEXT);", |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
99 | * NULL |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
100 | * }; |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
101 | * ``` |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
102 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | * Also, this function will run each migration in its own transaction so you |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | * don't need to worry about them. This is done to make sure that the database |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
105 | * stays at a known version and an incomplete migration will not be saved. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
106 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
107 | * Returns: %TRUE on success, or %FALSE on error potentially with @error set. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
108 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
109 | * Since: 3.0.0 |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | */ |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
111 | gboolean purple_sqlite3_run_migrations_from_strings(PurpleSqlite3 *db, const char *migrations[], GError **error); |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
112 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
113 | /** |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
114 | * purple_sqlite3_run_migrations_from_resources: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
115 | * @db: The sqlite3 connection. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
116 | * @path: The base path in @resource to use. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
117 | * @migrations: (array zero-terminated=1): The list of migrations in the order |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | * to run them. |
|
41881
7e1dd7e9efbb
Fix error parameter annotations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41810
diff
changeset
|
119 | * @error: Return address for a #GError, or %NULL. |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
120 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | * Runs the given migrations in the order they are given. The index of each |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
122 | * migration plus 1 is assumed to be the version number of the migration, which |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
123 | * means that you can not change the order of the migrations. The reasoning for |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
124 | * the addition of 1 is because `PRAGMA user_version` defaults to 0. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
125 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
126 | * This will attempt to load the migrations via |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | * [func@Gio.resources_open_stream] by concatenating @path and the individual |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | * items of @migrations. Each migration will be ran in a transaction that |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | * includes updating the schema version, which is stored in |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
130 | * `PRAGMA user_version`. This means you can't use `PRAGMA user_version` for |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
131 | * other things. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
132 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | * Returns: %TRUE on success, or %FALSE on error potentially with @error set. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
134 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
135 | * Since: 3.0.0 |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
136 | */ |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
137 | gboolean purple_sqlite3_run_migrations_from_resources(PurpleSqlite3 *db, const char *path, const char *migrations[], GError **error); |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | G_END_DECLS |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
140 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
141 | #endif /* PURPLE_SQLITE3_H */ |