Bingo - your encapsulate is exactly what I'm calling a sanitize routine.
On 6/21/12 4:58 PM, Jeremy Nicoll - ml sourceforge wrote: > hakan<[email protected]> wrote: > >> using INSERT INTO table (col1,col2,col3) value( 'value1 ' , NULL , ' >> value3 '); Note! the absent quote surrounding NULL. This works. But is >> hard to achieve when building strings with variables in rexx using INSERT >> INTO table (col1,col2,col3) value( 'value1 ' , 'NULL' , ' value3 '); > > Why is this "hard" to do? It seems to me to be a very precise requirement > and thus easy to code. Surely all you need to do is create a function which > returns the quoted value of all values except .nil (or whatever you use in > your program to represent a null), and return "NULL" otherwise, eg > > stmt = "INSERT INTO table (col1,col2,col3) value(" > stmt = stmt || encapsulate(col1) || "," > stmt = stmt || encapsulate(col2) || "," > stmt = stmt || encapsulate(col3) || ")" > > with something like: > > encapsulate: procedure > use thing > if thing == .nil then return "NULL" > else return quotedvalueof(thing) > > > (apology if syntax is wrong, and I don't know how to do the quoting of a > text value either) > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Oorexx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oorexx-devel
