Re: [h2] Implementation of RANK function

2018-01-29 Thread Boris Granveaud
share the complete code. > > Dhaval > > > On Thursday, July 21, 2016 at 12:59:21 AM UTC+5:30, Boris Granveaud wrote: >> >> hum it sounds not easy to implement, at least for me because it requires >> significant changes in Select / Parser. >> >> in the

[h2] problem with union all / order by / wrapping select

2016-12-05 Thread Boris Granveaud
Hello, I have an unexpected result with this request (tested with H2 1.4.193, it works fine with Oracle): create table test(id number(5)); insert into test values(1); insert into test values(2); (select id from test union all select id from test ) order by id; ID

[h2] SELECT * FROM (SELECT ? FROM DUAL) fails

2016-11-17 Thread Boris Granveaud
Hello, I have a problem with the following statement: SELECT * FROM (SELECT ? FROM DUAL) it gives this error with H2 1.4.191: org.h2.jdbc.JdbcSQLException: Unknown data type: """?1"""; SQL statement: SELECT * FROM (SELECT ? FROM DUAL) [50004-192] at

Re: [h2] Implementation of RANK function

2016-07-20 Thread Boris Granveaud
hum it sounds not easy to implement, at least for me because it requires significant changes in Select / Parser. in the meantime, I have finished a first working implementation which builds a new query by picking elements from the main request. The main drawback is that the query is built in

[h2] Implementation of RANK function

2016-07-14 Thread Boris Granveaud
Hello, I'm trying to implement Oracle RANK function (the analytical version, see https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions123.htm). This is my first try at modifying H2 sources, so I'm not familiar with its internals. I'm working with the following testcase: create

Possible to filter SQL statements before execution?

2012-07-30 Thread Boris Granveaud
Hello, Is there a mean to set a filter class to transform SQL statements on-the-fly before execution? I'm using MySQL as a main DB and H2 for unit tests and I'm stuck by SQL compatibility problems. My idea is to replace for example DROP TEMPORARY TABLE by DROP TABLE, or CREATE TABLE (...)

COUNT(DISTINCT several columns) doesn't work?

2012-02-07 Thread Boris Granveaud
Hello, I'm struggling with another statement so that it works unchanged on MySQL 5.1 and H2 1.3.164: MySQL: SELECT DISTINCT p.s_id,p.edition FROM publication p = OK SELECT COUNT(DISTINCT p.s_id,p.edition) FROM publication p = OK H2: SELECT DISTINCT p.s_id,p.edition FROM publication p = OK

MySQL date functions

2012-02-06 Thread Boris Granveaud
Hello, I need to be able to execute MySQL statements on H2 for my unit tests. And I'm blocked by the DATE_ADD(...) function. I tried to define my own function in Java like this: public class H2Functions { public static Date dateAdd(Date date, String expr) { ... } }

Re: resultSet.getObject(tableAlias.column) doesn't work

2011-11-16 Thread Boris Granveaud
Very strange. I've used MySQL 5.1.49 for my tests and Connector/J 5.0.8 and 5.1.18. Did you test with an InnoDB table? I can send you my test project if you want. Anyway, from what I understand after googling about this problem, this is not in the specifications so this behavior is not consistent

resultSet.getObject(tableAlias.column) doesn't work

2011-11-12 Thread Boris Granveaud
Hello, I would like to handle result sets with duplicate column names by using resultSet.getXXX(tableAlias.column). This seems to work with MySQL but not with H2: CREATE TABLE users ( id int NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, PRIMARY KEY (id) ) INSERT INTO users

MySQL multi-table delete

2011-06-30 Thread Boris Granveaud
Hello, I'm using H2 in embedded mode to execute unit tests, but my production DB is MySQL. Everything works fine except that some SQL statements which work with MySQL don't with H2. This is the case of the multi-table delete: http://dev.mysql.com/doc/refman/5.0/en/delete.html Multiple-table