lbehnke / h2database

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

like with an underscore #149

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. connect to the database i have join (1 table, 2 records)
2. use this request : select * from test where code like 'value_%'

What is the expected output? What do you see instead?
I expect result :
value_with_underscore

I have :
value_with_underscore
value-without-underscore

What version of the product are you using? On what operating system, file
system, and virtual machine?
H2 Version : 1.2.123
OS : Windows 7
FS : NTFS
VM : Java JRE 1.6.13

Do you know a workaround?
Yes i need to replace '_' with '\_'.

How important/urgent is the problem for you?
Not really urgent but i cant put H2 in my list like a test database to mock
an oracle database with my production application in ours tools to unit test.

In your view, is this a defect or a feature request?
Defect

Please provide any additional information below.

Original issue reported on code.google.com by ukbarr@gmail.com on 9 Dec 2009 at 10:42

Attachments:

GoogleCodeExporter commented 9 years ago
This is not a bug, in fact, it works as designed.

http://www.h2database.com/html/grammar.html#condition_right_hand_side

"When comparing with LIKE, the wildcards characters are _ (any one character) 
and %
(any characters). The database uses an index when comparing with LIKE except if 
the
operand starts with a wildcard. To search for the characters % and _, the 
characters
need to be escaped. The default escape character is \ (backslash). To select no
escape character, use ESCAPE '' (empty string)."

Original comment by thomas.t...@gmail.com on 11 Dec 2009 at 5:39