On 06/09/2015 04:46 PM, Samuel Debionne wrote:
> Hello,
>
> AFAIU, when executing a drop statement on a virtual table, the XConnect
> callback is executed first, then XDestroy.
>
> Now I have the following scenario where my virtual table is related to a
> file (say a CSV file):
>
> 1. Create the virtual table
> 2. Delete the CSV file from disk
> 3. Try to drop the table (fails)
>
> When creating the vtable, xCreate / xConnect should fail (returns
> SQLITE_ERROR) if the underlying file does not exists.
>
> But when dropping the vtable, this very same xConnect should continue to
> let the user drop a table on a deleted file.
>
> Is there a way to know the "context", e.g. the SQL command, that has
> triggered a call to xConnect ? Or is there a better way to tackle this
> issue ?

I don't think there is a way to detect the current statement.

You probably have to allow the xConnect() to succeed and set a flag 
within the sqlite3_vtab object to indicate that the underlying file is 
not actually present. Then return SQLITE_IOERR or similar on all 
operations that actually require the CSV file.

Dan.



>
> Thank you,
> Samuel
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to