Changeset 3624 for trunk/gui/apps
- Timestamp:
- Apr 3, 2013, 5:01:25 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/apps/rptimes
r3507 r3624 39 39 40 40 if {[llength $argv] < 1} { 41 puts stderr "bad option \"$arg\""42 41 puts stderr "USAGE: rptimes run.xml ?run.xml...?" 43 42 exit 1 … … 147 146 } 148 147 return $rlist 148 } 149 150 # ---------------------------------------------------------------------- 151 # USAGE: escapeQuotes <string> 152 # 153 # Escapes single quotes in the given <string> by escaping the quote. 154 # In SQLite, this is done by doubling the quote. This makes it 155 # possible to embed the string in another quoted string like 156 # 'hello ''world'''. Returns a string with escaped quotes. 157 # ---------------------------------------------------------------------- 158 proc escapeQuotes {str} { 159 regsub -all {([^\'])\'} $str {\1''} str 160 return $str 149 161 } 150 162 … … 215 227 set id [format "x%03d" [incr num]] 216 228 217 db eval "INSERT INTO parameters values('$id','$rp',' $def','$type')"229 db eval "INSERT INTO parameters values('$id','$rp','[escapeQuotes $def]','$type')" 218 230 db eval "ALTER TABLE jobs ADD COLUMN $id $type;" 219 231 } … … 232 244 lappend cols $id 233 245 if {$type eq "TEXT"} { 234 lappend vals '$val' 246 lappend vals '[escapeQuotes $val]' 247 } elseif {$val ne ""} { 248 lappend vals $val 235 249 } else { 236 lappend vals $val250 lappend vals '' 237 251 } 238 252 }
Note: See TracChangeset
for help on using the changeset viewer.