- This topic has 3 replies, 4 voices, and was last updated 14 years, 10 months ago by .
-
Topic
-
I want to format a comma separated variable with double quotes for input to a sqlite table. I can do it ok with single quotes but double quotes is giving me a problem.
Code:
proc XltSetRMCOdata {} {
upvar xlateInVals xlateInVals
xlateOutVals xlateOutVals
set msg “‘”
append msg [join $xlateInVals “‘,'”]
append msg “‘”
set dtTm [clock format [clock seconds] -format {%Y-%m-%d %H:%M:%S}]
set sqlcmd “INSERT INTO rm VALUES ($msg,’$dtTm’)”
echo “XltSetRMCOdata >$sqlcmd<" package require sqlite sqlite db /export/quovadx/qdx5.6/integrator/prd/tclprocs/agfa.db if { [catch {db eval $sqlcmd} result] } { echo "$result" } db close }
Input- O’CONNOR,SIOBHAN,,19720215,F,21 WAYFARERS DRIVE,NEWTON LE WILLOWS,MERSEYSIDE,,WA12 8DF,1,NHS,4444458569,99921023
Output
- XltSetRMCOdata >INSERT INTO rm VALUES (‘5878879992102200008000000001′,’000011101′,’587887′,’O’CONNOR,SIOBHAN,,19720215,F,21′,’WAYFARERS’,’DRIVE,NEWTON’,’LE’,’WILLOWS,MERSEYSIDE,,WA12′,”,’8DF,1,NHS,4444458569,99921023′,”,”,”,’99921022′,’3015′,’2009-11-20 11:38:44′)<
I need to use double quotes because of the apostrophes.
Any help appreciated
- The forum ‘Cloverleaf’ is closed to new topics and replies.