On Oct 5, 2010, at 9:18 PM, Petite Abeille wrote:

> 
> On Oct 5, 2010, at 8:28 PM, Petite Abeille wrote:
> 
>> On Oct 5, 2010, at 8:20 PM, Tomas Guisasola Gorham wrote:
>> 
>>>> (1) Have the current drivers work properly :))
>>>     Could you send examples?
>> 
>> Well, right at this moment, this is just related to the SQLite driver which 
>> seems not to return the result of pragma calls in recent version of SQLite. 
>> See recent "luasql +sqlite3 fetch from pragma?" thread. 
> 
> Specifically, the bellow example works properly under 3.6.13, but raises an 
> exception under 3.7.2 when calling 'cur:fetch':
> 
> lua: TestDB.lua:7: database schema has changed
> stack traceback:
>       [C]: in function 'assert'
>       TestDB.lua:7: in main chunk
>       [C]: in ?
> 
> --8<--
> 
> local luasql = require( 'luasql.sqlite3' )
> 
> local anEnvironment = assert( luasql.sqlite3() )
> local aConnection = assert( anEnvironment:connect( 'test.db' ) )
> local aCursor = assert( aConnection:execute( 'pragma database_list' ) )
> local aRow, anException = assert( aCursor:fetch( {}, 'a' ) )
> 
> while aRow do
>    print( aRow.file, aRow.name, aRow.seq )
>    aRow, anException = aCursor:fetch( aRow, 'a' )
> end
> 
> aCursor:close()
> aConnection:close()
> anEnvironment:close()
> 
> -->8--

For the record, luadbi [1] sqlite3 driver works properly, i.e. it returns a 
result set from a pragma:

--8<--
local DBI = require( 'DBI' )

local aConnection = assert( DBI.Connect( 'SQLite3', 'Test.db') )
local aStatement = assert( aConnection:prepare( 'pragma database_list' ) )

assert( aStatement:execute() )

for anIndex, aValue in ipairs( assert( aStatement:columns() ) ) do
    print( anIndex, aValue )
end

for aRow in assert( aStatement:rows() ) do
    for anIndex, aValue in ipairs( aRow ) do
        print( anIndex, aValue )
    end
end

-->8--

Would anyone in the know spot what the issue could be?

http://github.com/keplerproject/luasql/blob/master/src/ls_sqlite3.c
http://code.google.com/p/luadbi/source/browse/trunk/dbd/sqlite3/statement.c


[1] http://code.google.com/p/luadbi/


_______________________________________________
Kepler-Project mailing list
Kepler-Project@lists.luaforge.net
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to