Hi,

Caching or results can be disabled by appending ;QUERY_CACHE_SIZE=0 to the
database URL.

There is a flag: Parser.recompileAlways. If set, statements are always
re-compiled. The flag is set for example if the query contains "like"
conditions or non-deterministic method calls (see the source code). I guess
you could extend that, so that if a table of a certain kind is used within
the query, the flag is set in any case. I guess the database will still
cache the result, you would need to change that part as well.

To truncate tables after running a statement, there is the (currently
undocumented) syntax "create table test(id int) on commit delete rows" /
"on commit drop". Maybe this is useful, even thought it is not much tested
so far.

Regards,
Thomas



On Monday, July 16, 2012, Atul wrote:

> Hi -
>
> I'm extending RegularTable to surface some complex object graphs in a
> query-friendly JDBC-compliant form (H2).
>
> Once the select statement (query) is issued against H2, a "before
> select trigger" populates the table for what's being requested, sends
> it to the user and then truncates the table.  So, my datasets are
> short-lived, or just for the duration of the resultset being sent.
>
>
> My question: I want the same query to always do a NEW prepare and NOT
> utilize any type of caching.  I noticed that on a fresh start of H2,
> new queries are received at Select.prepare().  Subsequent queries do
> NOT make it to this method, as I assume they're cached.
>
> How do I disable this type of caching or have my query interpreted in
> Select.prepare() every time?
>
> Thanks in advance -
>
> AC
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to