Home
Products
Community
Manuals
Contact
Login or Signup

Mysql.executeQuery DBMysql

BlitzMax Modules Forums/Brucey's Modules/Mysql.executeQuery DBMysql

Retimer(Posted 1+ years ago) #1
When performing "MyDB.executeQuery", what exactly is occuring? I was under the impression the function waited for a result.

I have about 10 queries performed one after the other in a single function that occurs when the clock hits midnight, however it appears only the first query is occuring..

Ex:


Function ...()
MyDB.executeQuery("<query>")
MyDB.executeQuery("<query2>")
MyDB.executeQuery("<query3>")
MyDB.executeQuery("<query4>")
....etc
End Function



All queries tested and work properly when done in order, but not in this function. Any tips?

Thanks


DavidDC(Posted 1+ years ago) #2
Are you checking MyDB.IsOpen() before and MyDB.HasError() after each query?


Retimer(Posted 1+ years ago) #3
I have a check before every function that performs queries, but not before every query...thanks for pointing out that serious flaw! :)

I'm betting this was the problem - so i'll assume case solved.

Edit: Yep, entirely on my end: The reason it was working with manual queries was because of default schema difference.

Sorry about that


DavidDC(Posted 1+ years ago) #4
Yes it pays to wrap your queries in plenty of cotton wool. You can extend the DB type so it's all automated. And of course if those queries above change the db and are dependant on each other, then wrap the lot in a transaction.


Brucey(Posted 1+ years ago) #5
Sorry for not getting involved sooner... I'm rebuilding everything for 1.35 - which is taking a while (you can't imagine how many modules I've got here :-p )


The modules are designed to "fail quietly" - leaving it up to you to check (with hasError()) whether or not there was a problem running the SQL. Sometimes you don't care if an SQL fails or not.

Of course, I could have thrown exceptions... but some people don't like working to that design.


DavidDC(Posted 1+ years ago) #6
but some people don't like working to that design.

e.g. Me! :-)


Retimer(Posted 1+ years ago) #7
Makes sense....without that design it probobly wouldn't be plausible to use in a realtime setting at all.