Wed, 14 Aug 2024 19:26:26 -0500
Remove uri handling from libpurple
Testing Done:
Called in the turtles.
Reviewed at https://reviews.imfreedom.org/r/3387/
|
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 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
5 | * Purple is the legal property of its developers, whose names are too numerous |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
6 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
7 | * source distribution. |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
8 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
9 | * This library is free software; you can redistribute it and/or modify it |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
10 | * under the terms of the GNU General Public License as published by the Free |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
11 | * Software Foundation; either version 2 of the License, or (at your option) |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
12 | * any later version. |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
13 | * |
|
42594
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
16 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
17 | * more details. |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
18 | * |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
19 | * You should have received a copy of the GNU General Public License along with |
|
eddde70cedd8
Create a test for verifying license headers and correct the ones that were wrong
Gary Kramlich <grim@reaperworld.com>
parents:
42387
diff
changeset
|
20 | * this library; if not, see <https://www.gnu.org/licenses/>. |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
21 | */ |
|
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 | #if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION) |
|
42356
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
24 | # error "only <purple.h> may be included directly" |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
25 | #endif |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
26 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
27 | #ifndef PURPLE_SQLITE3_H |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
28 | #define PURPLE_SQLITE3_H |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
29 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
30 | #include <glib.h> |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
31 | #include <gio/gio.h> |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
32 | |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
33 | #include "purpleversion.h" |
|
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
34 | |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
35 | G_BEGIN_DECLS |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
36 | |
|
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 | * PURPLE_SQLITE3_ERROR: |
|
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 | * An error domain for sqlite3 errors. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
41 | * |
|
42616
a7144db5570a
Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
42 | * Since: 3.0 |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
43 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
44 | #define PURPLE_SQLITE3_DOMAIN \ |
|
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
45 | g_quark_from_static_string("sqlite3") \ |
|
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
46 | PURPLE_AVAILABLE_MACRO_IN_3_0 |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
47 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
48 | /** |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
49 | * PurpleSqlite3: |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
50 | * |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
51 | * A sqlite3 connection. |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
52 | * |
|
42356
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
53 | * This type alias exists to avoid requiring the sqlite3 header, but is no |
|
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
54 | * different from the `sqlite3` type. |
|
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
55 | * |
|
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
56 | * If that header is included first, this will be exactly equivalent, otherwise |
|
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
57 | * it will be a generic `gpointer`, which you should cast to a `sqlite3`. |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
58 | * |
|
42616
a7144db5570a
Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
59 | * Since: 3.0 |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
60 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
61 | PURPLE_AVAILABLE_TYPE_IN_3_0 |
|
42356
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
62 | #ifdef SQLITE_API |
|
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
63 | typedef sqlite3 PurpleSqlite3; |
|
73dca30d5cc4
Hide sqlite header from public headers
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41881
diff
changeset
|
64 | #else |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
65 | typedef gpointer PurpleSqlite3; |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
66 | #endif |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
67 | |
|
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
68 | /** |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
69 | * purple_sqlite3_get_schema_version: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
70 | * @db: The sqlite3 connection. |
|
41881
7e1dd7e9efbb
Fix error parameter annotations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41810
diff
changeset
|
71 | * @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
|
72 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
73 | * 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
|
74 | * store the schema version. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
75 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
76 | * 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
|
77 | * |
|
42616
a7144db5570a
Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
78 | * Since: 3.0 |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
79 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
80 | PURPLE_AVAILABLE_IN_3_0 |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
81 | 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
|
82 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
83 | /** |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
84 | * purple_sqlite3_run_migrations_from_strings: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
85 | * @db: The sqlite3 connection. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
86 | * @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
|
87 | * being its own migration. |
|
41881
7e1dd7e9efbb
Fix error parameter annotations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41810
diff
changeset
|
88 | * @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
|
89 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
90 | * 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
|
91 | * 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
|
92 | * 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
|
93 | * 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
|
94 | * 0. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
95 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
96 | * 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
|
97 | * 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
|
98 | * 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
|
99 | * 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
|
100 | * would have something like the following code. |
|
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 | * ```c |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
103 | * const char *migrations[] = { |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
104 | * // 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
|
105 | * "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
|
106 | * "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
|
107 | * // 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
|
108 | * // 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
|
109 | * "ALTER TABLE user ADD COLUMN(display_name TEXT);", |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
110 | * NULL |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
111 | * }; |
|
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 | * 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
|
115 | * 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
|
116 | * 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
|
117 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
118 | * 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
|
119 | * |
|
42616
a7144db5570a
Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
120 | * Since: 3.0 |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
121 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
122 | PURPLE_AVAILABLE_IN_3_0 |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
123 | 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
|
124 | |
|
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 | * purple_sqlite3_run_migrations_from_resources: |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
127 | * @db: The sqlite3 connection. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
128 | * @path: The base path in @resource to use. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
129 | * @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
|
130 | * to run them. |
|
41881
7e1dd7e9efbb
Fix error parameter annotations
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41810
diff
changeset
|
131 | * @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
|
132 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
133 | * 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
|
134 | * 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
|
135 | * 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
|
136 | * 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
|
137 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
138 | * This will attempt to load the migrations via |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
139 | * [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
|
140 | * 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
|
141 | * 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
|
142 | * `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
|
143 | * other things. |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
144 | * |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
145 | * 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
|
146 | * |
|
42616
a7144db5570a
Remove the micro version from since tags for libpurple part 5
Gary Kramlich <grim@reaperworld.com>
parents:
42594
diff
changeset
|
147 | * Since: 3.0 |
|
41804
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
148 | */ |
|
42387
d9350cda1556
Export symbols added for 3.0.0
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
42356
diff
changeset
|
149 | PURPLE_AVAILABLE_IN_3_0 |
|
41810
bd91865991dc
Fix new warnings in gir generation
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41804
diff
changeset
|
150 | 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
|
151 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
152 | G_END_DECLS |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
153 | |
|
36c3c3cd2402
Add some api for handling SQLite3 migrations
Gary Kramlich <grim@reaperworld.com>
parents:
diff
changeset
|
154 | #endif /* PURPLE_SQLITE3_H */ |