After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754238 - [sqlite3] vapi throws error in strict non-null mode
[sqlite3] vapi throws error in strict non-null mode
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
0.30.x
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2015-08-28 13:24 UTC by bob
Modified: 2016-09-12 10:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (2.27 KB, patch)
2015-10-11 09:43 UTC, Ernestas Kulik
committed Details | Review

Description bob 2015-08-28 13:24:08 UTC
Compiling an application of mine with the valac flags `--pkg sqlite3` and `--enable-experimental-non-null` results in the following error:

sqlite3.vapi:58.78-58.94: error: Argument 5: Cannot convert from `string?' to `string'
			var ec = this._get_table (sql, out sqlite_resultp, out nrow, out ncolumn, out sqlite_errmsg);
			                                                                          ^^^^^^^^^^^^^^^^^

Package vala-0.28.1-1 on Fedora 22
Comment 1 bob 2015-08-28 13:30:08 UTC
Also, as far as I can tell some of the function signatures are incorrect. For example, I believe this signature from Sqlite.Statement:

public unowned string column_text (int col)

Might more accurately be:

public unowned string? column_text (int col)

as I have had this return null previously. This of course further invalidates my application insofar as valac is concerned as logic checking for a null value is flagged as an invalid equality operation
Comment 2 Ernestas Kulik 2015-10-11 09:43:09 UTC
Created attachment 313052 [details] [review]
Proposed patch

Managed to get around fixing the issue.
Statement.column_text() seems to really return null at times, so I guess the return value should be a nullable string here.
Comment 3 Al Thomas 2016-09-11 11:38:55 UTC
Review of attachment 313052 [details] [review]:

For sqlite3_exec the patch matches the documentation at https://www.sqlite.org/capi3ref.html#sqlite3_exec "If the 5th parameter to sqlite3_exec() is not NULL and no errors occur, then sqlite3_exec() sets the pointer in its 5th parameter to NULL before returning."

For get_table the direct binding already makes errmsg nullable and this patch corrects the Vala wrapper to match that.

For sqlite3_column_text the patch matches the documentation at https://www.sqlite.org/capi3ref.html#sqlite3_column_blob If the internal type is NULL and the requested type is TEXT then the result is a null pointer.

Patch applies and looks good to me.