diff options
Diffstat (limited to 'src/collectiondb.h')
-rw-r--r-- | src/collectiondb.h | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/collectiondb.h b/src/collectiondb.h index 8ff12b7..92ea88a 100644 --- a/src/collectiondb.h +++ b/src/collectiondb.h @@ -8,12 +8,12 @@ #define KLAMAV_COLLECTIONDB_H #include <kurl.h> -#include <qdir.h> //stack allocated -#include <qimage.h> -#include <qobject.h> //baseclass -#include <qptrqueue.h> //baseclass -#include <qsemaphore.h> //stack allocated -#include <qstringlist.h> //stack allocated +#include <tqdir.h> //stack allocated +#include <tqimage.h> +#include <tqobject.h> //baseclass +#include <tqptrqueue.h> //baseclass +#include <tqsemaphore.h> //stack allocated +#include <tqstringlist.h> //stack allocated class DbConnection; class DbConnectionPool; @@ -26,12 +26,12 @@ class DbConfig class SqliteConfig : public DbConfig { public: - SqliteConfig( const QString& /* dbfile */ ); + SqliteConfig( const TQString& /* dbfile */ ); - const QString dbFile() const { return m_dbfile; } + const TQString dbFile() const { return m_dbfile; } private: - QString m_dbfile; + TQString m_dbfile; }; @@ -44,11 +44,11 @@ class DbConnection DbConnection( DbConfig* /* config */ ); virtual ~DbConnection() = 0; - virtual QStringList query( const QString& /* statement */ ) = 0; - virtual int insert( const QString& /* statement */, const QString& /* table */ ) = 0; + virtual TQStringList query( const TQString& /* statement */ ) = 0; + virtual int insert( const TQString& /* statement */, const TQString& /* table */ ) = 0; const bool isInitialized() const { return m_initialized; } virtual bool isConnected() const = 0; - virtual const QString lastError() const { return "None"; } + virtual const TQString lastError() const { return "None"; } protected: bool m_initialized; DbConfig *m_config; @@ -65,8 +65,8 @@ class SqliteConnection : public DbConnection SqliteConnection( SqliteConfig* /* config */ ); ~SqliteConnection(); - QStringList query( const QString& /* statement */ ); - int insert( const QString& /* statement */, const QString& /* table */ ); + TQStringList query( const TQString& /* statement */ ); + int insert( const TQString& /* statement */, const TQString& /* table */ ); bool isConnected()const { return true; } private: static void sqlite_rand(sqlite3_context *context, int /*argc*/, sqlite3_value ** /*argv*/); @@ -78,7 +78,7 @@ class SqliteConnection : public DbConnection -class DbConnectionPool : QPtrQueue<DbConnection> +class DbConnectionPool : TQPtrQueue<DbConnection> { public: DbConnectionPool( bool temporary ); @@ -91,7 +91,7 @@ class DbConnectionPool : QPtrQueue<DbConnection> DbConnection *getDbConnection(); void putDbConnection( const DbConnection* /* conn */ ); - QString escapeString( QString string ) + TQString escapeString( TQString string ) { return string.replace( '\'', "''" ); @@ -101,13 +101,13 @@ class DbConnectionPool : QPtrQueue<DbConnection> static const int POOL_SIZE = 5; bool m_isTemporary; - QSemaphore m_semaphore; + TQSemaphore m_semaphore; DbConnection::DbConnectionType m_dbConnType; DbConfig *m_dbConfig; }; -class CollectionDB : public QObject +class CollectionDB : public TQObject { Q_OBJECT @@ -120,14 +120,14 @@ class CollectionDB : public QObject static CollectionDB *instance(); - const QString escapeString( const QString &string ) { return m_dbConnPool->escapeString(string); } - const QString boolT() { if (m_dbConnPool->getDbConnectionType() == DbConnection::postgresql) return "'t'"; else return "1"; } - const QString boolF() { if (m_dbConnPool->getDbConnectionType() == DbConnection::postgresql) return "'f'"; else return "0"; } - const QString textColumnType() { if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "TEXT"; else return "VARCHAR(255)"; } - const QString textColumnType(int length){ if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "TEXT"; else return QString("VARCHAR(%1)").arg(length); } + const TQString escapeString( const TQString &string ) { return m_dbConnPool->escapeString(string); } + const TQString boolT() { if (m_dbConnPool->getDbConnectionType() == DbConnection::postgresql) return "'t'"; else return "1"; } + const TQString boolF() { if (m_dbConnPool->getDbConnectionType() == DbConnection::postgresql) return "'f'"; else return "0"; } + const TQString textColumnType() { if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "TEXT"; else return "VARCHAR(255)"; } + const TQString textColumnType(int length){ if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "TEXT"; else return TQString("VARCHAR(%1)").arg(length); } // We might consider using LONGTEXT type, as some lyrics could be VERY long..??? - const QString longTextColumnType() { if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "TEXT"; else return "TEXT"; } - const QString randomFunc() { if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "random()"; else return "RAND()"; } + const TQString longTextColumnType() { if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "TEXT"; else return "TEXT"; } + const TQString randomFunc() { if ( m_dbConnPool->getDbConnectionType() == DbConnection::postgresql ) return "random()"; else return "RAND()"; } int getType() { return m_dbConnPool->getDbConnectionType(); } @@ -149,12 +149,12 @@ class CollectionDB : public QObject void returnStaticDbConnection( DbConnection *conn ); //sql helper methods - QStringList query( const QString& statement, DbConnection *conn = NULL ); - int insert( const QString& statement, const QString& table, DbConnection *conn = NULL ); + TQStringList query( const TQString& statement, DbConnection *conn = NULL ); + int insert( const TQString& statement, const TQString& table, DbConnection *conn = NULL ); //table management methods bool isEmpty(); - bool isValid(const QString &column, const QString &table); + bool isValid(const TQString &column, const TQString &table); void createTables( DbConnection *conn = NULL ); void createActivityTable( DbConnection *conn = NULL ); void createMetaDBTable( DbConnection *conn = NULL ); @@ -164,17 +164,17 @@ class CollectionDB : public QObject void moveTempTables( DbConnection *conn ); - QString typeCount( const QString &type_id ); - QStringList messagesForType( const QString &type_id, const bool isValue ); - QStringList allActivity( ); - QStringList allActivityOfType(const QString &type, const QString &days ); - void insertEvent(const QString &type, const QString &event,const QString &file = NULL, DbConnection *conn = NULL ); - void expireActivity(const QString &days ); - void insertMetaDBEntry(const QString &date, const QString &submission, const QString &creator,const QString &virus,const QString &alias, const QString &sender,DbConnection *conn = NULL); - QString latestMetaDBDate( ); + TQString typeCount( const TQString &type_id ); + TQStringList messagesForType( const TQString &type_id, const bool isValue ); + TQStringList allActivity( ); + TQStringList allActivityOfType(const TQString &type, const TQString &days ); + void insertEvent(const TQString &type, const TQString &event,const TQString &file = NULL, DbConnection *conn = NULL ); + void expireActivity(const TQString &days ); + void insertMetaDBEntry(const TQString &date, const TQString &submission, const TQString &creator,const TQString &virus,const TQString &alias, const TQString &sender,DbConnection *conn = NULL); + TQString latestMetaDBDate( ); protected: - QCString md5sum( const QString& artist, const QString& album, const QString& file = QString::null ); + TQCString md5sum( const TQString& artist, const TQString& album, const TQString& file = TQString::null ); /** Manages regular folder monitoring scan */ public slots: @@ -194,10 +194,10 @@ class CollectionDB : public QObject //general management methods - uint IDFromValue( QString name, QString value, bool autocreate = true, const bool temporary = false, + uint IDFromValue( TQString name, TQString value, bool autocreate = true, const bool temporary = false, const bool updateSpelling = false, DbConnection *conn = NULL ); - QString valueFromID( QString table, uint id ); + TQString valueFromID( TQString table, uint id ); //member variables |