title: In android, sqlite text field is retrieved using getBlob, not getString
body: <p>I am attempting to make an android application with a pre-populated database. When learning about how to go about this, I came across this article <a href="http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/" rel="nofollow">http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/</a> , which basically takes an existing sqlite database and streams it into the correct location on the android device. The data I had was dealt with in ruby, so I grabbed the sqlite gem, and created a database like so. </p>
  
  <pre><code>db = SQLite3::Database.new( "cards.db" )
  db.execute("CREATE TABLE android_metadata (locale TEXT DEFAULT \"en_US\")")
  db.execute("INSERT INTO android_metadata VALUES (\"en_US\")")
  
  db.execute("
    CREATE TABLE #{@@card_table_name} (
    _id INTEGER PRIMARY KEY,
    name TEXT UNIQUE
    )")
  
  cards.each do |card|
    begin
      db.execute("INSERT INTO #{@card_table_name} (_id, name) VALUES (?, ?)",
                 card.id, card.name)
    rescue =&gt; e
      puts "#{card.name} (#{card.id})"
      puts e
    end
  end
  </code></pre>
  
  <p>When I go into the database, both the one made from the ruby script, and the one from using adb and examining the database on the emulator, I get this for the schema.</p>
  
  <pre><code>sqlite&gt; .schema
  CREATE TABLE Cards (
    _id INTEGER PRIMARY KEY,
    name TEXT UNIQUE
    );
  </code></pre>
  
  <p>However, when I pull the data back out in my application, getString can't deal with the name, specifically, this block gets into the exception clause, and prints the name successfully within that block</p>
  
  <pre><code>Cursor cursor = myDataBase.query("Cards", new String[] {"_id", "name"}, null, null, null, null, null, "5");
  while (cursor.moveToNext()) {
      try {
          cards.add(new Card(cursor.getInt(0), new String(cursor.getString(1))));
      } catch (Exception e) {
          byte[] blob = cursor.getBlob(1);
          String translated = new String(blob);
          Log.i(MagicApp.TAG, "DB retrival blew up on " + cursor.getInt(0) + ", " + blob + " : " + translated);
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>I can deal with that, but it seems like I shouldn't have to do that. Any one else encountered this, or know what I'm doing wrong?</p>