<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/10916" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2005-12-28T04:50:07-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/10916</id>

		<entry>
		<author><name><![CDATA[demond]]></name></author>
		<updated>2005-12-28T04:50:07-04:00</updated>

		<published>2005-12-28T04:50:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=58736#p58736</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=58736#p58736"/>
		<title type="html"><![CDATA[mysqltcl scripting questions: how to catch an exception?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=58736#p58736"><![CDATA[
[mysqlexec] returns the number of affected rows<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5056">demond</a> — Wed Dec 28, 2005 4:50 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tami]]></name></author>
		<updated>2005-12-01T00:05:31-04:00</updated>

		<published>2005-12-01T00:05:31-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=57858#p57858</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=57858#p57858"/>
		<title type="html"><![CDATA[mysqltcl scripting questions: how to catch an exception?]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=57858#p57858"><![CDATA[
hi, <br><br>i succesfully migrated an old script using tcl-sql to mysqltcl (and <a href="http://forum.egghelp.org/viewtopic.php?t=7112&amp;postdays=0&amp;postorder=asc&amp;highlight=package+require+mysqltcl&amp;start=0" class="postlink">this</a> post was extremely helpful in that migration.<br><br>now i'm wishing to go to the next step.<br><br>i want to catch exceptions.<br><br>say i want to delete something from the database.  however, that deleted item does not exist to begin with.  how would i handle that?<br><br>i'd want the eggdrop to catch this error and display the output to a channel.<br><div class="codebox"><p>Code: </p><pre><code>mysqlexec $mysql(conn) "delete from world where country = \"$country\"</code></pre></div> <br><br>if $country is not in the world table, then the database will process the information as such:<br>Query OK, 0 rows deleted.<br><br>how can i actually validate this output?  <br><br>this basically leads me to trying to get the script to just find out what happens to the database afterwards.  i know that in tcl-sql, i used something along these lines:<br><div class="codebox"><p>Code: </p><pre><code>set verifydelete [ catch {    sql exec $conn "delete from world where country = \"$country\"} msg]if { $verifydelete != 0 } {    putserv "PRIVMSG $chan :ERROR when deleting country!"}else{    # all is good here, no need to have an else statement}</code></pre></div><br>this doesn't work with mysqltcl.  this is also a problem when inserting duplicate entries into the database; i wish to display the output that there's a duplicate entry:<br><div class="codebox"><p>Code: </p><pre><code>set verifyinsert [ catch {    sql exec $conn "insert into world set country = \"$country\"} msg]if { $verifyinsert != 0 } {    putserv "PRIVMSG $chan :ERROR $msg when inserting country!"}else{    # all is good here, no need to have an else statement}</code></pre></div>what other options are available to debug properly?  i guess what i'm essentially asking for is return codes and such and also how to catch those error messages, if it wasn't clearer in my post. <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>thanks!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=812">tami</a> — Thu Dec 01, 2005 12:05 am</p><hr />
]]></content>
	</entry>
	</feed>
