After a month or two with wxSqlite3 I found what I believe is a nasty memory leak (or maybe my code is no good at all).
Code: Select all
void save(wxString& name, wxString& age){
//Connect & Open the database.
wxSQLite3Database* db = new wxSQLite3Database();
db->Open("database.db");
//Prepere statement.
wxSQLite3Statement stmt;
//NULL is where the id is.
stmt = db->PrepareStatement("INSERT INTO table1 VALUES (NULL, ?, ?);");
//Bind the statements.
stmt.Bind(1, name);
stmt.Bind(2, age);
//Execute the update.
stmt.ExecuteUpdate();
//Reset the statement.
stmt.ClearBindings();
stmt.Reset();
//Close connection.
db->Close();
delete db;
}
I have tried to comment/uncomment a lot of the code above to localize the problem. The conclusion is that it has to do with the two bindings. I have tried a pointer/reference version of wxSQLite3Database..and so on
Someone have an idé on whats going on?