<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ramblings</title>
	<atom:link href="http://www.flamingspork.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flamingspork.com/blog</link>
	<description>Ramblings which occasionally resemble reality. This is the blog of Stewart Smith.</description>
	<lastBuildDate>Thu, 04 Feb 2010 06:41:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Anti-anti-features: region coding</title>
		<link>http://www.flamingspork.com/blog/2010/02/04/anti-anti-features-region-coding/</link>
		<comments>http://www.flamingspork.com/blog/2010/02/04/anti-anti-features-region-coding/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 06:41:13 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[antifeatures]]></category>
		<category><![CDATA[blueray]]></category>
		<category><![CDATA[dvd]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1790</guid>
		<description><![CDATA[DVD anti-features are rather well documented. The purpose of &#8220;region coding&#8221; was to make sure that everybody who ever visited a foreign country and picked up some DVDs while there would get home to find out that they wouldn&#8217;t work.
Luckily, those of us who pay good money for DVDs have free software solutions to let [...]]]></description>
			<content:encoded><![CDATA[<p>DVD anti-features are rather well documented. The purpose of &#8220;region coding&#8221; was to make sure that everybody who ever visited a foreign country and picked up some DVDs while there would get home to find out that they wouldn&#8217;t work.</p>
<p>Luckily, those of us who pay good money for DVDs have free software solutions to let us used our payed for product and not force us to download &#8220;pirated&#8221; copies just so we can view <strong>what we payed for</strong>.</p>
<p>The region coding in DVDs was designed with the idea that DVD players would always be expensive. You could &#8220;change&#8221; which region your DVD player was in a set number of times before you could no longer change it.</p>
<p>DVD players can now be bought for $30 (or less). This is what you could pay for a DVD movie. So with economies of scale driving prices down, even if CSS wasn&#8217;t completely broken, you can brute force the region coding by just buying 6 DVD players ($180) &#8211; less than many of us payed for our first, second or third DVD player.</p>
<p>The same thing will happen with BluRay. You can now get BluRay players for a couple of hundred dollars. One for each of the regions (A, B and C) will cost you less than original BluRay players cost.</p>
<p>So the antifeature of limiting who can watch a DVD/BluRay release is easily broken as player costs come down.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/02/04/anti-anti-features-region-coding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Anti-anti-features: copyright notices</title>
		<link>http://www.flamingspork.com/blog/2010/02/03/anti-anti-features-copyright-notices/</link>
		<comments>http://www.flamingspork.com/blog/2010/02/03/anti-anti-features-copyright-notices/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 06:41:08 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1788</guid>
		<description><![CDATA[Mako has often talked very well about anti-features. The &#8220;features&#8221; in software that nobody wants and often cost money to do the easier task of not including the feature. Examples include the non-skip parts of DVDs and BluRay Discs (see here for more).
I&#8217;d like to coin a new term&#8230; anti-anti-features. These are antifeatures (i.e. a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mako.cc/">Mako</a> has <a href="http://www.fsf.org/blogs/community/antifeatures">often</a> <a href="http://mako.cc/copyrighteous/20090624-00">talked</a> <a href="http://mako.cc/copyrighteous/20091118-00">very</a> well about <a href="http://wiki.mako.cc/Antifeatures">anti-features</a>. The &#8220;features&#8221; in software that <strong>nobody wants </strong>and often cost money to do the easier task of not including the feature. Examples include the non-skip parts of DVDs and BluRay Discs (see <a href="http://wiki.mako.cc/Antifeatures">here</a> for more).</p>
<p>I&#8217;d like to coin a new term&#8230; anti-anti-features. These are antifeatures (i.e. a feature you didn&#8217;t want in the first place) doesn&#8217;t actually function properly itself.</p>
<p>The other day, I sat down with a friend to watch a movie. We had hired out a BluRay of a recently released movie, popped it in the player and attempted to hit &#8220;Pause&#8221;. Why pause? Well&#8230; movies often can auto-play and we wanted to fetch a beer, snack and otherwise prepare for the great movie watching experience.</p>
<p>It turns out <strong>you cannot pause the copyright notice</strong>. So if you&#8217;re trying to be good and understand your obligations under the license in which you have received this disc, you cannot actually finish reading them!</p>
<p>Try it &#8211; put in a DVD or BluRay and try to read the copyright notice. I bet you that for a large number of discs you cannot do so in the time allowed.</p>
<p>This just goes to show how utterly useless these &#8220;no skip&#8221; zones are. You will see hundreds of <strong>exactly the same</strong> notice (one for each disc you view) many, many times (each time you view it) &#8211; one would think that after the first, second, third or even 10th time you&#8217;d understand it.</p>
<p>Amazingly, under DVD playback software that lets you skip the &#8220;no skip&#8221; zones (e.g. every DVD player on Linux) it also allows you to pause on the copyright notice and read it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/02/03/anti-anti-features-copyright-notices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>H.264 Anti-features</title>
		<link>http://www.flamingspork.com/blog/2010/02/03/h-264-anti-features/</link>
		<comments>http://www.flamingspork.com/blog/2010/02/03/h-264-anti-features/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 06:28:33 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[life, the universe and everything]]></category>
		<category><![CDATA[antifeatures]]></category>
		<category><![CDATA[freedom]]></category>
		<category><![CDATA[h.264]]></category>
		<category><![CDATA[ogg]]></category>
		<category><![CDATA[theora]]></category>
		<category><![CDATA[vorbis]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1786</guid>
		<description><![CDATA[No, You Can&#8217;t Do That With H.264 is an excellent write up of how H.264 (&#8220;MPEG-4&#8243;) is fraught with problems that you just would not have if using Free (as in Freedom) formats such as Ogg Vorbis and Theora.
It is amazing that Final Cut &#8220;Pro&#8221; cannot actually be used to create H.264 content for commercial [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bemasc.net/wordpress/2010/02/02/no-you-cant-do-that-with-h264/">No, You Can&#8217;t Do That With H.264</a> is an excellent write up of how H.264 (&#8220;MPEG-4&#8243;) is fraught with problems that you just would not have if using Free (as in Freedom) formats such as Ogg <a href="http://www.vorbis.com">Vorbis</a> and <a href="http://www.theora.org/">Theora</a>.</p>
<p>It is amazing that Final Cut &#8220;Pro&#8221; cannot actually be used to create H.264 content for commercial (i.e. &#8220;Pro&#8221;) use!</p>
<p>It&#8217;s the same for MPEG-2.</p>
<p>Oh, and if you use it to <strong>decode</strong> video that was encoded by somebody without the proper license&#8230; well, then you&#8217;re also screwed. How the heck you&#8217;re meant to work that one out I have no idea.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/02/03/h-264-anti-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NDB$INFO with SQL hits beta</title>
		<link>http://www.flamingspork.com/blog/2010/02/03/ndbinfo-with-sql-hits-beta/</link>
		<comments>http://www.flamingspork.com/blog/2010/02/03/ndbinfo-with-sql-hits-beta/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 01:37:20 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[cluster]]></category>
		<category><![CDATA[MySQL Cluster]]></category>
		<category><![CDATA[ndb]]></category>
		<category><![CDATA[ndb$info]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1783</guid>
		<description><![CDATA[﻿Bernhard blogged over at http://ocklin.blogspot.com/2010/02/mysql-cluster-711-is-there.html that MySQL Cluster 7.1.1 Beta has been released. The big feature (from my point of view) is the SQL interface on top of NDB$INFO. This means there is now full infrastructure from the NDB data nodes right out to SQL in the MySQL Server for adding monitoring to any bit [...]]]></description>
			<content:encoded><![CDATA[<p>﻿<a href="http://ocklin.blogspot.com">Bernhard</a> blogged over at<a href="http://ocklin.blogspot.com/2010/02/mysql-cluster-711-is-there.html"> http://ocklin.blogspot.com/2010/02/mysql-cluster-711-is-there.html</a> that <a href="ftp://ftp.mysql.com/pub/mysql/download/mysql-5.1.41-ndb-7.1.1-beta.tgz">MySQL Cluster 7.1.1 Beta</a> has been released. The big feature (from my point of view) is the SQL interface on top of NDB$INFO. This means there is now full infrastructure from the NDB data nodes right out to SQL in the MySQL Server for adding monitoring to any bit of the internals of the data nodes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/02/03/ndbinfo-with-sql-hits-beta/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>You have already lost</title>
		<link>http://www.flamingspork.com/blog/2010/01/18/you-have-already-lost/</link>
		<comments>http://www.flamingspork.com/blog/2010/01/18/you-have-already-lost/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 02:43:13 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[drizzle fail]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1780</guid>
		<description><![CDATA[When the following code introduces a valgrind warning&#8230; you are in a world of pain and loss:
=== modified file 'drizzled/field/blob.h'
--- drizzled/field/blob.h	2009-12-21 08:16:13 +0000
+++ drizzled/field/blob.h	2010-01-18 01:36:48 +0000
@@ -32,6 +32,7 @@
  */
 class Field_blob :public Field_str {
 protected:
+  uint32_t assassass;
   uint32_t packlength;
   String value;				// For temporaries
 public:
]]></description>
			<content:encoded><![CDATA[<p>When the following code introduces a valgrind warning&#8230; you are in a world of pain and loss:</p>
<pre>=== modified file 'drizzled/field/blob.h'
--- drizzled/field/blob.h	2009-12-21 08:16:13 +0000
+++ drizzled/field/blob.h	2010-01-18 01:36:48 +0000
@@ -32,6 +32,7 @@
  */
 class Field_blob :public Field_str {
 protected:
+  uint32_t assassass;
   uint32_t packlength;
   String value;				// For temporaries
 public:</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/01/18/you-have-already-lost/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Shocked and Stunned (that code exists and does work)</title>
		<link>http://www.flamingspork.com/blog/2010/01/09/shocked-and-stunned-that-code-exists-and-does-work/</link>
		<comments>http://www.flamingspork.com/blog/2010/01/09/shocked-and-stunned-that-code-exists-and-does-work/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 01:06:34 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[drizzle]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[bitwise]]></category>
		<category><![CDATA[sucks]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1777</guid>
		<description><![CDATA[#define READ_ALL		1	/* openfrm: Read all parameters */
#define EXTRA_RECORD		8	/* Reservera plats f&#124;r extra record */
﻿﻿and later on&#8230;.
  if (prgflag &#38; (READ_ALL+EXTRA_RECORD))
    records++;
Feel free to think about that for a second.
(I have an urge to add this to questions asked in a job interview&#8230;)
]]></description>
			<content:encoded><![CDATA[<pre>#define READ_ALL<span style="white-space: pre;">		</span>1<span style="white-space: pre;">	</span>/* openfrm: Read all parameters */
#define EXTRA_RECORD<span style="white-space: pre;">		</span>8<span style="white-space: pre;">	</span>/* Reservera plats f|r extra record */</pre>
<p>﻿﻿and later on&#8230;.</p>
<pre>  if (prgflag &amp; (READ_ALL+EXTRA_RECORD))
    records++;</pre>
<p>Feel free to think about that for a second.</p>
<p>(I have an urge to add this to questions asked in a job interview&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/01/09/shocked-and-stunned-that-code-exists-and-does-work/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>INFORMATION_SCHEMA always comes first</title>
		<link>http://www.flamingspork.com/blog/2010/01/05/information_schema-always-comes-first/</link>
		<comments>http://www.flamingspork.com/blog/2010/01/05/information_schema-always-comes-first/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 05:20:25 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[drizzle]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[INFORMATION_SCHEMA]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[undocumented]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/2010/01/05/information_schema-always-comes-first/</guid>
		<description><![CDATA[SHOW DATABASES will always have INFORMATION_SCHEMA first, everything else is alphabetical. Why? because it hates you.
]]></description>
			<content:encoded><![CDATA[<p>SHOW DATABASES will always have INFORMATION_SCHEMA first, everything else is alphabetical. Why? because it hates you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2010/01/05/information_schema-always-comes-first/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why I bought a Sony eBook reader</title>
		<link>http://www.flamingspork.com/blog/2009/12/23/why-i-bought-a-sony-ebook-reader/</link>
		<comments>http://www.flamingspork.com/blog/2009/12/23/why-i-bought-a-sony-ebook-reader/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 22:12:25 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[life, the universe and everything]]></category>
		<category><![CDATA[ebook]]></category>
		<category><![CDATA[eff]]></category>
		<category><![CDATA[gadget]]></category>
		<category><![CDATA[privacy]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1772</guid>
		<description><![CDATA[
Thanks to the EFF for their E-Book Buyer&#8217;s Guide to Privacy.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flamingspork.com/blog/wp-content/uploads/2009/12/ebook-privacy2.png"><img class="aligncenter size-full wp-image-1773" title="ebook-privacy2" src="http://www.flamingspork.com/blog/wp-content/uploads/2009/12/ebook-privacy2.png" alt="" width="598" height="692" /></a></p>
<p>Thanks to the <a href="http://www.eff.org/">EFF</a> for their <a href="http://www.eff.org/deeplinks/2009/12/e-book-privacy">E-Book Buyer&#8217;s Guide to Privacy</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2009/12/23/why-i-bought-a-sony-ebook-reader/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Bullshit Tiger. bullshit.</title>
		<link>http://www.flamingspork.com/blog/2009/12/14/bullshit-tiger-bullshit/</link>
		<comments>http://www.flamingspork.com/blog/2009/12/14/bullshit-tiger-bullshit/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 09:57:49 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[bullshit]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[tiger]]></category>
		<category><![CDATA[tigerairways]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/2009/12/14/bullshit-tiger-bullshit/</guid>
		<description><![CDATA[
It also took them over an hour to make the announcement that the flight had been delayed. The screens just flashed &#8220;Boarding&#8221; for an hour (and they still are).
Delays are fine. Complete and total lack of any communication whatsoever is not.
Simply jumping on a microphone and saying &#8220;we&#8217;re experiencing a delay, we&#8217;ll have more information [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flamingspork.com/blog/wp-content/uploads/2009/12/Screenshot-3.png"><img src="http://www.flamingspork.com/blog/wp-content/uploads/2009/12/Screenshot-3-300x188.png" alt="Screenshot-3" title="Screenshot-3" width="300" height="188" class="aligncenter size-medium wp-image-1770" /></a></p>
<p>It also took them over an hour to make the announcement that the flight had been delayed. The screens just flashed &#8220;Boarding&#8221; for an hour (and they still are).</p>
<p>Delays are fine. Complete and total lack of any communication whatsoever is not.</p>
<p>Simply jumping on a microphone and saying &#8220;we&#8217;re experiencing a delay, we&#8217;ll have more information for you in half an hour&#8221; would be better. We seriously heard nothing for a whole hour after &#8220;Boarding&#8221; had started.</p>
<p>Just a closed door.</p>
<p>Somehow I feel this will be the last time I fly this airline.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2009/12/14/bullshit-tiger-bullshit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Table protobuf message format</title>
		<link>http://www.flamingspork.com/blog/2009/12/12/the-table-protobuf-message-format/</link>
		<comments>http://www.flamingspork.com/blog/2009/12/12/the-table-protobuf-message-format/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 22:00:15 +0000</pubDate>
		<dc:creator>Stewart Smith</dc:creator>
				<category><![CDATA[drizzle]]></category>
		<category><![CDATA[frm]]></category>
		<category><![CDATA[protobuf]]></category>
		<category><![CDATA[table message]]></category>

		<guid isPermaLink="false">http://www.flamingspork.com/blog/?p=1763</guid>
		<description><![CDATA[If you&#8217;ve ever opened up drizzled/message/table.proto in the Drizzle source tree you will have seen what&#8217;s in the table message: the structure that describes a database table in Drizzle. Previously I&#8217;ve talked about the Table message more generally, giving a fair bit of history of the FRM file and how we&#8217;ve replaced it with both [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever opened up <a href="http://bazaar.launchpad.net/~drizzle-developers/drizzle/development/annotate/head:/drizzled/message/table.proto">drizzled/message/table.proto</a> in the <a href="http://www.drizzle.org">Drizzle</a> source tree you will have seen what&#8217;s in the table message: the structure that describes a database table in <a href="http://www.drizzle.org">Drizzle</a>. Previously I&#8217;ve talked about the <a href="http://www.flamingspork.com/blog/2009/12/09/drizzle-frm-replacement-the-table-proto/">Table message more generally</a>, giving a fair bit of history of the FRM file and how we&#8217;ve replaced it with both the Table protobuf message and an infrastructure inside Drizzle so that Storage Engines own their own metadata.</p>
<p>Yesterday I talked about the <a href="http://www.flamingspork.com/blog/2009/12/11/the-schema-protobuf-message-drizzles-metadata-on-a-schema/">Schema protobuf message format</a> in more detail, and this time I&#8217;m talking about the Table protobuf message in a similar amount.</p>
<p>The first time we were loading (then only part of) the table definition out of a protobuf message was way back in January 2009 (<a href="http://www.flamingspork.com/blog/2009/01/30/progress-in-nofrm-branch/">I blogged about it too</a>). It was an <a href="http://www.flamingspork.com/blog/2009/01/29/maximum-number-of-columns-hard-limit/">adventure</a> <a href="http://www.flamingspork.com/blog/2009/02/15/the-frm-file-format/">untangling</a> <a href="http://www.tranexp.com:2000/InterTran?url=http://&amp;type=text&amp;text=korr&amp;from=swe&amp;to=eng">all</a> <a href="http://www.flamingspork.com/blog/2008/11/22/what-version-in-information_schematables-means-hint-not-what-you-think/">sorts</a><a href="http://www.flamingspork.com/blog/2008/11/06/goodbye-frm-or-at-least-the-steps-to-it/"> of</a> <a href="http://www.flamingspork.com/blog/2008/11/22/drop-table-fail-on-the-road-to-removing-the-frm/">things</a> to get to a much nicer place (where we are now). The code in the server is not perfect&#8230; I&#8217;ll be the first to admit that some of it is rather strange, but that&#8217;s mostly all behind the scenes for people interested in the protobuf Table message!</p>
<p>The Table message has several embedded messages in it too. We need to have information on the Storage Engine, Fields and Indexes (and each of those can have other properties). It is much more complex than the simple <a href="http://www.flamingspork.com/blog/2009/12/11/the-schema-protobuf-message-drizzles-metadata-on-a-schema/">Schema message</a>.</p>
<p>Let&#8217;s have a look at the basic structure of the Table message:</p>
<pre>message Table {

    /* *SNIP* (Here goes the definitions for TableType, StorageEngine, Field, Index, ForeignKeyConstrain, TableOptions and TableStats) */

  required string name = 1;
  required TableType type = 5;
  required StorageEngine engine = 2;
  repeated Field field = 3;
  repeated Index indexes = 4;

  repeated ForeignKeyConstraint fk_constraint = 8;
  optional TableOptions options = 9;
  optional TableStats stats = 10;
}</pre>
<p>(We&#8217;ve skipped the definitions for the embedded messages for now)</p>
<p>This seems all pretty logical; a table has a name, a type, is in a Storage Engine, has Fields, may have Indexes, may have foreign key constraints, it has some options and statistics (the statistics may go away at some point &#8220;soon&#8221;).</p>
<p>Let&#8217;s have a look at the TableType message definition:</p>
<pre>  enum TableType {
    STANDARD = 0;
    TEMPORARY = 1;
    INTERNAL = 2;
  }</pre>
<p>It&#8217;s pretty simple, the table type is either a standard table (what you get from CREATE TABLE), a temporary table (what you get from CREATE TEMPORARY TABLE) or an INTERNAL table (what you get when Drizzle uses a temporary table during query execution).</p>
<p>Next, the StorageEngine message:</p>
<pre>  message StorageEngine {

    message EngineOption {
      enum EngineOptionType {
        BOOL = 0;
        INTEGER = 1;
        STRING = 2;
      }

      required string option_name = 1;
      required string option_value = 2;
      required EngineOptionType option_type = 3;
    }

    required string name = 1;
    repeated EngineOption option = 2;
  }</pre>
<p>The main part is the &#8220;name&#8221; member, which is just the name of the storage engine (e.g. &#8220;PBXT&#8221;,  &#8221;INNODB&#8221;, &#8220;ARCHIVE&#8221;). We do however have support specified in the StorageEngine message for engine specific options (in key value form). Expect these to be used more in the near future.</p>
<p>Specifying Fields is probably the most complex part of the table message. The Field message looks like this (with many embedded messages):</p>
<pre>message Field {
    required string name = 1;
    required FieldType type = 2;
    optional FieldFormatType format = 3;
    optional FieldOptions options = 4;
    optional FieldConstraints constraints = 5;
    optional NumericFieldOptions numeric_options = 6;
    optional StringFieldOptions string_options = 7;

    optional string comment = 16; /* Reserve 0-15 for frequently accessed attributes */
    optional SetFieldOptions set_options = 17;
    optional TimestampFieldOptions timestamp_options = 18;
}</pre>
<p>So&#8230; what does this all mean? Well, Fields have a type, they&#8217;re stored in a format, there&#8217;s options attached to them, there may be constraints as well as field type specific options.</p>
<p>The different field types should be fairly familiar by now:</p>
<pre>    enum FieldType {
      DOUBLE = 0;
      VARCHAR = 1;
      BLOB = 2;
      ENUM = 3;
      INTEGER = 4;
      BIGINT = 5;
      DECIMAL = 6;
      DATE = 7;
      TIME = 8;
      TIMESTAMP = 9;
      DATETIME = 10;
    }</pre>
<p>We also allow fields in different formats. Currently, these are default, fixed and dynamic. The idea is you can tell the engine (or the engine can tell you) how it&#8217;s storing the field. This is currently here as a nicety and the users for this are few and far between.</p>
<pre>    enum FieldFormatType {
      DefaultFormat= 0;
      FixedFormat= 1;
      DynamicFormat= 2;
    }</pre>
<p>The FieldOptions get interesting though:</p>
<pre>    message FieldOptions {
      optional string default_value = 1;
      optional string update_value = 2;
      optional bool default_null = 3 [default = false];
      optional bytes default_bin_value = 4;
    }</pre>
<p>You&#8217;ll no doubt be intrigued by the existence of both &#8220;default_value&#8221; and &#8220;default_bin_value&#8221;. Ordinarily, using a string to contain a textual representation of the default value (e.g. &#8220;foo&#8221; or &#8220;42&#8243;) is fine. However, for BLOB columns, you can have defaults that aren&#8217;t representable in a text string, you need binary data (e.g. the default value contains &#8216;\0&#8242;).</p>
<p>For TIMESTAMP columns, we continue to support DEFAULT NOW() and the ability to update the timestamp column on UPDATE. How is this represented in the table message? Well&#8230; default_value will be &#8220;NOW()&#8221; and update_value will be &#8220;NOW()&#8221;. It is intended that in the future it will be possible to have arbitrary SQL expressions for these. This does, of course, require support in the Drizzle server.</p>
<p>The default_null bool should be rather obvious :)</p>
<p>Well&#8230; that&#8217;s enough for today. Next time: more of the Field message!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.flamingspork.com/blog/2009/12/12/the-table-protobuf-message-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
