<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: MySQL Triggers: How do you abort an INSERT, UPDATE or DELETE with a trigger?</title>
	<atom:link href="http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/</link>
	<description>Databases, code and all things agile.</description>
	<pubDate>Thu, 09 Feb 2012 09:45:10 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Design of mysql DB to avoid having a table with mutually exclusive fields &#124; DEEP in PHP</title>
		<link>http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/#comment-93776</link>
		<dc:creator>Design of mysql DB to avoid having a table with mutually exclusive fields &#124; DEEP in PHP</dc:creator>
		<pubDate>Sat, 12 Mar 2011 15:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/#comment-93776</guid>
		<description>&lt;p&gt;[...] are all the same, so i&#8217;m thinking about using only one table. I&#8217;ve read here and here (even if i don&#8217;t understand fully this example) that i can enforce a mysql rule to have [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] are all the same, so i&#8217;m thinking about using only one table. I&#8217;ve read here and here (even if i don&#8217;t understand fully this example) that i can enforce a mysql rule to have [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Glen Edmonds</title>
		<link>http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/#comment-93651</link>
		<dc:creator>Glen Edmonds</dc:creator>
		<pubDate>Thu, 02 Dec 2010 01:27:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/#comment-93651</guid>
		<description>&lt;p&gt;Here's a much simpler implementation of the hack that doesn't require all that PSQL cruft:&lt;/p&gt;

&lt;p&gt;drop table your_meaningful_message_goes_here;&lt;/p&gt;

&lt;p&gt;This will throw an exception that looks like this:&lt;/p&gt;

&lt;p&gt;ERROR 1051 (42S02): Unknown table 'your_meaningful_message_goes_here'&lt;/p&gt;

&lt;p&gt;At least the user will get the message.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a much simpler implementation of the hack that doesn&#8217;t require all that PSQL cruft:</p>

<p>drop table your_meaningful_message_goes_here;</p>

<p>This will throw an exception that looks like this:</p>

<p>ERROR 1051 (42S02): Unknown table &#8216;your_meaningful_message_goes_here&#8217;</p>

<p>At least the user will get the message.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Liam</title>
		<link>http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/#comment-62841</link>
		<dc:creator>Liam</dc:creator>
		<pubDate>Tue, 22 Apr 2008 06:52:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/#comment-62841</guid>
		<description>&lt;p&gt;Thanks for the assist; coming from PostgreSQL, MySQL triggers and functions seem like a hell of a mess...&lt;/p&gt;

&lt;p&gt;I would say it's the best place to enforce business rules if you want consistent data.  There might be many ways in your application to edit the data in a given table, and you can check things in those many places; or you can enforce it at a database level and then handle that appropriately further up the stack.&lt;/p&gt;

&lt;p&gt;The second way is much more simple and will catch problems even if checks are not followed properly in a piece of application code.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for the assist; coming from PostgreSQL, MySQL triggers and functions seem like a hell of a mess&#8230;</p>

<p>I would say it&#8217;s the best place to enforce business rules if you want consistent data.  There might be many ways in your application to edit the data in a given table, and you can check things in those many places; or you can enforce it at a database level and then handle that appropriately further up the stack.</p>

<p>The second way is much more simple and will catch problems even if checks are not followed properly in a piece of application code.</p>]]></content:encoded>
	</item>
</channel>
</rss>

