Problems with escaping table and field names in Derby and Hsqldb

◇◆丶佛笑我妖孽 提交于 2019-12-01 06:56:29

So kudos to Bryan for leading me down the path although his answer wasn't quite right.

Turns out that because I am creating the database as "footable" then, as Bryan states, it will be create case sensitively. However, when I did the select on footable (without quotes) Derby and Hsqldb are promoting it to be all uppercase so I'm in effect doing:

SELECT * FROM FOOTABLE

It's not about being case insensitive without the quotes (which would have worked) but about promoting the entity names to be all capitals when there are no quotes and then matching by case. I'd argue there was a bug here...

In any case, I've changed my Derby and Hsqldb to capitalize all entity names in ORMLite and things are working. Ugly IMO, but working.

You just have to make sure that the case matches.

So if it's:

create table "Footable" ("Stuff" varchar (25))

Then it has to be:

insert into "Footable" ("Stuff") values 'hi mom'

If the table/column name is in double quotes, the case is preserved as is.

If the table/column name is not in double quotes, then Derby handles it insensitive to case.

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