<?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>iphone and gis development notes &#187; sqlite3</title>
	<atom:link href="http:///wordpress/tag/sqlite3/feed/" rel="self" type="application/rss+xml" />
	<link>/wordpress</link>
	<description>By Rupert</description>
	<lastBuildDate>Mon, 26 Jul 2010 05:06:32 +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>iPhone Note #8: Exporting Oracle to SQLite3</title>
		<link>/wordpress/2009/08/iphone-note-7-exporting-oracle-to-sqlite3/</link>
		<comments>/wordpress/2009/08/iphone-note-7-exporting-oracle-to-sqlite3/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 12:31:09 +0000</pubDate>
		<dc:creator>Rupert</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://gismobiledev.wordpress.com/?p=92</guid>
		<description><![CDATA[Since I&#8217;ve been working most of my time with iPhone Dev for the last couple of months, I thought it will be worthwile to post how to import files to SQLite3. In a nutshell, use MesaSQLite&#8217;s IMPORT function. It will save you a lot of time. Now it is up to you how to export]]></description>
			<content:encoded><![CDATA[<p>Since I&#8217;ve been working most of my time with iPhone Dev for the last couple of months, I thought it will be worthwile to post how to import files to SQLite3. In a nutshell, use  <a href="http://www.mesamysql.com/?realmesa_home">MesaSQLite&#8217;s</a> IMPORT function. It will save you a lot of time. Now it is up to you how to export into a CSV or TAB delimited file. For Oracle, I used <a href="http://www.oracle.com/technology/products/database/sql_developer/index.html">SQLDeveloper</a>. For other databases, such as MySQL or Postgres, I&#8217;ve used <a href="http://www.navicat.com">Navicat.</a><span id="more-369"></span></p>
<p>1. Using <a href="http://www.oracle.com/technology/products/database/sql_developer/index.html">SQLDeveloper</a> -&gt; Right Click on the Table from the left pane -&gt; Export</p>
<p><img src="/wordpress/wp-content/uploads/2009/08/oracle-sqldeveloper-left.gif" alt="oracle-sqldeveloper-left.gif" border="0" width="278" height="377" /></p>
<p><img src="/wordpress/wp-content/uploads/2009/08/oracle-sqldeveloper.gif" alt="oracle-sqldeveloper.gif" border="0" width="467" height="409" /></p>
<p>2. Choose TEXT since we are going to use that when importing using <a href="http://www.mesamysql.com/?realmesa_home">MesaSQLite.</a> Note, SQLDeveloper does not export CLOB columns. You need to change your column from CLOB to VARCHAR. A workaround is to add a column and then update that column aferwards.</p>
<pre>
ALTER TABLE poi ADD en_desc VARCHAR(2000);
UPDATE poi SET en_desc = en_short_desc;
</pre>
<p>3. In <a href="http://www.mesamysql.com/?realmesa_home">MesaSQLite,</a> FILE -&gt; IMPORT -&gt; CSV/TAB</p>
<p><img src="/wordpress/wp-content/uploads/2009/08/mesa-1.gif" alt="mesa-1.gif" border="0" width="274" height="127" /></p>
<p>4. Choose the table which you want to import.</p>
<p>5. Choose your exported TAB delimited file from SQLDeveloper.</p>
<p>6. Afterwards, map the corresponding fields to your database. Note, that I added an extra column &#8220;dummy&#8221; in the file because it seems I can only match n-1 columns, thus the extra column.</p>
<p><img src="/wordpress/wp-content/uploads/2009/08/mesa-2.gif" alt="mesa-2.gif" border="0" width="344" height="349" /></p>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2009/08/iphone-note-7-exporting-oracle-to-sqlite3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Note #5: SQLite3</title>
		<link>/wordpress/2009/08/iphone-note-sqlite3-tutorial/</link>
		<comments>/wordpress/2009/08/iphone-note-sqlite3-tutorial/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:44:13 +0000</pubDate>
		<dc:creator>Rupert</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://gismobiledev.wordpress.com/?p=64</guid>
		<description><![CDATA[Note this tutorial will be updated in the near future&#8230; 1. The code below (based from the SQLiteBooks Example) will copy the database from your bundle to the &#8220;Documents&#8221; directory. You don&#8217;t have to do this every time your app launches, so there is a check at &#8220;success&#8221; below. To check this, in the iPhone]]></description>
			<content:encoded><![CDATA[<p>Note this tutorial will be updated in the near future&#8230;</p>
<p>1. The code below (based from the <a href="">SQLiteBooks Example</a>) will copy the database from your bundle to the &#8220;Documents&#8221; directory. You don&#8217;t have to do this every time your app launches, so there is a check at &#8220;success&#8221; below. To check this, in the iPhone Simulator navigate to the Documents directory:</p>
<p><span id="more-360"></span></p>
<p><strong>/Users/rupert/Library/Application\ Support/iPhone\ Simulator/User/Applications/unique_number_of_the_application/Documents/sample.db</strong></p>
<pre>
// Creates a writable copy of the bundled default database in the application Documents directory.
- (void)createEditableCopyOfDatabaseIfNeeded {
    // First, test for existence.
    BOOL success;
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error;

	//Documents Database Path
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:kDatabaseName];

	success = [fileManager fileExistsAtPath:writableDBPath];
    if (success) return;

    // The writable database does not exist, so copy the default to the appropriate location.
    NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:kDatabaseName];
    success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&amp;error];
    if (!success) {
        NSLog(@"Failed to create writable database file with message '%@'.", [error localizedDescription]);
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2009/08/iphone-note-sqlite3-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite3 Cheatsheet</title>
		<link>/wordpress/2009/08/sqlite3-cheatsheet/</link>
		<comments>/wordpress/2009/08/sqlite3-cheatsheet/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 09:42:42 +0000</pubDate>
		<dc:creator>Rupert</dc:creator>
				<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://gismobiledev.wordpress.com/?p=62</guid>
		<description><![CDATA[Tools 1. MesaSQLite for MacOSX. SQL 1. Getting the current time MySQL = Now(); SQLite3 = CURRENT_TIMESTAMP; insert into jobstemp(full_address, datecreated, dateupdated) VALUES("9 Bishop Street", CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); 2. Getting the local current time SELECT datetime(dateupdated, 'localtime') 3. Trim SELECT trim(name) FROM table]]></description>
			<content:encoded><![CDATA[<h2><strong>Tools</strong></h2>
<p>1. MesaSQLite for MacOSX.</p>
<h2><strong>SQL</strong></h2>
<p><strong>1. Getting the current time</strong></p>
<p>MySQL = Now();</p>
<p>SQLite3 = CURRENT_TIMESTAMP;</p>
<pre>
insert into jobstemp(full_address, datecreated, dateupdated)
VALUES("9 Bishop Street", CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
</pre>
<p><strong>2. Getting the local current time</strong></p>
<pre>
SELECT datetime(dateupdated, 'localtime')
</pre>
<p><strong>3. Trim</strong></p>
<pre>
SELECT trim(name) FROM table
</pre>
]]></content:encoded>
			<wfw:commentRss>/wordpress/2009/08/sqlite3-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
