print sql queries when running core in debug mode
[quassel.git] / src / core / abstractsqlstorage.h
index 2894291..d0046a9 100644 (file)
@@ -72,6 +72,16 @@ protected:
   inline virtual QString userName() { return QString(); }
   inline virtual QString password() { return QString(); }
 
+
+  //! Initialize db specific features on connect
+  /** This is called every time a connection to a specific SQL backend is established
+   *  the default implementation does nothing.
+   *
+   *  When reimplementing this method, don't use logDB() inside this function as
+   *  this would cause as we're just about to initialize that DB connection.
+   */
+  inline virtual void initDbSession(QSqlDatabase & /* db */) {}
+
 private slots:
   void connectionDestroyed();
 
@@ -79,8 +89,9 @@ private:
   void addConnectionToPool();
 
   int _schemaVersion;
+  bool _debug;
 
-  int _nextConnectionId;
+  static int _nextConnectionId;
   QMutex _connectionPoolMutex;
   // we let a Connection Object manage each actual db connection
   // those objects reside in the thread the connection belongs to
@@ -121,6 +132,7 @@ public:
   struct SenderMO {
     int senderId;
     QString sender;
+    SenderMO() : senderId(0) {}
   };
 
   struct IdentityMO {
@@ -176,6 +188,9 @@ public:
     QString awaymessage;
     QString attachperform;
     QString detachperform;
+    bool usesasl;
+    QString saslaccount;
+    QString saslpassword;
   };
 
   struct BufferMO {
@@ -187,6 +202,7 @@ public:
     QString buffercname;
     int buffertype;
     int lastseenmsgid;
+    int markerlinemsgid;
     QString key;
     bool joined;
   };
@@ -269,11 +285,11 @@ public:
   AbstractSqlMigrationReader();
 
   virtual bool readMo(QuasselUserMO &user) = 0;
-  virtual bool readMo(SenderMO &sender) = 0;
   virtual bool readMo(IdentityMO &identity) = 0;
   virtual bool readMo(IdentityNickMO &identityNick) = 0;
   virtual bool readMo(NetworkMO &network) = 0;
   virtual bool readMo(BufferMO &buffer) = 0;
+  virtual bool readMo(SenderMO &sender) = 0;
   virtual bool readMo(BacklogMO &backlog) = 0;
   virtual bool readMo(IrcServerMO &ircserver) = 0;
   virtual bool readMo(UserSettingMO &userSetting) = 0;
@@ -292,11 +308,11 @@ private:
 class AbstractSqlMigrationWriter : public AbstractSqlMigrator {
 public:
   virtual bool writeMo(const QuasselUserMO &user) = 0;
-  virtual bool writeMo(const SenderMO &sender) = 0;
   virtual bool writeMo(const IdentityMO &identity) = 0;
   virtual bool writeMo(const IdentityNickMO &identityNick) = 0;
   virtual bool writeMo(const NetworkMO &network) = 0;
   virtual bool writeMo(const BufferMO &buffer) = 0;
+  virtual bool writeMo(const SenderMO &sender) = 0;
   virtual bool writeMo(const BacklogMO &backlog) = 0;
   virtual bool writeMo(const IrcServerMO &ircserver) = 0;
   virtual bool writeMo(const UserSettingMO &userSetting) = 0;