<?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>matthewcarriere.com &#187; sqlite</title>
	<atom:link href="http://matthewcarriere.com/tag/sqlite/feed/" rel="self" type="application/rss+xml" />
	<link>http://matthewcarriere.com</link>
	<description>a blog about ruby on rails and the mac.</description>
	<lastBuildDate>Mon, 05 Jul 2010 21:29:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Getting Started with SQLite</title>
		<link>http://matthewcarriere.com/2008/01/30/getting-started-with-sqlite/</link>
		<comments>http://matthewcarriere.com/2008/01/30/getting-started-with-sqlite/#comments</comments>
		<pubDate>Thu, 31 Jan 2008 05:57:45 +0000</pubDate>
		<dc:creator>matthew</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://matthewcarriere.com/?p=17</guid>
		<description><![CDATA[SQLite is an extremely lightweight (dare I say agile) database. It uses files and doesn&#8217;t require you to start and stop services or spend a great deal of time configuring it. SQLite will be a good choice if you have a load under 100,000 requests and few concurrent writes. If you have a simple site [...]]]></description>
			<content:encoded><![CDATA[<p>SQLite is an extremely lightweight (dare I say agile) database. It uses files and doesn&#8217;t require you to start and stop services or spend a great deal of time configuring it. SQLite will be a good choice if you have a load under 100,000 requests and few concurrent writes. If you have a simple site that does nothing but serve content, then SQLite may just fit the bill.</p>
<p>Now that Ruby on Rails is using SQLite as its default database here are some tips for working with it.</p>
<p>Right off, you will need a Ruby SQLite adapter if you intend to work with SQLite at all, so let&#8217;s get that installed first:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">sudo gem install sqlite3-ruby</pre></td></tr></table></div>

<p>Next up we need a database, and with SQLite all we need to do is pass a filename when we fire up SQLite:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;"><span style="color: #000066;">sqlite</span> test.db</pre></td></tr></table></div>

<p>At this point the database will operate similar to MySQL. You are sitting at a command prompt and can enter various SQL commands to create tables, perform crud operations etc.</p>
<p>When you are done with the database quit using the following command:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">.quit</pre></td></tr></table></div>

<p>Another handy command to take a look at is:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">.help</pre></td></tr></table></div>

<p>This will produce a list of commands you can use in SQLite. For example, trying to find the equivalent of <em>show databases</em> in SQLite?</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">.databases</pre></td></tr></table></div>

<p>If you are not at all interested in working with SQLite or you know ahead of time it won&#8217;t fit the bill then let Rails know when you create your application:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="io" style="font-family:monospace;">rails -d mysql my_app</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://matthewcarriere.com/2008/01/30/getting-started-with-sqlite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
