Hi

I'm trying to write a SQLite module for BlitzMax (www.blitzmax.com)
and have run in to some difficulty. I've taken the "pure C source"
sqlite-source-3_2_2.zip file and mapped the C functions directly to
Max functions (Max produces *.s code and then uses GCC to compile and
link those and any required *.c/*.cpp files together).

I've started with something fairly simple - opening and closing a database.
---
rc = sqlite3_open("test.db", db)
If Not rc=SQLITE_OK
    Print("Can't open database "+rc)
    sqlite3_close(db)
    End
Else
    Print("Opened: "+rc)
EndIf

Print("Errcode: "+sqlite3_errcode(db))

Print("Closing: "+sqlite3_close(db))
---

That produces the following:
---
Opened: 0
Errcode: 21
Closing: 21
---

So sqlite3_open() is returning sucessfully (the file test.db is
created) but a call to any other sqlite function returns 21
(SQLITE_MISUSE).

I'm still probing around and the problem's almost certainly with the
way Max shares its variables with C code, but from what I can tell of
SQLite, this sort of thing shouldn't happen in a single threaded app.
Maybe someone can make a more informed guess as to why this is
happening?

It seems a little strange that this should happen at all - surely
sqlite3_open() should return 21 as well if there's a problem?

Thanks in advance.

James

Reply via email to