diff options
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index 0b91928..a101eca 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -89,6 +89,24 @@ proc getColListFromTable {table} { return $all_column_names } +proc SelectColvalueFromTable { table column_of_interest col row_value } { + # select value of 'column_of_interest' from 'table' where 'col'='row_value' + set value {} + set eval_str "SELECT \"$column_of_interest\" FROM \'$table\' WHERE \"$col\"=\"$row_value\"" + set err [catch { + db eval $eval_str v { + set value $v($column_of_interest) + } + } errStat ] + if { $err } { + set msg_text "the following error happen in proc SelectColvalueFromTable while selecting from table $table $errStat" + htmlErrorMsg $msg_text + dbg $msg_text 3 + set $value {} + } + return $value +} + proc doesColumnExists {col table} { if { $col in [getColListFromTable $table] } { return true; @@ -827,23 +845,6 @@ proc htmlFooter {permission_list} { puts "</div>" } -proc SelectColvalueFromTable { table column_of_interest col row_value } { - # select value of 'column_of_interest' from 'table' where 'col'='row_value' - set value {} - set eval_str "SELECT \"$column_of_interest\" FROM \'$table\' WHERE \"$col\"=\"$row_value\"" - set err [catch { - db eval $eval_str v { - set value $v($column_of_interest) - } - } errStat ] - if { $err } { - set msg_text "the following error happen in proc SelectColvalueFromTable while selecting from table $table $errStat" - htmlErrorMsg $msg_text - dbg $msg_text 3 - set $value {} - } - return $value -} proc SelectColValue4User { colname user } { return [SelectColvalueFromTable GradesTable $colname UserName $user] |