Example #1
0
  int statement::prepare(char const* stmt)
  {
    int rc = finish();
    if (rc != SQLITE_OK)
      return rc;

    return prepare_impl(stmt);
  }
Example #2
0
    int command::execute_all()
    {
        int rc = eexecute();
        if (rc != SQLITE_OK) return rc;

        char const* sql = tail_;

        while (strlen(sql) > 0) { // sqlite3_complete() is broken.
            sqlite3_stmt* old_stmt = stmt_;

            if ((rc = prepare_impl(sql)) != SQLITE_OK) return rc;

            if ((rc = sqlite3_transfer_bindings(old_stmt, stmt_)) != SQLITE_OK) return rc;

            finish_impl(old_stmt);

            if ((rc = eexecute()) != SQLITE_OK) return rc;

            sql = tail_;
        }

        return rc;
    }