Hello. I'm a first-time sqlite user, and I have a question. I'm using
the C/C++ API as shown in the code below, and the sqlite3_step()
function always seems to return SQLITE_BUSY for me. I'm not sure what I
am doing wrong. I'm running on Ubuntu 8.04, and I don't have any
multiple threads or clients or virus software running, so I can't see
why the database would be locked. The database file gets created okay,
but it's empty.
Any suggestions?
----
#include <sqlite3.h>
#include <iostream>
using namespace std;
int main()
{
sqlite3* db_;
int rc = sqlite3_open_v2( "simple.db", &db_, SQLITE_OPEN_CREATE, 0 );
if ( rc ) {
cout << "failed to connect" << endl;
sqlite3_close( db_ );
return EXIT_FAILURE;
}
sqlite3_stmt* stmt;
std::string query( "create table if not exists version(major int,
minor int)" );
rc = sqlite3_prepare_v2( db_, query.c_str(), query.size(), &stmt, 0 );
if ( rc ) {
cout << "failed to create statement" << endl;
sqlite3_close( db_ );
return EXIT_FAILURE;
}
rc = sqlite3_step( stmt );
cout << "step returned " << rc << endl;
sqlite3_finalize( stmt );
sqlite3_close( db_ );
}
--
George Ryan
Senior Software Architect
Akoostix Inc., Nova Scotia Canada
902-404-PING | www.akoostix.com
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users