]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
sqlite3: Allow some values to be nullable
authorErnestas Kulik <ernestas.kulik@gmail.com>
Sun, 11 Oct 2015 09:30:24 +0000 (12:30 +0300)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 12 Sep 2016 10:23:07 +0000 (12:23 +0200)
This fixes Database.get_table() as it throws an error when compiling in
strict non-null mode and also features tweaks in Database.{_,}exec and
Statement.column_text signatures to accomodate potential null returns.

https://bugzilla.gnome.org/show_bug.cgi?id=754238

vapi/sqlite3.vapi

index d2eb0370767028facf4af04e4f51b85049485f4f..cd331df00f75ebb3f3f7e137dd8308e77127d00d 100644 (file)
@@ -29,10 +29,10 @@ namespace Sqlite {
                public int busy_timeout (int ms);
                public int changes ();
                [CCode (cname = "sqlite3_exec")]
-               public int _exec (string sql, Callback? callback = null, [CCode (type = "char**")] out unowned string errmsg = null);
+               public int _exec (string sql, Callback? callback = null, [CCode (type = "char**")] out unowned string? errmsg = null);
                [CCode (cname = "_sqlite3_exec")]
-               public int exec (string sql, Callback? callback = null, out string errmsg = null) {
-                       unowned string sqlite_errmsg;
+               public int exec (string sql, Callback? callback = null, out string? errmsg = null) {
+                       unowned string? sqlite_errmsg;
                        var ec = this._exec (sql, callback, out sqlite_errmsg);
                        if (&errmsg != null) {
                                errmsg = sqlite_errmsg;
@@ -52,7 +52,7 @@ namespace Sqlite {
                private static void free_table ([CCode (array_length = false)] string[] result);
                [CCode (cname = "_sqlite3_get_table")]
                public int get_table (string sql, out string[] resultp, out int nrow, out int ncolumn, out string? errmsg = null) {
-                       unowned string sqlite_errmsg;
+                       unowned string? sqlite_errmsg;
                        unowned string[] sqlite_resultp;
 
                        var ec = this._get_table (sql, out sqlite_resultp, out nrow, out ncolumn, out sqlite_errmsg);
@@ -376,7 +376,7 @@ namespace Sqlite {
                public double column_double (int col);
                public int column_int (int col);
                public int64 column_int64 (int col);
-               public unowned string column_text (int col);
+               public unowned string? column_text (int col);
                public int column_type (int col);
                public unowned Value column_value (int col);
                public unowned string column_name (int index);