aboutsummaryrefslogtreecommitdiff
path: root/arch/salis-v1/arch.j2.c
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-11-26 02:20:36 +0100
committerPaul Oliver <contact@pauloliver.dev>2025-11-26 02:20:36 +0100
commitaadc47956edea63776c2d4466d6c3ee0557c0e43 (patch)
treeeca4da8a4f2702fa1ab824c26752aa673f3a2ba8 /arch/salis-v1/arch.j2.c
parentfcf5746e8defdacba2284581a6521f72096891c5 (diff)
Enable SQLite Write-Ahead Logging (WAL)
Diffstat (limited to 'arch/salis-v1/arch.j2.c')
-rw-r--r--arch/salis-v1/arch.j2.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/arch/salis-v1/arch.j2.c b/arch/salis-v1/arch.j2.c
index 5d2f58a..9c3ea45 100644
--- a/arch/salis-v1/arch.j2.c
+++ b/arch/salis-v1/arch.j2.c
@@ -829,29 +829,6 @@ const char *arch_mnemonic(uint8_t inst) {
}
{% if data_push_path is defined %}
-void _exec_sql(const char *sql) {
- assert(sql);
-
- int sql_res;
- char *sql_err;
-
- while ((sql_res = sqlite3_exec(g_sim_data, sql, NULL, NULL, &sql_err)) == SQLITE_BUSY) {
- g_warn("SQLite database returned error '%d' with message:", sql_res);
- g_warn(sql_err);
- sqlite3_free(sql_err);
-
- switch (sql_res) {
- case SQLITE_BUSY:
- // Only handle busy database errors
- g_info("Will retry query...");
- continue;
- default:
- // Application should fail on all other error conditions
- assert(false);
- }
- }
-}
-
void arch_push_data_header() {
assert(g_sim_data);
@@ -879,7 +856,7 @@ void arch_push_data_header() {
);
g_info("Generating 'trend' table in SQLite database");
- _exec_sql(trend_sql);
+ salis_exec_sql(trend_sql);
// Core-specific instruction data will be queried separately
// A table is created for each core
@@ -899,7 +876,7 @@ void arch_push_data_header() {
);
g_info("Generating '{{ t }}_{{ i }}' table in SQLite database");
- _exec_sql({{ t }}_sql_{{ i }});
+ salis_exec_sql({{ t }}_sql_{{ i }});
{% endfor %}
{% endfor %}
}
@@ -992,7 +969,7 @@ void arch_push_data_line() {
);
g_info("Pushing row to 'trend' table in SQLite database");
- _exec_sql(trend_sql);
+ salis_exec_sql(trend_sql);
free(trend_sql);
{% for t in ["pop", "exe", "wrt"] %}
@@ -1037,7 +1014,7 @@ void arch_push_data_line() {
);
g_info("Pushing row to '{{ t }}_{{ i }}' table in SQLite database");
- _exec_sql({{ t }}_sql_{{ i }});
+ salis_exec_sql({{ t }}_sql_{{ i }});
free({{ t }}_sql_{{ i }});
{% endfor %}
{% endfor %}