I haven't seen this one, so I thought I'd throw it in:

* use "~" within the VAR instead of "\" to code everything inline
VAR = \mysql --user username -e "LOAD DATA infile
'/mnt/mount/FILE.TXT' REPLACE INTO TABLE database.updates FIELDS
TERMINATED BY ',' LINES TERMINATED BY '~n' (Emailaddress, Reference)
SET UpdateType = 'D', DateAdded = current_timestamp(); LOAD DATA
infile '/mnt/mount/FILE.TXT' REPLACE INTO TABLE database.updates
FIELDS TERMINATED BY ',' LINES TERMINATED BY '~n' (Emailaddress,
Reference) SET UpdateType = 'A', DateAdded = current_timestamp();"
database\

* convert so "~n" becomes "\n"
CONVERT "~" TO "\" IN VAR

* we'll wrap the command in double quotes when executing SH -c,
* so we need to double them within VAR
EQU DQ TO '"'
VAR = CHANGE(VAR, DQ, DQ:DQ)

* now execute the shell command wrapped in double quotes
EXECUTE "SH -c ":DQUOTE(VAR)


*NOTE* in testing it seems "\n" in the VAR string may be changed by SH
-c into "n", so look out for that behavior on your system.
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to