Hi! I'm trying to get data from sqlite3, but takes an MS VC++ runtime error. Screenshot: http://min.us/mbcZvTEP1F Tested at 3 machines with windows 7 (both 32 and 64 bit). Gideros 2012.2.2.2
I've created a simple example and it worked without a problem. I'm attaching the project.
Here I created a test table and inserted some values:
$ sqlite3 db.sqlite
SQLite version 3.7.10 2012-01-16 13:28:40
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table test(num1,num2);
sqlite> insert into test values(1,11);
sqlite> insert into test values(2,22);
sqlite> insert into test values(3,33);
sqlite> .quit
And executed this Lua code:
require"lsqlite3"print("sqlite3 version: "..sqlite3.version())local db = sqlite3.open("db.sqlite")for r in db:nrows("select * from test")doprint(r.num1, r.num2)end
db:close()
And this is the output on Windows 7
sqlite3 version: 3.7.10
1 11
2 22
3 33
Can you run the attached project? or maybe your db is corrupted?
atilim, it works now! The problem's solved by adding db file to project. When db not in projects file list, connection is possible, but quering crashes. I'm Just add db to project, and selecting OK.
I see. afaik, when the db file doesn't exit, SQLite tries to create an empty one. On the other hand, resource directory is readonly. Combination of these two results in crashing instead of a meaningful error.
Comments
I've created a simple example and it worked without a problem. I'm attaching the project.
Here I created a test table and inserted some values:
The problem's solved by adding db file to project.
When db not in projects file list, connection is possible, but quering crashes.
I'm Just add db to project, and selecting OK.