H2 storage implementation
Thanks to @chidaodezhongsheng for PR #1347 which is the storage implementation of ShardingJDBC.
ShardingJDBC is using mysql driver based on the SQL grammar. H2 database also supported it by the JDBC API. I prefer use the ShardingJDBC-Storage-DAO instead of current implementation of H2 storage. We can reduce a lot of development and testing for the H2 storage implementation.
Two ways:
- H2's DAO extends ShardingJDBC's DAO.
- Move ShardingJDBC's DAO into H2's package then make ShardingJDBC's DAO extends H2's DAO
FYI @wu-sheng @chidaodezhongsheng
The question is, whether are ShardingJDBC(MySQL core) and H2 compatible in SQL level?
Compatibility modes for IBM DB2, Apache Derby, HSQLDB, MS SQL Server, MySQL, Oracle, and PostgreSQL. Original
This is the h2's official description.
We can compare the data type and SQL grammar between ShardingJDBC and H2 first. Then make a decision about this finally.
Shardingjdbc support SQL grammar,not support mysql dialect,for example “case when”.I have checked the sqls In h2 storage,Shardingjdbc not support keyword “or” only.
My proposal is, evaluate could use shardingjdbc implementor sql in H2, without change required. @chidaodezhongsheng What do you think?
Shardingjdbc support SQL grammar,not support mysql dialect,for example “case when”.I have checked the sqls In h2 storage,Shardingjdbc not support keyword “or” only.
So I assume if the SQLs in ShardingSphere implementor, it should also work in H2 implementor. Do you know any risk or problem?
I checked the SQLs in H2 implementor, the keyword "or" that Shardingjdbc not support.Besides, it not support read meta data of DB. In Shardingjdbc implementor, I use two sqls instead of the keyword "or". However, I cannot check the column meta data of table, I still not found the instead way.
If so, I prefer to separate the two implementors, don't depend on that. If compatible is not so good, codes will make people think strange.
I have supported H2, MySQL, TiDB in 6-beta release.