Hi friends,
I'm creating what is, effectively for the sake of this explanation, a server that receives connections which call out to an SQL database (for authentication purposes, obvi.).
1 2 3 4 5 6
|
DatabaseConnection::DatabaseConnection(const std::string databaseName)
: m_connection(databaseName, SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE),
m_createTableQuery(m_connection, CREATE_LOGIN_TABLE_QUERY)
{
m_createTableQuery.exec();
}
|
Where,
databaseName
was first "./test.db" and
m_createTableQuery
is
CREATE TABLE IF NOT EXISTS login(username TEXT PRIMARY KEY, password TEXT);
. I then deleted the database (it was getting messy with testing), and was just expecting that upon rebooting the server, the database would be re-created and re-seeded with the appropriate table
login
, but I promptly received this error:
SQLite::Exception: no such table: login
and the server shut down and the connection closed immediately. The database file WAS created, but when I inspect it with SQL on the command line, the table was never created.
I did some Googling and I couldn't find a definitive answer, but I suspect it's either something as simple as my query being incorrect (tested on raw SQL on command line and works), or some sort of caching issue/file path issue.
Any help would be greatly appreciated,
Best,
Aaron