mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-01 17:58:29 +00:00
- Fixed issue 42. Memory is still a bit high, but only for a second.
- Fixed a bug in the musik::core::db::CachedStatement that made the CachedStatement not working. - Increased the SQLite memory for the Indexer to 4Mb.
This commit is contained in:
parent
70b53353ef
commit
f969f1a857
@ -407,7 +407,7 @@ void Indexer::ThreadLoop(){
|
||||
while(!this->Exit()){
|
||||
|
||||
// Database should only be open when synchronizing
|
||||
this->dbConnection.Open(this->database.c_str(),0,1024);
|
||||
this->dbConnection.Open(this->database.c_str(),0,4096);
|
||||
|
||||
this->RestartSync(false);
|
||||
this->Synchronize();
|
||||
@ -701,7 +701,8 @@ void Indexer::SyncOptimize(){
|
||||
genre, artist, album, track number, path, filename
|
||||
************************************/
|
||||
|
||||
db::Statement stmt("SELECT t.id FROM tracks t LEFT OUTER JOIN genres g ON t.visual_genre_id=g.id LEFT OUTER JOIN albums al ON t.album_id=al.id LEFT OUTER JOIN artists ar ON t.visual_artist_id=ar.id LEFT OUTER JOIN folders f ON t.folder_id=f.id ORDER BY g.sort_order,ar.sort_order,al.sort_order,t.track,f.fullpath,t.filename",this->dbConnection);
|
||||
db::Statement stmt("SELECT t.id FROM tracks t LEFT OUTER JOIN genres g ON g.id=t.visual_genre_id LEFT OUTER JOIN artists ar ON ar.id=t.visual_artist_id LEFT OUTER JOIN albums al ON al.id=t.album_id LEFT OUTER JOIN folders f ON f.id=t.folder_id ORDER BY g.sort_order,ar.sort_order,al.sort_order,t.track,f.fullpath,t.filename",this->dbConnection);
|
||||
|
||||
db::Statement stmtUpdate("UPDATE tracks SET sort_order1=? WHERE id=?",this->dbConnection);
|
||||
iCount = 0;
|
||||
while(stmt.Step()==db::ReturnCode::Row){
|
||||
|
@ -48,10 +48,10 @@ CachedStatement::CachedStatement(const char* sql,Connection &connection) : State
|
||||
this->stmt = this->connection->GetCachedStatement(sql);
|
||||
}
|
||||
|
||||
|
||||
void CachedStatement::Finalize(){
|
||||
CachedStatement::~CachedStatement(){
|
||||
sqlite3_reset(this->stmt);
|
||||
sqlite3_clear_bindings(this->stmt);
|
||||
this->connection->ReturnCachedStatement(this->sqlStatement.c_str(),this->stmt);
|
||||
this->stmt=NULL;
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,9 @@ namespace musik{ namespace core{ namespace db{
|
||||
class CachedStatement : public Statement{
|
||||
public:
|
||||
CachedStatement(const char* sql,Connection &connection);
|
||||
~CachedStatement();
|
||||
private:
|
||||
std::string sqlStatement;
|
||||
protected:
|
||||
void Finalize();
|
||||
};
|
||||
|
||||
|
||||
|
@ -57,11 +57,10 @@ Statement::Statement(Connection &connection) : connection(&connection),stmt(NULL
|
||||
|
||||
|
||||
Statement::~Statement(){
|
||||
this->Finalize();
|
||||
int err=sqlite3_finalize(this->stmt);
|
||||
}
|
||||
|
||||
void Statement::Finalize(){
|
||||
int err=sqlite3_finalize(this->stmt);
|
||||
/* #ifdef _DEBUG
|
||||
if(err!=0){
|
||||
const char *errorMsg = sqlite3_errmsg(this->connection->connection);
|
||||
|
@ -51,7 +51,7 @@ namespace musik{ namespace core{ namespace db{
|
||||
class Statement : boost::noncopyable{
|
||||
public:
|
||||
Statement(const char* sql,Connection &connection);
|
||||
~Statement();
|
||||
virtual ~Statement();
|
||||
void Reset();
|
||||
int Step();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user