Added files
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
From 0fa0d0ea4d8db54166c131dee7b509d3984c2e2f Mon Sep 17 00:00:00 2001
|
||||
From: Michael Gratton <mike@vee.net>
|
||||
Date: Wed, 9 Sep 2020 18:30:22 +1000
|
||||
Subject: [PATCH 004/124] Geary.Db.Statement: Minor code cleanup
|
||||
|
||||
Make `sql` a proper auto property. Remove expanded sql workaround.
|
||||
Minor code style cleanup.
|
||||
---
|
||||
src/engine/db/db-statement.vala | 17 ++++++-----------
|
||||
1 file changed, 6 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/src/engine/db/db-statement.vala b/src/engine/db/db-statement.vala
|
||||
index 088b882b..4d792b42 100644
|
||||
--- a/src/engine/db/db-statement.vala
|
||||
+++ b/src/engine/db/db-statement.vala
|
||||
@@ -9,15 +9,16 @@ private extern string? sqlite3_expanded_sql(Sqlite.Statement stmt);
|
||||
|
||||
public class Geary.Db.Statement : Context {
|
||||
|
||||
- public string sql {
|
||||
- get { return this.stmt.sql(); }
|
||||
- }
|
||||
+
|
||||
+ public string sql { get; private set; }
|
||||
|
||||
internal DatabaseConnection connection { get; private set; }
|
||||
|
||||
internal Sqlite.Statement stmt;
|
||||
|
||||
private Gee.HashMap<string, int>? column_map = null;
|
||||
+ private Gee.HashSet<Memory.Buffer> held_buffers = new Gee.HashSet<Memory.Buffer>();
|
||||
+
|
||||
|
||||
/**
|
||||
* Fired when the Statement is executed the first time (after creation or after a reset).
|
||||
@@ -34,11 +35,11 @@ public class Geary.Db.Statement : Context {
|
||||
*/
|
||||
public signal void bindings_cleared();
|
||||
|
||||
- private Gee.HashSet<Memory.Buffer> held_buffers = new Gee.HashSet<Memory.Buffer>();
|
||||
|
||||
internal Statement(DatabaseConnection connection, string sql)
|
||||
throws DatabaseError {
|
||||
this.connection = connection;
|
||||
+ this.sql = sql;
|
||||
throw_on_error(
|
||||
"Statement.ctor",
|
||||
connection.db.prepare_v2(sql, -1, out stmt, null),
|
||||
@@ -48,13 +49,7 @@ public class Geary.Db.Statement : Context {
|
||||
|
||||
/** Returns SQL for the statement with bound parameters expanded. */
|
||||
public string? get_expanded_sql() {
|
||||
- // Replace all this with `Sqlite.Statement.expanded_sql` is
|
||||
- // readily available. See:
|
||||
- // https://gitlab.gnome.org/GNOME/vala/merge_requests/74
|
||||
- string* sqlite = sqlite3_expanded_sql(this.stmt);
|
||||
- string? sql = sqlite;
|
||||
- Sqlite.Memory.free((void*) sqlite);
|
||||
- return sql;
|
||||
+ return this.stmt.expanded_sql();
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.29.2
|
||||
|
||||
Reference in New Issue
Block a user