The gfun now embeds the running of a segment from start to end. This code
sqlite3_result_int(context, current_graph->row+1);
if(x == current_graph->row+1)
if(current_graph->row+1 != current_graph->end)
current_graph->row++;
break;
Called from an sql where as in:
where (gfun(0,rowid) == rowid);
So, the current graph segment on any table has a start and end, sql knows about it.
Also, allowing the handler argument on a call to triple, combined wit the new gfun, makes for very simple popping off an array of triples for a local function, like schema and match. When match wants the stream of schema triples, just reset the row counter and execute the pop function on the schema table. Again, the forward pointing grammar ensures that the top most segment pointer is the current, so there is no need to carry around segment pointers.
Table names, you can change them on start, but it adds hokyness.
Anyplace in the code where it un-necessarily called the triple machine was replaced with an internal call. The code needn't do triples, really, unless it is dealing with a table.
Match, still fiddling with that, but right now the machine carries a structure with the accumulated operator overloads, like not, schema, wildkey, forward pointers; as well as the two ready key words for match,. It is rigged to operate on a triple basis, and for square tables, it reads off the column values in order, and it can simulate a schema by reading off the columns names. In other words, square tables forced to look like triple streams with assigned operators.
Match is unaware of anything except the current match conditions, so if these are restored to normal grammar at match points, sql is free to take off and run the counters. When are the match points? When the counters have run to sql_complete, mainly, as that is the time to open or close a graph one or more of the three tables involved.
I am getting the machine is almost perfect order, except saving match for last, as that is the most fun part. If I make robust match design based on simple TE grammar then the machine takes off, market wise, it becomes a wow thingie, a star in the stable of open source hallmarks, Stallman award winner, earns a Linus applause.
No comments:
Post a Comment