SQLite Forum

C api sqlite3_db_readonly returns -1
Login
Here is the code 

  #define DBF "path/to/dbfile"

  sqlite3* db;

  const char* values[4] = {"Ana","str","0720", "ana.oa"};

  

  char* sql;
  int rc;
  sqlite3_stmt* stmt;

  rc = sqlite3_open_v2(DBF, &db, SQLITE_OPEN_READWRITE, NULL );
  printf("٪d",rc);
  printf("٪d", sqlite3_db_readonly(db, DBF));
  sql = "insert into ids (name, adr, tel, email) values(?1, ?2, ?3, ?4);";
  sqlite3_prepare_v2(db, sql, -1, &stmt, NULL );
  sqlite3_bind_text(stmt, 1, values[1], -1, SQLITE_STATIC);
  sqlite3_bind_text(stmt, 2, values[2], -1, SQLITE_STATIC);
  sqlite3_bind_text(stmt, 3, values[3], -1, SQLITE_STATIC);
  sqlite3_bind_text(stmt, 4, values[4], -1, SQLITE_STATIC);
  sqlite3_step(stmt);
  sqlite3_finalize(stmt);
  sqlite3_close(db);

I am more interested for now in learning, than in solving a particular code, so if anyone can give me some clues about the causes of that returning value -1, IT would be very appreciated, because I didn't find anything on the internet.
Thanks in advance.