Page 1 of 1

DatabaseQuery() could close previous query.

Posted: Fri Mar 01, 2024 3:44 pm
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

Re: DatabaseQuery() could close previous query.

Posted: Fri Mar 01, 2024 4:40 pm
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().

Re: DatabaseQuery() could close previous query.

Posted: Fri Mar 01, 2024 9:42 pm
by swhite
Thank-you that is very useful information to know. Can this be added to the documentation for the DatabaseQuery() function?

Simon