• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Q about Mikalai Zaikin Study Notes Ch 9

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In EJB-QL chapter, it is mentioned that:

"aword.underscored LIKE '\_%' ESCAPE '\'" means the following:

"TRUE for '_foo', FALSE for 'bar'"

What does ESCAPE mean here? Please explain this to me.

Thanks
Deep
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You use \ when you want to use _ as actual _ and not _ (for equivalent of any one character)

Escape character is used to use % and _ to match actual % and _ chracateres and not like it's meaning is QL otherwise that is matching single character or macthing none or many characters.

Hope it explains

Gemini
 
Deep Chand
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. So is ESCAPE a keyword in EJB QL? Also, in this example, we are saying that use '_' as _ only and not in EJB-QL sense but use '%' in EJB-QL sense. If we want to use '%' in normal sense then we will have to write something like

'\_\%' ESCAPE '\'

Is that right?

Thanks again
Deep
 
Gemini Moses
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think you need to specify ESCAPE /.
By default / is ESCAPE character in EJB QL.

Your question --
If we want to use '%' in normal sense then we will have to write something like

\%'

And not

'\_\%' ESCAPE '\'

Although

\%' ESCAPE '\'
should work fine. (my guess)

Hope it helps..
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic