title: SQLite query accepts some values with apostrophes but not others
body: <p>I'm pulling the title of books from an SQLite database. I've used a parameter injection to try to pull titles with apostrophes in them, but some work and some crash the app.</p>
  
  <p>The title that works is <em>The Adventure of the Engineer's Thumb</em> but <em>The Adventure of the Stockbroker's Clerk</em> and <em>The Adventure of the "Gloria Scott"</em> both throw up errors. I can't see a pattern here...</p>
  
  <p>Snippet from DatabaseHelper:</p>
  
  <pre><code>public String getStoryBody(String story) {
  
     String storyBody = "";
  
     // Select all query
     String selectQuery = "SELECT body FROM " + BOOKS + " WHERE title = ?";
  
     SQLiteDatabase db = this.getWritableDatabase();
     Cursor cursor = db.rawQuery(selectQuery, new String[] {story});
  
     if (cursor.moveToFirst()) {
         do {
             storyBody = cursor.getString(0);
         } while (cursor.moveToNext());
     }
  
     return storyBody;
  }
  </code></pre>
  
  <p>Snippet from StoryBodyActivity:</p>
  
  <pre><code>storyBodyTextView = (TextView) findViewById(R.id.story_body_text_view);
  storyBodyScrollView = (ScrollView) findViewById(R.id.story_body_scroll_view);
  
  DatabaseHelper db = new DatabaseHelper(this);
  
  String storyBody = db.getStoryBody(story);
  
  Log.i("story", storyBody);
  
  storyBodyTextView.setText(Html.fromHtml(storyBody));
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>The error generated is a null pointer exception on the <code>Log.i("story", storyBody);</code> line:</p>
  
  <blockquote>
    <p>java.lang.NullPointerException: println needs a message</p>
  </blockquote>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>My database structure is:</p>
  
  <p>Books</p>
  
  <ul>
  <li>id</li>
  <li>title</li>
  <li>author_id</li>
  <li>collection</li>
  <li>body</li>
  </ul>