Hi, all!
A couple weeks ago we spoke about generating JSON output for some of the
fossil features, e.g. the timeline.
Today i put together some "sqlite3 to JSON" code which will make adding this
support to fossil trivial. Here's a brief demonstration:
char const * select = "SELECT * FROM stuff";
cson_value * json = NULL;
int rc = cson_sqlite3_sql_to_json( ThisApp.db, &json, select);
assert( 0 == rc );
cson_output_FILE( json, stdout, &ThisApp.outOpt );
// ^^^ ThisApp.outOpt holds JSON formatting options, like indentation
cson_value_free(json);
There's also a routine which takes a sqlite3_stmt instead of an SQL string.
The output for my simple tests:
CREATE TABLE IF NOT EXISTS stuff (name UNIQUE ON CONFLICT REPLACE, count );
DELETE FROM stuff;
INSERT INTO STUFF (name,count) VALUES('this',3);
INSERT INTO STUFF (name,count) VALUES('that',2);
INSERT INTO STUFF (name,count) VALUES('theOtherThing',NULL);
{"columns":["name", "count"], "rows":[["this", 3], ["that", 2],
["theOtherThing", null]]}
With this in place i can finally (and easily) add such a beast to the fossil
timeline (or whatever other data we decide - the wiki might be cool). i'll
get a prototype hacked up this weekend.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users