Re: [sqlite] Virtual Tables: xSync without xBegin

2012-07-12 Thread OBones

Hello again.

Does anyone have any suggestion here?

Regards
Olivier

OBones wrote:

Hello all,

I'm pushing my experiment with virtual tables a bit further by trying 
out the transaction functions.
As a result, I gave values for the xBegin, xSync, xCommit and 
xRollback members of my sqlite3_module structure.

Then after having registered the module, I sent those two statements:

CREATE VIRTUAL TABLE SomeTable USING test(a INTEGER);
INSERT INTO SomeTable VALUES (50);

via appropriate calls to sqlite3_exec
However, this fails quite badly because the xSync function is called 
outside any transaction that would have been started by a call to xBegin.
Basically, xBegin is never called in my simple test, despite the 
documentation saying that this should not happen.


What have I done wrong here?

Any suggestion is most welcome

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





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


Re: [sqlite] Virtual Tables: xSync without xBegin

2012-07-12 Thread Jay A. Kreibich
On Thu, Jul 12, 2012 at 03:05:39PM +0200, OBones scratched on the wall:
 Hello again.
 
 Does anyone have any suggestion here?

  There is a footnote in Using SQLite (Chapter 10: Virtual Tables and
  Modules, p242) on this.

  The text is:

If you do need to support your own transactions, it is important to
keep the program flow in mind.  xBegin() will always be the first
function called.**  Typically, there will be calls to xUpdate()
followed by a two-step sequence of calls to xSync() and xCommit().
[...]

** In theory.  Currently, calls are made directly to xSync() and
   xCommit()following the call to xCreate().  It isn't clear if
   this is considered a bug or not, so this behavior may change
   in future versions of SQLite.

  Using SQLite was written before 3.7 was released, so this isn't a
  new thing.  Overall, I'd call this a documentation bug, as the
  behavior makes sense to me.  The system can't call xBegin() before
  xCreate(), yet creating the table is likely to be a transaction-based
  operation (just like xUpdate()).  Calling xBegin() after doesn't make
  sense either.
  
  I'd try to work around it in a way that will still work correctly
  if it is changed.  A simple in transaction flag would allow these
  calls to short-cut out.


Using SQLite: http://shop.oreilly.com/product/9780596521196.do

   -j
  

 I'm pushing my experiment with virtual tables a bit further by
 trying out the transaction functions.
 As a result, I gave values for the xBegin, xSync, xCommit and
 xRollback members of my sqlite3_module structure.
 Then after having registered the module, I sent those two statements:
 
 CREATE VIRTUAL TABLE SomeTable USING test(a INTEGER);
 INSERT INTO SomeTable VALUES (50);
 
 via appropriate calls to sqlite3_exec
 However, this fails quite badly because the xSync function is
 called outside any transaction that would have been started by a
 call to xBegin.
 Basically, xBegin is never called in my simple test, despite the
 documentation saying that this should not happen.
 
 What have I done wrong here?
 
 Any suggestion is most welcome
 
 Regards
 Olivier
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
 
 
 
 
 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

-- 
Jay A. Kreibich  J A Y  @  K R E I B I.C H 

Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable. -- Angela Johnson
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Virtual Tables: xSync without xBegin

2012-06-26 Thread OBones

Hello all,

I'm pushing my experiment with virtual tables a bit further by trying 
out the transaction functions.
As a result, I gave values for the xBegin, xSync, xCommit and xRollback 
members of my sqlite3_module structure.

Then after having registered the module, I sent those two statements:

CREATE VIRTUAL TABLE SomeTable USING test(a INTEGER);
INSERT INTO SomeTable VALUES (50);

via appropriate calls to sqlite3_exec
However, this fails quite badly because the xSync function is called 
outside any transaction that would have been started by a call to xBegin.
Basically, xBegin is never called in my simple test, despite the 
documentation saying that this should not happen.


What have I done wrong here?

Any suggestion is most welcome

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