Re: [fossil-users] sqlite3_prepare_v2() is generating output to stderr?

2011-09-09 Thread Martin S. Weber

On 09/09/11 12:31, Stephan Beal wrote:

Maybe this is a bug, maybe not, but i've certainly never seen it before...

i'm intentionally introducing SQL errors to test my JSON-side error
handling, and i found that this:

rc = sqlite3_prepare_v2(g.db, zSql, -1, pStmt-pStmt, 0);

outputs to stderr when preparation fails.

i've never seen sqlite3 do that before. Is that normal? It interferes
with the JSON output:


Really? I'm assuming the JSON output goes to stdout, and the error message 
goes to stderr. In that case it wouldn't interfere with the JSON output at 
all. Just pipe the output to your json reader without a 21...there'll be no 
problem.


-Martin
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] sqlite3_prepare_v2() is generating output to stderr?

2011-09-09 Thread Martin S. Weber

On 09/09/11 12:34, Martin S. Weber wrote:

Really? I'm assuming the JSON output goes to stdout, and the error message
goes to stderr. In that case it wouldn't interfere with the JSON output at
all. Just pipe the output to your json reader without a 21...there'll be no
problem.


That being said, of course a library should never write to stderr directly.

-Martin
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] sqlite3_prepare_v2() is generating output to stderr?

2011-09-09 Thread Stephan Beal
On Fri, Sep 9, 2011 at 6:35 PM, Martin S. Weber martin.we...@nist.govwrote:

 That being said, of course a library should never write to stderr directly.


i just found the reason for it:

/* Error logs from SQLite */
void fossil_sqlite_log(void *notUsed, int iCode, const char *zErrmsg){
  fossil_warning(%s: %s, sqlite_error_code_name(iCode), zErrmsg);
}


main.c:  sqlite3_config(SQLITE_CONFIG_LOG, fossil_sqlite_log, 0);

which means i can disable it in JSON mode :).

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users