If I have a String I'm happy and I like to use it in a string that uses single quotation marks (‘), then I need to escape the quotation mark in the string.
In most of the time this is done by doing something I call “backslash escape”: Just prefix the quotation mark with a backslash: 'I\'m happy'. Other people seem to do this too: If I enter “backslash escape” on google lots of pages show up that explain the technique. Descriptive term, perfect.
But for example in SQL you’d write 'I''m happy'. Is there a term for that? How to call that? Judging by google search results “repeat-the-quotation-mark-escape” is very unpopular: It just gives a bunch of unrelated stuff.
EDIT: Reading from the comments I believe I need to explain more why I am asking:
My current Java code has a method that escape strings using the mentioned principle. I need to give the method a descriptive name. Of course I could call it “sqlEscape”, but it’s not really the invention of SQL… Just calling the method plain “escape” does not give any hints on exactly how the method escapes the string…
The escaping that you need to accomplish is for the purpose of using the data with SQL. In the absence of a good word for the “what,” my opinion (somewhat heretical) is that your method name can communicate the “why.” So a method named escapeForSQL() would be acceptable to me.
Of course, all we’re really doing is doubling the single quotes; we’re not doing any other escaping. So doubleUpTicks() or doubleUpSingleQuotes() would work for me, too.