- Timestamp:
- 2008-05-28T14:14:53+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/dbutil.pm
r15746 r15747 233 233 my $infodb_map = shift(@_); 234 234 235 # Add the key -> value mapping into the "data" table 235 236 my $infodb_entry_value = ""; 236 237 foreach my $infodb_value_key (keys(%$infodb_map)) … … 242 243 } 243 244 245 print $infodb_handle "DELETE FROM data WHERE key='" . &sqlite_safe($infodb_key) . "';\n"; 246 print $infodb_handle "INSERT INTO data (key, value) VALUES ('" . &sqlite_safe($infodb_key) . "', '" . &sqlite_safe($infodb_entry_value) . "');\n"; 247 } 248 249 250 sub sqlite_safe 251 { 252 my $value = shift(@_); 253 244 254 # Escape any single quotes in the value 245 $infodb_entry_value =~ s/\'/\'\'/g; 246 247 print $infodb_handle "DELETE FROM data WHERE key='" . $infodb_key . "';\n"; 248 print $infodb_handle "INSERT INTO data (key, value) VALUES ('" . $infodb_key . "', '" . $infodb_entry_value . "');\n"; 255 $value =~ s/\'/\'\'/g; 256 257 return $value; 249 258 } 250 259
Note:
See TracChangeset
for help on using the changeset viewer.