diff options
-rwxr-xr-x | GradeBook.tcl | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl index c987032..fed35a8 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -44,6 +44,14 @@ set dbfile "./testdb" sqlite3 db $dbfile +proc ColName2SqlSafeForm {colname} { + set bad_symbols [list {\}} {\{} {\\} {\'} {\"} {\]} {\[} ] + foreach bs $bad_symbols { + regsub -all $bs $colname "" colname + } + return $colname +} + proc AddUserNonWeb { first_name last_name user_name password_hash {group_name {guest}} } { set eval_str [concat INSERT INTO GradesTable (FirstName, LastName, UserName, PasswordHash, GroupName) VALUES('$first_name', '$last_name', '$user_name', '$password_hash', '$group_name')] set err [catch {db eval $eval_str } errStat] |