Is there a way to reset / clear the databaseerror()/
Since it doesn't tell you what db or what query went wrong, if you use multiple databases at once, and if you have an error in one database, "the other" might catch databaseerror()
Another datbaseerror() request
Re: Another datbaseerror() request
How can it happen, do you have an example ? DatabaseError() should only be called when an error occured, you should not rely on it if no error occured.
Re: Another datbaseerror() request
Let's say
THREAD #1
if databasequery(0,"Select * order by id;")
else
debug databaseerror()
endif
Thread #2
if datbasequery(1,"Select * from non-existent table;")
else
debug databaseerror()
endif
If you have these two threads - let's say thread #1 query runs 1st, but right after it thread 2's query is run.
databaseerror() is for the "most recently run error" not the last error on that database.
(If the queries worked off query-handles rather than database handles, the error would be more specific, and then you could run two queries w/o opening a file twice...)
but based on the response, I'm the only one that has seen this sort of thing, so...
THREAD #1
if databasequery(0,"Select * order by id;")
else
debug databaseerror()
endif
Thread #2
if datbasequery(1,"Select * from non-existent table;")
else
debug databaseerror()
endif
If you have these two threads - let's say thread #1 query runs 1st, but right after it thread 2's query is run.
databaseerror() is for the "most recently run error" not the last error on that database.
(If the queries worked off query-handles rather than database handles, the error would be more specific, and then you could run two queries w/o opening a file twice...)
but based on the response, I'm the only one that has seen this sort of thing, so...
Re: Another datbaseerror() request
No, DatabaseError() works by thread, so each thread has its own error string stored. That's why I don't know where the problem is, as what you describe can't happen.
Re: Another datbaseerror() request
OK -- because I got an error that doesn't make sense for where it was caught; but could make sense for an entirely different query... weird.Fred wrote:No, DatabaseError() works by thread, so each thread has its own error string stored. That's why I don't know where the problem is, as what you describe can't happen.
Re: Another datbaseerror() request
Did you enable the threadsafe switch in the compiler options?
quidquid Latine dictum sit altum videtur
Re: Another datbaseerror() request
yes.freak wrote:Did you enable the threadsafe switch in the compiler options?