<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Enum to Int Conversion in MySQL</title>
	<atom:link href="http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/</link>
	<description>stuff and things, according to Mike Morgan</description>
	<lastBuildDate>Thu, 20 Jan 2011 06:10:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: sullivat</title>
		<link>http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/comment-page-1/#comment-5222</link>
		<dc:creator>sullivat</dc:creator>
		<pubDate>Wed, 02 Aug 2006 04:39:48 +0000</pubDate>
		<guid isPermaLink="false">http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/#comment-5222</guid>
		<description>Storing a boolean as an enum with two ints (well, you can only have strings in a mysql enum, but you can pretend they are ints) lets you toggle the value of the bool really cool-like:

&gt; create table mytable ( george enum(&#039;0&#039;, &#039;1&#039;) );
&gt; insert into mytable values (&#039;0&#039;);
&gt; update mytable set george = binary ( george = 1 );
&gt; select * from mytable;
{ &#039;george&#039;: &#039;1&#039; }
&gt; update mytable set george = binary ( george = 1 );
&gt; select * from mytable;
{ &#039;george&#039;: &#039;0&#039; }

By the way, I named the column &quot;George&quot; in honor of George Boole, the inventor of Boolean algebra.

To George:

Thanks.</description>
		<content:encoded><![CDATA[<p>Storing a boolean as an enum with two ints (well, you can only have strings in a mysql enum, but you can pretend they are ints) lets you toggle the value of the bool really cool-like:</p>
<p>&gt; create table mytable ( george enum(&#8217;0&#8242;, &#8217;1&#8242;) );<br />
&gt; insert into mytable values (&#8217;0&#8242;);<br />
&gt; update mytable set george = binary ( george = 1 );<br />
&gt; select * from mytable;<br />
{ &#8216;george&#8217;: &#8217;1&#8242; }<br />
&gt; update mytable set george = binary ( george = 1 );<br />
&gt; select * from mytable;<br />
{ &#8216;george&#8217;: &#8217;0&#8242; }</p>
<p>By the way, I named the column &#8220;George&#8221; in honor of George Boole, the inventor of Boolean algebra.</p>
<p>To George:</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: morgamic</title>
		<link>http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/comment-page-1/#comment-3597</link>
		<dc:creator>morgamic</dc:creator>
		<pubDate>Mon, 19 Jun 2006 16:53:17 +0000</pubDate>
		<guid isPermaLink="false">http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/#comment-3597</guid>
		<description>Say that to my face!</description>
		<content:encoded><![CDATA[<p>Say that to my face!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/comment-page-1/#comment-3596</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Mon, 19 Jun 2006 16:47:47 +0000</pubDate>
		<guid isPermaLink="false">http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/#comment-3596</guid>
		<description>Yeah, it also helps in case you want to have more than 2 boolean states: true, false, maybe, unsure, uncertain, certain, and pretty sure.</description>
		<content:encoded><![CDATA[<p>Yeah, it also helps in case you want to have more than 2 boolean states: true, false, maybe, unsure, uncertain, certain, and pretty sure.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: morgamic</title>
		<link>http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/comment-page-1/#comment-3310</link>
		<dc:creator>morgamic</dc:creator>
		<pubDate>Wed, 14 Jun 2006 08:19:09 +0000</pubDate>
		<guid isPermaLink="false">http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/#comment-3310</guid>
		<description>Wise words, Fred -- will remember that next time I change how a Boolean is stored.  :)</description>
		<content:encoded><![CDATA[<p>Wise words, Fred &#8212; will remember that next time I change how a Boolean is stored.  <img src='http://morgamic.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fred</title>
		<link>http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/comment-page-1/#comment-3299</link>
		<dc:creator>Fred</dc:creator>
		<pubDate>Wed, 14 Jun 2006 04:48:29 +0000</pubDate>
		<guid isPermaLink="false">http://morgamic.com/2006/06/13/enum-to-int-conversion-in-mysql/#comment-3299</guid>
		<description>What I usually do when I convert the data type of a column: I make a new column with the right type, do an update-and-convert command over the whole table, shuffling the old data into the new column. Then once that worked, I remove the old column and rename the new one.

That&#039;s a step more, but it doesn&#039;t give you bad surprises.</description>
		<content:encoded><![CDATA[<p>What I usually do when I convert the data type of a column: I make a new column with the right type, do an update-and-convert command over the whole table, shuffling the old data into the new column. Then once that worked, I remove the old column and rename the new one.</p>
<p>That&#8217;s a step more, but it doesn&#8217;t give you bad surprises.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

