1. SQLite question

Probably not a Euphoria problem; but, I don't have a clue!
Need an idea here...

I started using sqlite3 about a year ago instead of eds. Windows 10 Euphoria 4.0.5 (362497032f33, 2012-10-11) for Windows

eusqlite3.ew 
-- Version :    0.3 
-- Author :     Ray Smith 
-- License :    None 
-- Updated :    Chris Burch 
-- Updated :    August 2005 Tone Skoda 
 
 
The relevant code:

sequence sql = sprintf("SELECT date,mbr_id,duty,deleted FROM calendar WHERE date >= %d ",start_date) & 
			sprintf("AND date <= %d AND deleted = 0",end_date) 
sequence c_data = sqlite_get_table(db,sql) 

The sqlite query (above) is activated by a gui button. The first button press works as expected. Wait seconds. The next button press yields:

Fatal SQLite Error: 
When Executing: sqlite_get_table("SELECT date,mbr_id,duty,deleted FROM calendar WHERE date >= 20181201 AND date <= 20181231 AND deleted = '0';" 
Error Number: 21 
 
#define SQLITE_MISUSE      21   /* Library used incorrectly */ 

From the SQL manual:
If SQLite ever returns SQLITE_MISUSE from any interface, that means that the application is incorrectly coded and needs to be fixed. 

There are no prepared statements. Every query is sent independently of any other query. It seems to me that I should be able to send any query to the DB, even the same one twice in a row. I don't know thy this happens and therefore don't know what to do about it.

Any thoughts would be appreciated.
Regards,
jd

new topic     » topic index » view message » categorize

2. Re: SQLite question

My guess would be you've done an sqlite_close(db) somewhere.

new topic     » goto parent     » topic index » view message » categorize

3. Re: SQLite question

Mine too. As a test, only open your database at the initialisation of your program phase, and close it a the shutdown. I used to open and close databases left right and centre (it doesn't take long), but it's equally valid just to open and close them once. Also another program can open the database at the same time, but you have to be careful with concurrency when writing from 2 different sources.

Cheers

Chris

new topic     » goto parent     » topic index » view message » categorize

4. Re: SQLite question

petelomax said...

My guess would be you've done an sqlite_close(db) somewhere.

Thanks guys. There is only one close_db() in the program. It's in the quit_it procedure:

public procedure quit_it () 
if db then 
	sqlite_close(db) 
end if 
closeApp()	 
end procedure 
After closing the DB the application is closed immediately so it can't sneak by.
The other thing is that this doesn't always happen. Just often enough to be a nuisance.
Regards, jd

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu