DatabaseQuery() could close previous query.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
swhite
Enthusiast
Enthusiast
Posts: 789
Joined: Thu May 21, 2009 6:56 pm

DatabaseQuery() could close previous query.

Post by swhite »

Hi

I would like to suggest that the DatabaseQuery() function automatically does a FinishDatabaseQuery() before executing the new query. This would make database programming safer in that the programmer would only have to be responsible to execute FinishDatabaseQuery() on the last query for any connection.

In complicated database application with various procedures making database queries it can at times be difficult to ensure that you have not left a query open especially when the same query is needed in multiple procedures. I have spent a lot of time reviewing my database applications to ensure that each query is closed and it challenging at times due to the complexities of the application.

Thanks,
Simon
Simon White
dCipher Computing
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: DatabaseQuery() could close previous query.

Post by Fred »

It's already the case, it's automatically closed if DatabaseQuery() is called again. That said, it's much better to release the resource just after the use with FinishDatabaseQuery().
swhite
Enthusiast
Enthusiast
Posts: 789
Joined: Thu May 21, 2009 6:56 pm

Re: DatabaseQuery() could close previous query.

Post by swhite »

Thank-you that is very useful information to know. Can this be added to the documentation for the DatabaseQuery() function?

Simon
Simon White
dCipher Computing
Post Reply