Can anyone provide a function to sanitize input for a UniData query? Or provide a list of things to remove?
3 Answers
Use CONVERT to drop the single illegal characters all at once, then SWAP to delete the illegal multi-character strings.
Building on the other answers, you get this:
CONVERT ( '"' : "'/[\]^" ) TO "" IN USER.DATA
SWAP "..." WITH "" IN USER.DATA
- 3,019
 - 2
 - 26
 - 29
 
Here's a list of characters reserved by UniQuery:
 " double quote
 ' apostrophe (single quote)
 / forward slash
 [ left square bracket
 \ back slash
 ] right square bracket
 ^ caret
You can write a quick function that takes a string, does a SWAP for each of these characters--you can swap with the ISO 8859-1 decimal code (e.g., ] for ])--and returns the sanatized string.
- 20,737
 - 24
 - 82
 - 111
 
In addition to Rob Sobers answer also look for triple .'s/ These can be used as wildcards depending on the mode you are running in, much the same as [ and ].
EDIT for the comment:
I haven't got an instance in front of me to test this in, but I believe you can change it by explicitly setting the ECLTYPE to 'P' in the 'UOLOGIN' paragraph in the VOC file.
UOLOGIN is like LOGIN. It is called when a session is first created. The difference being that UOLOGIN is called for UniObjects sessions
- 41,220
 - 11
 - 99
 - 130
 
- 
                    How do you change the UniObjects.NET mode from using ... to using [ and ] ? – thames Jul 08 '11 at 19:58
 - 
                    Probably best to post that as a separate question? – Dan McGrath Jul 09 '11 at 02:08
 - 
                    :) Asked: http://stackoverflow.com/questions/6632702/how-do-you-change-the-uniobjects-net-mode-from-using-to-using-and – thames Jul 09 '11 at 04:26