Rafael Toledo <[email protected]> wrote: > rc = sqlite3_prepare_v2(mydb, "INSERT INTO users (name, isadmin, > photo) VALUES (?, 1, ?)", -1, &statement, NULL); > if (rc != SQLITE_OK) { > sqlite3_finalize(statement);
If prepare fails, statement is never updated. So you are passing garbage to sqlite3_finalize. You shouldn't call it at all. > sqlite3_close(banco); What's the relationship between variables named banco and mydb? Why are you using one in open, but the other in close? > rc = sqlite3_bind_blob(statement, ++i, (void*) user.getPhoto()[0], I suspect that should be &user.getPhoto()[0]. Rule of thumb: if you can't get it to compile without a cast, you are likely doing something wrong. My psychic powers tell me that user.getPhoto() returns vector<char>& or similar. You then take the first byte of that vector, and interpret it as a pointer - which of course is a complete nonsense. > rc = sqlite3_step(statement); // The app crashes here! This is where SQLite tries to dereference that bogus pointer for the first time. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

