When the same SQLair query is executed multiple times against the database it is recompiled by the database every time. This is inefficient.
It is possible to instead prepare a SQL query against the database driver and cache it in SQLair to allow for reuse of the query.
With this change, when a SQLair statement is executed directly against a database it is first prepared and then executed, the prepared statement is put in the cache for reuse. If the statement is executed in a transaction, the SQLair statement is looked up in the cache but if it is not found it is not prepared on the driver. This is due to the issues in #117.
Not too surprising that the times go up slightly. Because of the issue with transactions that meant we couldn't cache their statements Juju does not benefit at all from this caching.
When the same SQLair query is executed multiple times against the database it is recompiled by the database every time. This is inefficient.
It is possible to instead prepare a SQL query against the database driver and cache it in SQLair to allow for reuse of the query.
With this change, when a SQLair statement is executed directly against a database it is first prepared and then executed, the prepared statement is put in the cache for reuse. If the statement is executed in a transaction, the SQLair statement is looked up in the cache but if it is not found it is not prepared on the driver. This is due to the issues in #117.