Re: [sqlite] xRowid and read only virtual tables....

2017-10-17 Thread dave
> On 10/16/17, dave  wrote:
> > Hi, I am building a system which involves a number of virtual table
> > implementations.  They are all read-only, but will be 
> involved in a bunch of
> > joins amongst themselves.  My question is this:
> >
> > the documentation
> >   http://sqlite.org/vtab.html#tabfunc2 at 2.12 xRowid
> > seems (to my reading) to be always required to be 
> implemented.  But does it
> > really?  Is it ever used for read-only tables?  I have never seen it
> > invoked, and I have been blithely ignoring implementing it, 
> but I wonder if
> > there is a case where it would be invoked for a read-only 
> query and so I am
> > tempting fate.
> 
> I don't think xRowid is ever called if you create a WITHOUT ROWID
> virtual table (https://sqlite.org//vtab.html#worid).  But, just to be
> safe, I think I would include a stub function that always returned 0.
> -- 
> D. Richard Hipp

Thanks. OK, I am interpreting that to mean:
*  you could use WITHOUT ROWID, which will surely obviate the need for a
valid xRowid implementation. However that does incur the need for defining
PRIMARY KEY, etc.  (I have verified this. It is problemattic with at least a
few of my vtables)
*  for a read-only vtable, you do not need a valid imlementation of xRowid,
you can just stub it.  However it is required to be present (i.e. the xRowid
member must not be NULL).

-dave


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] xRowid and read only virtual tables....

2017-10-17 Thread Richard Hipp
On 10/16/17, dave  wrote:
> Hi, I am building a system which involves a number of virtual table
> implementations.  They are all read-only, but will be involved in a bunch of
> joins amongst themselves.  My question is this:
>
> the documentation
>   http://sqlite.org/vtab.html#tabfunc2 at 2.12 xRowid
> seems (to my reading) to be always required to be implemented.  But does it
> really?  Is it ever used for read-only tables?  I have never seen it
> invoked, and I have been blithely ignoring implementing it, but I wonder if
> there is a case where it would be invoked for a read-only query and so I am
> tempting fate.

I don't think xRowid is ever called if you create a WITHOUT ROWID
virtual table (https://sqlite.org//vtab.html#worid).  But, just to be
safe, I think I would include a stub function that always returned 0.

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] xRowid and read only virtual tables....

2017-10-16 Thread dave
Hi, I am building a system which involves a number of virtual table
implementations.  They are all read-only, but will be involved in a bunch of
joins amongst themselves.  My question is this:
 
the documentation
  http://sqlite.org/vtab.html#tabfunc2 at 2.12 xRowid
seems (to my reading) to be always required to be implemented.  But does it
really?  Is it ever used for read-only tables?  I have never seen it
invoked, and I have been blithely ignoring implementing it, but I wonder if
there is a case where it would be invoked for a read-only query and so I am
tempting fate.
 
I ask in particular because implementing it will be quite awkward for the
underlying implementation in my case, and I'd very much prefer to skip it.
Even a 'without rowid' table would imply specifying some primary key, which
in a few cases would also be awkward.
 
Thanks in advance,
 
-dave
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users