Hi,

Yes, if you need to patch H2, most likely that would be
in Value.getHigherOrder and Operation.optimize().

> convert value into a double when convert to integer fails.

For H2, the data type of an expression is usually evaluated at prepare time
(Connection.prepareStatement(...)). For parameters of the form "(1 - ?)",
the evaluation can only happen at execute time, which would be too late
usually. There is an option to flag prepared statements as "always
re-compile" that could potentially be used here. So far the flag was mainly
used to re-compile queries containing "... LIKE ?", because depending on
the data an index could be used or not - and using an index is really
important. The flag is Prepared.prepareAlways. I'm not sure if it's a good
idea to use the flag to allow late evaluation of the data type however.

Regards,
Thomas


On Thursday, June 28, 2012, Vinod wrote:

> I understand that my queries are more inclined towards oracle side as we
> have been using that. Now we are trying to execute dual queries in memory
> using H2.
> Also as there are thousands of existing queries, so it will not be
> feasible to changes those and perform testing again.
> For newly added queries, yes I can use as per your suggestion of using 1.0.
>
> For now, the only thing that is going to work is patching the code.
> Can you please give me some pointers for making this change to convert
> value into a double when convert to integer fails.
>
> Thanks,
> Vinod
>
> On Wednesday, June 27, 2012 3:50:59 PM UTC-4, Thomas Mueller wrote:
>>
>> Hi,
>>
>> > I am sure, that I will not be able to modify these queries.
>>
>> If you write code that only works with Oracle and no other database,
>> then well, you need to use Oracle. It seems only Oracle works they way
>> you want it, and no other database I have tested (PostgreSQL, Apache
>> Derby, HSQLDB, H2). It is not my plan to make H2 100% compatible with
>> Oracle.
>>
>> If you know that you want to calculate with a given precision, you
>> should use that precision in the calculation. In your case that seems
>> to be (1.0 - ?) and not (1 - ?). That way the database knows it's a
>> decimal when compiling (preparing) the statement.
>>
>> Regards,
>> Thomas
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/39TOUQlhi8wJ.
> 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