I am busy adding virtual table support to APSW and have some comments
from my progress so far:

The structure types and "subclassing" method of using them works well
and the API is easy to use.  (Admittedly I did spend a lot of quality
time with the xBestIndex method documentation but that is to be expected).

There is no documentation on exactly what the Begin/Sync/Commit/Rollback
methods should do.  I can take an educated guess but the presence of
Sync confuses things.  Eg is Commit expected to do a sync internally or
will SQLite call Sync as well?  Does Begin mean a write will happen (eg
should I fail it for a read only database?) Will there always be a Begin?

In the same territory I would assume all changes made since a begin
should be held temporarily until a commit or discarded in a rollback.
Should those changes be visible in all cursors or just the same one as
update is called in.

What effect does Update have on the cursor (such as the position)?  Do
updated values become visible in the same iteration?  How do you not get
infinite loops with "update foo set bar=bar+1"?

BestIndex is very hairy! One API change I suggest is in the output
aConstraintUsage.argvIndex - don't make it be off by one.  Currently if
you set it to 2 then it is argv[1] in xFilter.  It would be way better
if they just corresponded directly to each other.  A value of <0 (eg -1)
can indicate not to send it to xFilter.

When making the argument list to the Python code, I omit all aConstraint
where usable is false hiding the fact they were ever supplied.  Is this
okay?  (ie would there ever be a situation where the Python code would
want to see unusable constraints)

On a stylistic and consistency note, what is the ideal way to pass the
constraint op to the Python code.  I currently do it as an integer but
could use a string instead (eg '>=' instead of 32).  I think strings
look nicer but if the list of constraints is going to get longer or
somehow be combined (they are powers of two implying they could be or'ed
together) then strings definitely can't be used.

Another stylistic and consistency question:  I can make several methods
be optional in the Python code.  One example is Sync.  Another is Update
where I can return SQLITE_READONLY if the developer didn't supply
Update.  If Connect isn't present then call Create.  BestIndex is
another that doesn't need to be present.  Any opinions on letting many
methods be optional which makes for far shorter "hello world" examples
vs requiring users to provide all methods so that they have to think
through the consequences and interactions between methods?

Roger

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to