aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-04-15 18:18:20 -0400
committerEugeniy Mikhailov <evgmik@gmail.com>2011-04-15 18:18:20 -0400
commit0ffbae198ea0757e7037c7690fb65bc14e487315 (patch)
treec79ee5f0b1ed520d08fb1024d2488dc443b24cde
parent574401ff1c22353e55a58681334f3e8ce257dfce (diff)
downloadGradeBook-0ffbae198ea0757e7037c7690fb65bc14e487315.tar.gz
GradeBook-0ffbae198ea0757e7037c7690fb65bc14e487315.zip
added general procedure to select a given value from a table
Ignore-this: 40c7e8c8a7048184620c01918ed31ed5 darcs-hash:20110415221820-067c0-11a111938eb4b5085d32ff36c4766fb23a939408.gz
-rwxr-xr-xGradeBook_lib.tcl17
1 files changed, 11 insertions, 6 deletions
diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl
index ddc3476..f534c84 100755
--- a/GradeBook_lib.tcl
+++ b/GradeBook_lib.tcl
@@ -795,23 +795,28 @@ proc htmlFooter {permission_list} {
puts "</div>"
}
-
-proc SelectColValue4User { colname user } {
+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 \"$colname\" FROM GradesTable where UserName=\"$user\""
+ set eval_str "SELECT \"$column_of_interest\" FROM \'$table\' WHERE \"$col\"=\"$row_value\""
set err [catch {
db eval $eval_str v {
- set value $v($colname)
+ set value $v($column_of_interest)
}
} errStat ]
if { $err } {
- htmlErrorMsg $errStat
- dbg "the following error happen: $errStat" 3
+ 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]
+}
+
proc ClassInfoHtml {} {
set CourseTitle [SelectItemFromCourseInfoTable course_title]
set CourseYear [SelectItemFromCourseInfoTable course_year]