title: SqlLite prepare_v2 error
body: <p>I'm developing an app in c++ but get stuck on an error that occured whenever the program reach the <code>sqlite3_prepare_v2</code> statement</p>
  
  <p>here is the code, Thanks a lot for your help !</p>
  
  <pre><code>int Database::save_lesson (Lesson *lesson) {
      int id ;
      std::ostringstream oss ;
  
      oss &lt;&lt; "insert into lesson (name, teacher, place, begin, end)" ;
      oss &lt;&lt; "values ( " ;
      oss &lt;&lt; "'" &lt;&lt; lesson-&gt;get_name()    &lt;&lt; "', " ;
      oss &lt;&lt; "'" &lt;&lt; lesson-&gt;get_teacher() &lt;&lt; "', " ;
      oss &lt;&lt; "'" &lt;&lt; lesson-&gt;get_slots() &lt;&lt; "', "  ;
      oss &lt;&lt; "'" &lt;&lt; lesson-&gt;get_begin() &lt;&lt; "', "  ;
      oss &lt;&lt; "'" &lt;&lt; lesson-&gt;get_end()   &lt;&lt; "') ;" ;
  
      check (sqlite3_prepare_v2 (
              db,
              oss.str().c_str(),
              -1,
              &amp;stmt,
              0)
      ) ;
      sqlite3_step(stmt) ;
      sqlite3_finalize(stmt) ;
  
      oss.clear();
      oss.str("");
  
      oss &lt;&lt; "select max(id) from lesson ;" ;
  // error occured here:
      check (sqlite3_prepare_v2 (
              db,
              oss.str().c_str(),
              -1,
              &amp;stmt,
              0)
      ) ;
      sqlite3_step(stmt) ;
      id = sqlite3_column_int(stmt, 0) ;
      sqlite3_finalize(stmt) ;
  
      return id ;
  }
  </code></pre>
  
  <p><strong>EDIT</strong>
  The error message is: <code>bad parameter or other API misuse</code> (very helpful)</p>