google-code-export / h2database

Automatically exported from code.google.com/p/h2database
0 stars 1 forks source link

JDBC driver does not support {fn TIMESTAMPADD(...)} #319

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Before submitting a bug, please check the FAQ:
http://www.h2database.com/html/faq.html

The JDBC driver doesn't support the standard JDBC escape {fn TIMESTAMPADD()}.

This should be supported as it's the only vendor-neutral way to perform date 
arithmetic within the JDBC spec. A vendor that does not support this is out of 
JDBC compliance. Since H2 has a native function for this, {fn TIMESTAMPADD} 
could translate to it if that's the most efficient path to implementation.

What steps will reproduce the problem?
(simple SQL scripts or simple standalone applications are preferred)
1. Try to use {fn TIMESTAMPADD}
2. Watch it fail
3.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system, file
system, and virtual machine?

Do you know a workaround?

What is your use case, meaning why do you need this feature?

How important/urgent is the problem for you?

Fairly urgent, there are a number of our unit tests that we can't enable 
without this.

Please provide any additional information below.

Original issue reported on code.google.com by nathan.b...@plusgrade.com on 13 May 2011 at 10:29

GoogleCodeExporter commented 9 years ago
Well, "it's the only vendor-neutral way" is relative... I see MySQL and IBM DB2 
seem to support it, but not PostgreSQL, Oracle, MS SQL Server, Apache Derby, or 
HSQLDB. Or did I make a mistake?

Anyway, I can add it to the roadmap, however I will not implement it in the 
near future unless other people request it as well.

Original comment by thomas.t...@gmail.com on 18 May 2011 at 7:19

GoogleCodeExporter commented 9 years ago
HSQL has it. Actually I don't know about Oracle. Sorry...

Original comment by nathan.b...@plusgrade.com on 18 May 2011 at 7:23

GoogleCodeExporter commented 9 years ago
Derby has it. I'd be a bit surprised if Oracle didn't - vendors typically 
support this in the JDBC driver rather than the server.

Original comment by nathan.b...@plusgrade.com on 18 May 2011 at 7:52

GoogleCodeExporter commented 9 years ago
> HSQLDB has it

I read that in the documentation at http://hsqldb.org/web/features200.html, but 
it doesn't work for me with version 2.1.0:

call {fn TIMESTAMPADD(day, 1, now())}
user lacks privilege or object not found: TIMESTAMPADD 42501/-5501

Original comment by thomas.t...@gmail.com on 19 May 2011 at 4:56

GoogleCodeExporter commented 9 years ago
Probably won't work when you treat it as a stored proc that way - you'll 
probably need to do something more like

select {fn TIMESTAMPADD(SQL_TSI_DAY, 1,now )} from foo

You may be right that Oracle doesn't have this, from what I could glean from 
the documentation...

Original comment by nathan.b...@plusgrade.com on 19 May 2011 at 2:25

GoogleCodeExporter commented 9 years ago
This will be supported in the next release.

Original comment by thomas.t...@gmail.com on 27 May 2011 at 10:07

GoogleCodeExporter commented 9 years ago
This is fixed in version 1.3.155

Original comment by thomas.t...@gmail.com on 27 May 2011 at 10:55