Review: Needs Fixing

I've pushed a couple changes to get the module compiling on Linux. However, 
several of the test cases fail for me with the error 
"http://www.zorba-xquery.com/modules/sqlite:SQLI9999 library routine called out 
of sequence".

I found this link regarding that error message:

http://sqlite.org/cvstrac/wiki?p=LibraryRoutineCalledOutOfSequence

However, I think the error may be in the test cases. You are using a number of 
"let" statements to perform sequential tasks such as opening the database 
connection and querying it, and as far as I know XQuery doesn't guarantee the 
order of operations of lets in a single FLWOR. Changing these to sequential 
blocks using scripting may solve these problems. For instance, test0.xq 
currently reads

let $path := f:path-to-native(resolve-uri("./"))
let $db := s:connect(concat($path, "small2.db"))
let $isconn := s:is-connected($db)
let $result := s:execute-query($db, "select * from smalltable")
let $old-db := s:disconnect($db)
return ($result, $isconn)

This throws the SQLI9999 error. However, if I change the query to the following:

let $path := f:path-to-native(resolve-uri("./"))
let $db := s:connect(concat($path, "small2.db"))
return {
   variable $isconn := s:is-connected($db);
   variable $result := s:execute-query($db, "select * from smalltable");
   variable $old-db := s:disconnect($db);
   ($result, $isconn)
}

the test passes. (Note that when running this query from the command line, I 
get "Zorba static warning [zwarn:ZWST0004]: sequential FLWOR expr may not have 
the semantics you expect", so perhaps my code isn't totally correct either. But 
the test passes, at least.

-- 
https://code.launchpad.net/~zorba-coders/zorba/zorba-for-sqlite/+merge/139108
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to