Re: [sqlite] sqlite3_column_* with error handling

2018-09-13 Thread Brian Vincent
On Tue, Sep 4, 2018 at 4:11 PM Keith Medcalf wrote: > > On Tuesday, 4 September, 2018 14:00, Clemens Ladisch > wrote: > > >Keith Medcalf wrote: > >> 6) If the column type is SQLITE_BLOB > >> a) Retrieve the column value pointer using column_blob > >> b) If the returned pointer is

Re: [sqlite] sqlite3_column_* with error handling

2018-09-13 Thread Brian Vincent
lp. > > --- > The fact that there's a Highway to Hell but only a Stairway to Heaven says > a lot about anticipated traffic volume. > > >-Original Message- > >From: sqlite-users [mailto:sqlite-users- > >boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin

Re: [sqlite] sqlite3_column_* with error handling

2018-09-13 Thread Simon Slavin
On 13 Sep 2018, at 3:49pm, Brian Vincent wrote: > From my testing, it appears that this information isn't exactly correct. > In my tests, when I call sqlite3_column_int64 for example, and it's > successful, sqlite_errcode() immediately afterwards is returning > SQLITE_ROW, which leads me to

Re: [sqlite] sqlite3_column_* with error handling

2018-09-13 Thread Brian Vincent
On Wed, Sep 5, 2018 at 5:22 AM Richard Hipp wrote: > On 9/4/18, Brian Vincent wrote: > > Hi, I'm currently writing a Go sqlite package, go-sqlite-lite. I think > it > > provides a good "pure" SQLite experience with Go. > > > > If I want to make sure that the sqlite3_column_* functions never

Re: [sqlite] sqlite3_column_* with error handling

2018-09-05 Thread Simon Slavin
On 5 Sep 2018, at 11:22am, Richard Hipp wrote: > Just call sqlite3_errcode(). It will return SQLITE_OK if the > sqlite3_column function was successful. In respect of the above, I observe the second sentence of If the most recent API call was

Re: [sqlite] sqlite3_column_* with error handling

2018-09-05 Thread Richard Hipp
On 9/4/18, Brian Vincent wrote: > Hi, I'm currently writing a Go sqlite package, go-sqlite-lite. I think it > provides a good "pure" SQLite experience with Go. > > If I want to make sure that the sqlite3_column_* functions never provide a > false answer due to an error condition, like a memolry

Re: [sqlite] sqlite3_column_* with error handling

2018-09-05 Thread Clemens Ladisch
Keith Medcalf wrote: > In the case of a BLOB if a NULL pointer is returned the error code must > be retrieved and then if and only if the bytes counter is greater than > 0 is the error valid. > > Does this mean that if you are retrieving the value of a blob via the > colmn_blob interface you

Re: [sqlite] sqlite3_column_* with error handling

2018-09-04 Thread J Decker
On Tue, Sep 4, 2018 at 2:11 PM Keith Medcalf wrote: > > On Tuesday, 4 September, 2018 14:00, Clemens Ladisch > wrote: > > >Keith Medcalf wrote: > >> 6) If the column type is SQLITE_BLOB > >> a) Retrieve the column value pointer using column_blob > >> b) If the returned pointer is

Re: [sqlite] sqlite3_column_* with error handling

2018-09-04 Thread Keith Medcalf
On Tuesday, 4 September, 2018 14:00, Clemens Ladisch wrote: >Keith Medcalf wrote: >> 6) If the column type is SQLITE_BLOB >> a) Retrieve the column value pointer using column_blob >> b) If the returned pointer is NULL, then an error has occurred >"The return value from

Re: [sqlite] sqlite3_column_* with error handling

2018-09-04 Thread Clemens Ladisch
Keith Medcalf wrote: > 6) If the column type is SQLITE_BLOB > a) Retrieve the column value pointer using column_blob > b) If the returned pointer is NULL, then an error has occurred "The return value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer." Regards,

Re: [sqlite] sqlite3_column_* with error handling

2018-09-04 Thread Keith Medcalf
-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin >Sent: Tuesday, 4 September, 2018 12:03 >To: SQLite mailing list >Subject: Re: [sqlite] sqlite3_column_* with error handling > >Your question has been asked earlier this year, and no so

Re: [sqlite] sqlite3_column_* with error handling

2018-09-04 Thread Simon Slavin
Your question has been asked earlier this year, and no solution was posted. I'm interested to find out whether things have improved. To summarise the earlier post: 1) sqlite3_column_int() returns the value stored in that column, or 0 if an error occurred.

[sqlite] sqlite3_column_* with error handling

2018-09-04 Thread Brian Vincent
Hi, I'm currently writing a Go sqlite package, go-sqlite-lite. I think it provides a good "pure" SQLite experience with Go. If I want to make sure that the sqlite3_column_* functions never provide a false answer due to an error condition, like a memolry allocation error, how should I go about