mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-04 08:42:07 +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()){
|
while(!this->Exit()){
|
||||||
|
|
||||||
// Database should only be open when synchronizing
|
// 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->RestartSync(false);
|
||||||
this->Synchronize();
|
this->Synchronize();
|
||||||
@ -701,7 +701,8 @@ void Indexer::SyncOptimize(){
|
|||||||
genre, artist, album, track number, path, filename
|
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);
|
db::Statement stmtUpdate("UPDATE tracks SET sort_order1=? WHERE id=?",this->dbConnection);
|
||||||
iCount = 0;
|
iCount = 0;
|
||||||
while(stmt.Step()==db::ReturnCode::Row){
|
while(stmt.Step()==db::ReturnCode::Row){
|
||||||
|
@ -48,10 +48,10 @@ CachedStatement::CachedStatement(const char* sql,Connection &connection) : State
|
|||||||
this->stmt = this->connection->GetCachedStatement(sql);
|
this->stmt = this->connection->GetCachedStatement(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CachedStatement::~CachedStatement(){
|
||||||
void CachedStatement::Finalize(){
|
|
||||||
sqlite3_reset(this->stmt);
|
sqlite3_reset(this->stmt);
|
||||||
sqlite3_clear_bindings(this->stmt);
|
sqlite3_clear_bindings(this->stmt);
|
||||||
this->connection->ReturnCachedStatement(this->sqlStatement.c_str(),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{
|
class CachedStatement : public Statement{
|
||||||
public:
|
public:
|
||||||
CachedStatement(const char* sql,Connection &connection);
|
CachedStatement(const char* sql,Connection &connection);
|
||||||
|
~CachedStatement();
|
||||||
private:
|
private:
|
||||||
std::string sqlStatement;
|
std::string sqlStatement;
|
||||||
protected:
|
|
||||||
void Finalize();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,11 +57,10 @@ Statement::Statement(Connection &connection) : connection(&connection),stmt(NULL
|
|||||||
|
|
||||||
|
|
||||||
Statement::~Statement(){
|
Statement::~Statement(){
|
||||||
this->Finalize();
|
int err=sqlite3_finalize(this->stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Statement::Finalize(){
|
void Statement::Finalize(){
|
||||||
int err=sqlite3_finalize(this->stmt);
|
|
||||||
/* #ifdef _DEBUG
|
/* #ifdef _DEBUG
|
||||||
if(err!=0){
|
if(err!=0){
|
||||||
const char *errorMsg = sqlite3_errmsg(this->connection->connection);
|
const char *errorMsg = sqlite3_errmsg(this->connection->connection);
|
||||||
|
@ -51,7 +51,7 @@ namespace musik{ namespace core{ namespace db{
|
|||||||
class Statement : boost::noncopyable{
|
class Statement : boost::noncopyable{
|
||||||
public:
|
public:
|
||||||
Statement(const char* sql,Connection &connection);
|
Statement(const char* sql,Connection &connection);
|
||||||
~Statement();
|
virtual ~Statement();
|
||||||
void Reset();
|
void Reset();
|
||||||
int Step();
|
int Step();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user