Testing date values with HSQLDB

三世轮回 提交于 2019-12-11 10:11:36

问题


We use SQLServer in production, but HSQLDB for our integration tests. HSQLDB is used because it's an in-memory database.

I have an SQLServer SQL that executes the following code:

select convert(varchar(8), pos_val_date, 112) 
from wscpos;

In HSQLDB, this does not work. The code should be:

select to_char( pos_val_date, 'YYYYMMDD')
from wscpos;

What's the best practice to adapt my code such that it runs both in production and in my integration test?


回答1:


If you are inclined to change your DB for integration tests, I would recommend to adopt H2 using MODE=MSSQLServer which should provide a better compatibility against MS SQL Server, better than what HSQLDB gives you now.



来源:https://stackoverflow.com/questions/34813537/testing-date-values-with-hsqldb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!