Thanks! Updated in my cvs. Keep em coming if you got em, it certainly needs it :).
Gary On Sat, 26 Feb 2005 17:19:58 -0800 (PST), John Miller <[EMAIL PROTECTED]> wrote: > Simple patch against the recent DB changes. > > > __________________________________ > Do you Yahoo!? > Yahoo! Sports - Sign up for Fantasy Baseball. > http://baseball.fantasysports.yahoo.com/ > > diff -Naur torrentocracy-orig/torrentocracy/main.cpp > torrentocracy/torrentocracy/main.cpp > --- torrentocracy-orig/torrentocracy/main.cpp 2004-07-14 18:28:16.000000000 > -0500 > +++ torrentocracy/torrentocracy/main.cpp 2005-02-26 18:19:01.951565143 > -0600 > @@ -22,7 +22,6 @@ > #include <iostream> > > #include <qapplication.h> > -#include <qsqldatabase.h> > #include <unistd.h> > > #include "torrentocracy.h" > @@ -71,8 +70,7 @@ > QString(".qm"), "."); > qApp->installTranslator(&translator); > > - Torrentocracy news(QSqlDatabase::database(), > - gContext->GetMainWindow(), "torrentocracy"); > + Torrentocracy news(gContext->GetMainWindow(), "torrentocracy"); > news.exec(); > > qApp->removeTranslator(&translator); > @@ -92,8 +90,7 @@ > QString(".qm"), "."); > qApp->installTranslator(&translator); > > - TorrentocracyConfig config(QSqlDatabase::database(), > - gContext->GetMainWindow(), "torrentocracy"); > + TorrentocracyConfig config(gContext->GetMainWindow(), "torrentocracy"); > config.exec(); > > qApp->removeTranslator(&translator); > diff -Naur torrentocracy-orig/torrentocracy/torrentocracy.cpp > torrentocracy/torrentocracy/torrentocracy.cpp > --- torrentocracy-orig/torrentocracy/torrentocracy.cpp 2004-09-08 > 22:21:11.000000000 -0500 > +++ torrentocracy/torrentocracy/torrentocracy.cpp 2005-02-26 > 18:36:07.296670239 -0600 > @@ -22,7 +22,6 @@ > #include <iostream> > > #include <qnetwork.h> > -#include <qsqlquery.h> > #include <qdatetime.h> > #include <qpainter.h> > #include <qdir.h> > @@ -31,12 +30,15 @@ > #include <qtimer.h> > #include <qregexp.h> > > +#include <mythtv/mythcontext.h> > +#include <mythtv/mythdbcon.h> > + > #include "torrentocracy.h" > #include <mythtv/inetcomms.h> > > -Torrentocracy::Torrentocracy(QSqlDatabase *db, MythMainWindow *parent, > +Torrentocracy::Torrentocracy(MythMainWindow *parent, > const char *name ) > - : MythDialog(parent, name), m_DB(db) > + : MythDialog(parent, name) > { > qInitNetworkProtocols (); > > @@ -77,9 +79,9 @@ > > // Load sites from database > > - QSqlQuery query("SELECT name, url, updated FROM rssfeeds ORDER BY name", > - db); > - if (!query.isActive()) { > + MSqlQuery query(MSqlQuery::InitCon()); > + query.prepare("SELECT name, url, updated FROM rssfeeds ORDER BY name"); > + if (!query.exec()) { > cerr << "Torrentocracy: Error in loading Sites from DB" << endl; > } > else { > @@ -824,11 +826,13 @@ > { > unsigned int updated = site->lastUpdated().toTime_t(); > > - QSqlQuery query("UPDATE rssfeeds SET updated=" + > + MSqlQuery query(MSqlQuery::InitCon()); > + > + query.prepare("UPDATE rssfeeds SET updated=" + > QString::number(updated) + > " WHERE name='" + > - site->name() + "'", m_DB); > - if (!query.isActive()) { > + site->name() + "'"); > + if (!query.exec()) { > cerr << "Torrentocracy: Error in updating time in DB" << endl; > } > > diff -Naur torrentocracy-orig/torrentocracy/torrentocracy.h > torrentocracy/torrentocracy/torrentocracy.h > --- torrentocracy-orig/torrentocracy/torrentocracy.h 2004-08-21 > 13:11:06.000000000 -0500 > +++ torrentocracy/torrentocracy/torrentocracy.h 2005-02-26 18:17:23.153785667 > -0600 > @@ -22,7 +22,6 @@ > #ifndef TORRENTOCRACY_H > #define TORRENTOCRACY_H > > -#include <qsqldatabase.h> > #include <qtextbrowser.h> > > #include <mythtv/uitypes.h> > @@ -44,7 +43,7 @@ > > public: > > - Torrentocracy(QSqlDatabase *db, MythMainWindow *parent, > + Torrentocracy(MythMainWindow *parent, > const char *name = 0); > ~Torrentocracy(); > > @@ -83,7 +82,6 @@ > > int currentPage; > > - QSqlDatabase *m_DB; > XMLParse *m_Theme; > > UIListBtnType *m_UISites; > diff -Naur torrentocracy-orig/torrentocracy/torrentocracyconfig.cpp > torrentocracy/torrentocracy/torrentocracyconfig.cpp > --- torrentocracy-orig/torrentocracy/torrentocracyconfig.cpp 2004-07-14 > 18:28:18.000000000 -0500 > +++ torrentocracy/torrentocracy/torrentocracyconfig.cpp 2005-02-26 > 18:34:58.640594081 -0600 > @@ -22,6 +22,9 @@ > #include <qapplication.h> > #include <iostream> > > +#include <mythtv/mythcontext.h> > +#include <mythtv/mythdbcon.h> > + > #include <qptrlist.h> > #include <qstring.h> > #include <qfile.h> > @@ -92,12 +95,10 @@ > > // --------------------------------------------------- > > -TorrentocracyConfig::TorrentocracyConfig(QSqlDatabase *db, > - MythMainWindow *parent, > +TorrentocracyConfig::TorrentocracyConfig(MythMainWindow *parent, > const char *name) > : MythDialog(parent, name) > { > - m_db = db; > m_priv = new TorrentocracyConfigPriv; > m_updateFreqTimer = new QTimer(this); > m_updateFreq = gContext->GetNumSetting("NewsUpdateFrequency", 30); > @@ -112,7 +113,7 @@ > " url VARCHAR(255) NOT NULL," > " ico VARCHAR(255)," > " updated INT UNSIGNED );"); > - QSqlQuery query(QString::null, m_db); > + MSqlQuery query(MSqlQuery::InitCon()); > if (!query.exec(queryString)) { > cerr << "TorrentocracyConfig: Error in creating sql table" << > endl; > } > @@ -440,10 +441,11 @@ > { > bool val = false; > > - QSqlQuery query( "SELECT name FROM rssfeeds WHERE name='" > - + name + "'", m_db); > - if (!query.isActive()) { > - cerr << "TorrentocracyConfig: Error in finding in DB" << endl; > + MSqlQuery query(MSqlQuery::InitCon()); > + query.prepare( "SELECT name FROM rssfeeds WHERE name='" > + + name + "'"); > + if (!query.exec()) { > + cerr << "TorrentocracyConfig: Error in finding in DB: " << name << > endl; > return val; > } > > @@ -458,16 +460,26 @@ > > if (findInDB(site->name)) > return false; > + QString s( QString("INSERT INTO rssfeeds " > + " (name,category,url,ico) " > + " VALUES( '") + > + site->name + "', '" + > + site->category + "', '" + > + site->url + "', '" + > + site->ico + "' );"); > > - QSqlQuery query( QString("INSERT INTO rssfeeds " > + MSqlQuery query(MSqlQuery::InitCon()); > + query.prepare( QString("INSERT INTO rssfeeds " > " (name,category,url,ico) " > " VALUES( '") + > site->name + "', '" + > site->category + "', '" + > site->url + "', '" + > site->ico + "' );"); > - if (!query.isActive()) { > + if (!query.exec()) { > cerr << "TorrentocracyConfig: Error in inserting in DB" << endl; > + //cerr << "name: " << site->name << " cat: " << site->category << " > url: " << site->url << " ico: " << site->ico << endl; > + //cerr << "query: " << s << endl; > return false; > } > > @@ -478,9 +490,10 @@ > { > if (!site) return false; > > - QSqlQuery query( "DELETE FROM rssfeeds WHERE name='" > - + site->name + "'", m_db); > - if (!query.isActive()) { > + MSqlQuery query(MSqlQuery::InitCon()); > + query.prepare( "DELETE FROM rssfeeds WHERE name='" > + + site->name + "'"); > + if (!query.exec()) { > cerr << "TorrentocracyConfig: Error in Deleting from DB" << endl; > return false; > } > diff -Naur torrentocracy-orig/torrentocracy/torrentocracyconfig.h > torrentocracy/torrentocracy/torrentocracyconfig.h > --- torrentocracy-orig/torrentocracy/torrentocracyconfig.h 2004-07-14 > 18:28:18.000000000 -0500 > +++ torrentocracy/torrentocracy/torrentocracyconfig.h 2005-02-26 > 18:19:29.149650034 -0600 > @@ -22,8 +22,6 @@ > #ifndef TORRENTOCRACYCONFIG_H > #define TORRENTOCRACYCONFIG_H > > -#include <qsqldatabase.h> > - > #include <mythtv/uitypes.h> > #include <mythtv/uilistbtntype.h> > #include <mythtv/xmlparse.h> > @@ -54,8 +52,7 @@ > > public: > > - TorrentocracyConfig(QSqlDatabase *db, > - MythMainWindow *parent, > + TorrentocracyConfig(MythMainWindow *parent, > const char *name = 0); > ~TorrentocracyConfig(); > > >
_______________________________________________ mythtv-users mailing list [email protected] http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
