| |
| |
| |
|
Page: 1 2 3
Comments:
<0> mysqlexec $db_handle $sql <0> change that to <1> i still see on the console [14:29] Tcl error [quote_add]: mysqlexec/db server: Duplicate entry 'test.1' for key 2 <0> if {[catch {mysqlexec $db_handle $sql} error]} {puts $error} else {puts $error} <2> [GRiMMY]: #308 (stdout) can't read "db_handle": no such variable <1> k <0> catch? <3> catch -> http://www.tcl.tk/man/tcl8.4/TclCmd/catch.htm <1> nothing <1> still shows in the console, but doesn't echo to the channel <0> dunno <0> i'm kinda busy so in an out of irc <1> ok <1> cool, thanks for the help <1> i think what's happening is its exiting the proc before it even reaches the pust $error <1> when `mysqlexec $db_handle $sql` hits an error, it doesn't return a 0
<1> its just returning the Tcl error msg and quitting <4> castch it <4> catch <1> if {[catch {mysqlexec $db_handle $sql} error]} {puts $error} else {puts $error} <2> TedSki-: #323 (stdout) can't read "db_handle": no such variable <1> i have that right now <4> ah <0> hehe <0> my terrible code <1> ok, now i'm gettin somewhere <1> now i have this <1> catch {mysqlexec $db_handle $sql} error <2> TedSki-: #330 (283 clicks) Tcl: 1 <0> yeah... <0> same as what was in the if.... <1> right <1> then i just do a if {$error} {putserv "blah"} else {putserv "blah"} <1> and now i get [14:51] Tcl error [quote_add]: expected boolean value but got "mysqlexec/db server: Duplicate entry 'test.1' for " <0> lol <0> you cant do that <1> can't do what? <1> well, now i can do the match right? <0> if {[catch {mysqlexec $db_handle $sql} error]} {putserv "PRIVSMG #chan :$error"} else {putserv "blah"} <1> ok, well we already know that doesn't work <0> ok well everyone with @ or + in this chan knows it does work <0> and th3dge will probably know that too <1> ok, but its not working <0> well your doing something wrong then... <1> i copied your exact statement <0> and replaced it? <1> yes <0> and uploaded the script? <0> and rehashed? <1> of course <0> well you've done something wrong <0> if it still gives you a mysql error in the partyline <1> it doesn't <1> now it just gives nothing <1> nothing to the partyline, nothing to the channel <0> yeah good <0> so whats the problem? <1> umm <1> well, it should still be returning an error <1> to the channel now <0> if {[catch {mysqlexec $db_handle $sql} error]} {putserv "PRIVMSG #chan :worked"} else {putserv "PRIVSMG #chan :didn't work\: $error"} <1> the error still exists... i am still attempting to set a duplicate entry <0> ooops <0> if {[catch {mysqlexec $db_handle $sql} error]} {putserv "PRIVSMG #chan :didn't work\: $error"} else {putserv "PRIVMSG #chan :worked"} <0> i dont actually see your problem <0> that if with catch works perfectly <1> if {[catch {mysqlexec $db_handle $sql} error]} {putserv "PRIVSMG #motorcycles <1> :works"} else {putserv "PRIVMSG #motorcycles :doesnt work"} <1> that line wraps in vi <1> so <1> that doesn't return anything to the channel <1> and no error in the partyline <1> and it should, because i'm still attempting to add a duplicate entry to the db <0> it doesn't say works or doesnt work in channel <1> nope <0> LOL <0> your definately doing alot wrong
<0> that HAS to return one or the other <1> i don't see what i can be doing wrong man <1> well, lets look at this <1> set return [mysqlexec $db_handle $sql] <0> lol <0> you dont have a catch now... <1> if {$result != 1} {putserv "PRIVMSG #motorcycles :error} else {putserv "PRIVMSG #motorcycles :success"} <1> that works except the error catching <1> so, the rest of the script works as far as echoing to the channel <0> DOOD, just copy and paste what i told you to! <1> its this if statement that you gave me that has the error <5> if {[catch {[mysqlexec $db_handle $sql]} error]} { putserv "PRIVSMG #chan :didn't work: $error" } else { putserv "PRIVMSG #chan :worked" } <1> listen, i did <1> you think i didn't, and you keep giving me 'lol' <1> but i'm telling you.. i ****in did <0> ..(0:5:3).. ..TedSki-.. set return [mysqlexec $db_handle $sql] <0> ..(0:6:4).. ..TedSki-.. if {$result != 1} {putserv "PRIVMSG #motorcycles :error} else {putserv "PRIVMSG #motorcycles :success"} <0> that is nothing like what i had? <1> i tried that statement to see if the error was happening somewhere else <1> but its not <1> i'll pastebin exactly what i have right now <0> ok <5> if {![set result [mysqlexec $db_handle $sql]]} { putserv "PRIVSMG #chan :didn't work: $error" } else { putserv "PRIVMSG #chan :worked" } <5> -$error <1> yoe, the thing is i need it to echo the error msg to the channel <1> [GRiMMY]: here's the whole proc http://pastebin.com/507165 <5> if {[catch {mysqlexec $db_handle $sql} err]} { putserv "PRIVMSG #motorcycles :Error while running SQL-cmd: $err" } else { putserv "PRIVMSG #motorcycles :SQL-cmd successful" } <5> ;if {[catch {mysqlexec $db_handle $sql} err]} { putserv "PRIVMSG #motorcycles :Error while running SQL-cmd: $err" } else { putserv "PRIVMSG #motorcycles :SQL-cmd successful" } <2> yoe: #405 (464 clicks) Tcl: <1> yoe, that's what i have now, and it doesn't work <5> should work <1> i know it should work <5> ;if {[catch {mysqlexec $db_handle $sql} err]} { puts "PRIVMSG #motorcycles :Error while running SQL-cmd: $err" } else { puts "PRIVMSG #motorcycles :SQL-cmd successful" } <1> check out that pastebin <2> yoe: #409 (stdout) PRIVMSG #motorcycles :Error while running SQL-cmd: can't read "db_handle": no such variable <0> lol yoe =) <5> ;) <5> TedSki-: try outputing to partyline then <5> maybe the string is too long to output on irc <1> this is the string: [14:29] Tcl error [quote_add]: mysqlexec/db server: Duplicate entry 'test.1' for key 2 <5> you get that with catch? <1> no, that's output to the party line if i use <1> if {![set result [mysqlexec $db_handle $sql]]} { putserv "PRIVSMG #chan :didn't work: $error" } else { putserv "PRIVMSG #chan :worked" } <0> lol <5> if {[catch {mysqlexec $db_handle $sql} err]} { putserv "PRIVMSG #motorcycles :Error while running SQL-cmd: $err" } else { putserv "PRIVMSG #motorcycles :SQL-cmd successful" } <5> try that <5> now <5> or try: <5> if {[catch {mysqlexec $db_handle $sql} err]} { putserv "PRIVMSG #motorcycles :error, [string length $err]" } else { putserv "PRIVMSG #motorcycles :SQL-cmd successful" } <0> rename mysqlexec mysqlexec2; proc mysqlexec {db_handle sql} { catch {mysqlexec2 $db_handle $sql} err; return $error } <0> add that <1> if {[catch {mysqlexec $db_handle $sql} err]} { putserv "PRIVMSG #motorcycles :Error while running SQL-cmd: $err" } else { putserv "PRIVMSG #motorcycles :SQL-cmd successful" } <1> that worked <0> thenuse --> putserv "PRiVMSG #motorcycles :[mysqlexec $db_handle $sql]" <1> maybe it was the fact that we were naming the variable $error ? <1> or maybe sending to to error was sending to to stderr and not stdout? <1> but catch 'catches' stderr, not stdout, right? <5> yes <1> yea, look at that <1> it works with err but not error <1> that's weird, huh? <1> ok, yoe, how bout this one: [string match -nocase $err "mysqlexec/db server: Duplicate entry*"] <1> that should work, right? <1> that should match mysqlexec/db server: Duplicate entry 'test.1' for key 2 <5> try other way around <0> lol <0> i showed you it the other way around TedSki- <0> RTFM <0> contents? <0> content? <1> <0> if {[string match -nocase $::errorInfo "exposed command *"]} {puts $::errorInfo} else { puts ok } <1> you did, huh? <5> ;if {[string match "*Duplicate entry*" $err]} { # Duplicate entries in MySQL-database } <2> yoe: #447 (391 clicks) Tcl:
Return to
#eggtcl or Go to some related
logs:
ice treval #linux-noob #heroin Nuff said, I'm outta this. #freebsd #nhl Kill spid programmatically #nintendo #bsd difference between adept and synaptic
|
|