mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-20 12:52:30 +02:00
* Move database dumping into its own method.
This commit is contained in:
@@ -83,6 +83,21 @@ DatabaseImpl::DatabaseImpl( const QString& dbname, Database* parent )
|
|||||||
|
|
||||||
if ( qApp->arguments().contains( "--dumpdb" ) )
|
if ( qApp->arguments().contains( "--dumpdb" ) )
|
||||||
{
|
{
|
||||||
|
dumpDatabase();
|
||||||
|
::exit( 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DatabaseImpl::~DatabaseImpl()
|
||||||
|
{
|
||||||
|
delete m_fuzzyIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DatabaseImpl::dumpDatabase()
|
||||||
|
{
|
||||||
QFile dump( "dbdump.txt" );
|
QFile dump( "dbdump.txt" );
|
||||||
if ( !dump.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
if ( !dump.open( QIODevice::WriteOnly | QIODevice::Text ) )
|
||||||
{
|
{
|
||||||
@@ -92,6 +107,8 @@ DatabaseImpl::DatabaseImpl( const QString& dbname, Database* parent )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
QTextStream dumpout( &dump );
|
QTextStream dumpout( &dump );
|
||||||
|
TomahawkSqlQuery query = newquery();
|
||||||
|
|
||||||
query.exec( "SELECT * FROM oplog" );
|
query.exec( "SELECT * FROM oplog" );
|
||||||
while ( query.next() )
|
while ( query.next() )
|
||||||
{
|
{
|
||||||
@@ -103,15 +120,6 @@ DatabaseImpl::DatabaseImpl( const QString& dbname, Database* parent )
|
|||||||
<< endl << endl << endl;
|
<< endl << endl << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::exit( 0 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DatabaseImpl::~DatabaseImpl()
|
|
||||||
{
|
|
||||||
delete m_fuzzyIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -84,6 +84,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
QString cleanSql( const QString& sql );
|
QString cleanSql( const QString& sql );
|
||||||
bool updateSchema( int oldVersion );
|
bool updateSchema( int oldVersion );
|
||||||
|
void dumpDatabase();
|
||||||
|
|
||||||
bool m_ready;
|
bool m_ready;
|
||||||
QSqlDatabase m_db;
|
QSqlDatabase m_db;
|
||||||
|
Reference in New Issue
Block a user