Hi,
I'm pretty new in tcl. I made the following proc log_event. There are three parameters passed: "msgid, state and status".
When I called "log_event dkflj fjlksd fdjls",
the script doesn't treat the parameter as variables! I appreciate if anyone can shed a light on it.
mysql> select * from logging;
+----+--------+--------+---------+------------+
| id | MID | STATE | STATUS | DATE |
+----+--------+--------+---------+------------+
| 51 | $msgid | $state | $status | 2011-08-29 |
+----+--------+--------+---------+------------+
----------------------------------------------------------
#!/cygdrive/c/Tcl/bin/tclsh
proc log_event {msgid state status} {
package require mysqltcl
global mysqlstatus
set port {3306}
set host {localhost}
set user {root}
set password {gofish}
set db {event_logging}
set handler [mysqlconnect -host $host -port $port -user $user -password $password -db $db]
mysqlexec $handler {insert into logging(mid,state,status,date) values('$msgid','$state','$status',now())}
set query [mysqlsel $handler {select * from logging} -flatlist]
puts $query
mysqlclose $handler
}
log_event dkflj fjlksd fdjls
----------------------------------------------------------------
$ ./2.tcl
51 {$msgid} {$state} {$status} 2011-08-29
I'm pretty new in tcl. I made the following proc log_event. There are three parameters passed: "msgid, state and status".
When I called "log_event dkflj fjlksd fdjls",
the script doesn't treat the parameter as variables! I appreciate if anyone can shed a light on it.
mysql> select * from logging;
+----+--------+--------+---------+------------+
| id | MID | STATE | STATUS | DATE |
+----+--------+--------+---------+------------+
| 51 | $msgid | $state | $status | 2011-08-29 |
+----+--------+--------+---------+------------+
----------------------------------------------------------
#!/cygdrive/c/Tcl/bin/tclsh
proc log_event {msgid state status} {
package require mysqltcl
global mysqlstatus
set port {3306}
set host {localhost}
set user {root}
set password {gofish}
set db {event_logging}
set handler [mysqlconnect -host $host -port $port -user $user -password $password -db $db]
mysqlexec $handler {insert into logging(mid,state,status,date) values('$msgid','$state','$status',now())}
set query [mysqlsel $handler {select * from logging} -flatlist]
puts $query
mysqlclose $handler
}
log_event dkflj fjlksd fdjls
----------------------------------------------------------------
$ ./2.tcl
51 {$msgid} {$state} {$status} 2011-08-29