Great, thanks to Thomas' suggestion, I have implemented a fix for this.
On 2013-08-12 19:18, Thomas Mueller wrote:
Hi,
There is Database.getModificationMetaId(), which should return a
different value whenever there was a change in the metadata. Maybe
this could be used to ensure the cache statement can / cannot be re-used.
Regards,
Thomas
On Mon, Aug 12, 2013 at 11:00 AM, Noel Grandin <[email protected]
<mailto:[email protected]>> wrote:
I was on 168, but testing with 173 gives the same error. Below is
a test class and the output I get when I run it.
Ah, thanks, that helped a lot. I have a working test case now:
private void testClearingCacheWithTableStructureChanges()
throws Exception {
Connection conn =
getConnection("queryCache;QUERY_CACHE_SIZE=10");
assertThrows(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1,
conn).prepareStatement("SELECT * FROM TEST");
Statement stat = conn.createStatement();
stat.executeUpdate("CREATE TABLE TEST(col1 bigint, col2
varchar(255))");
PreparedStatement prep = conn.prepareStatement("SELECT *
FROM TEST");
prep.close();
stat.executeUpdate("DROP TABLE TEST");
assertThrows(ErrorCode.TABLE_OR_VIEW_NOT_FOUND_1,
conn).prepareStatement("SELECT * FROM TEST");
conn.close();
}
But no idea how to fix it easily.
The problem is that the cache lives in Session, which logically
above the layers that know about changes in metadata.
I'll think further on this, but I don't expect to have a solution
quickly.
--
You received this message because you are subscribed to the Google
Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to [email protected]
<mailto:h2-database%[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google
Groups "H2 Database" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.