Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv8062
Modified Files:
dbdriver.cpp dbdriver.h persistentbroker.cpp wolfpack.cpp
wpconsole.cpp
Log Message:
Some fixes for MySQL driver
Index: dbdriver.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dbdriver.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** dbdriver.cpp 1 Sep 2003 21:14:20 -0000 1.19
--- dbdriver.cpp 2 Sep 2003 01:07:44 -0000 1.20
***************
*** 67,90 ****
/* dummy functions */
- cDBDriver::~cDBDriver() {}
- bool cDBDriver::open( int id ) { return true; }
- void cDBDriver::close() {}
- cDBResult cDBDriver::query( const QString &query ) { return cDBResult( NULL, NULL ); }
bool cDBDriver::exec( const QString &query ) { return true; }
void cDBDriver::lockTable( const QString& table ) {}
void cDBDriver::unlockTable( const QString& table ) {}
QString cDBDriver::error() { return QString::null; }
-
void cDBDriver::setActiveConnection( int id )
{
- if( connections.find( id ) == connections.end() )
- {
- connection = NULL;
- open( id );
- }
- else
- {
- connection = connections[ id ];
- }
}
--- 67,76 ----
***************
*** 332,335 ****
--- 318,334 ----
{
return QString::null;
+ }
+ }
+
+ void cMySQLDriver::setActiveConnection( int id )
+ {
+ if( connections.find( id ) == connections.end() )
+ {
+ connection = NULL;
+ open( id );
+ }
+ else
+ {
+ connection = connections[ id ];
}
}
Index: dbdriver.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dbdriver.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** dbdriver.h 1 Sep 2003 21:14:20 -0000 1.12
--- dbdriver.h 2 Sep 2003 01:07:44 -0000 1.13
***************
*** 50,54 ****
friend class cDBResult;
protected:
- std::map< int, st_mysql* > connections;
void *connection;
--- 50,53 ----
***************
*** 60,71 ****
public:
cDBDriver() : connection(0) {}
! virtual ~cDBDriver();
virtual const char *name() const { return NULL; }
! virtual bool open( int id = CONN_MAIN );
! virtual void close();
virtual bool exec( const QString &query ); // Just execute some SQL code, no return!
! virtual cDBResult query( const QString &query ); // Executes a query
virtual void lockTable( const QString& table );
virtual void unlockTable( const QString& table );
--- 59,70 ----
public:
cDBDriver() : connection(0) {}
! virtual ~cDBDriver() {};
virtual const char *name() const { return NULL; }
! virtual bool open( int id = CONN_MAIN ) = 0;
! virtual void close() = 0;
virtual bool exec( const QString &query ); // Just execute some SQL code, no return!
! virtual cDBResult query( const QString &query ) = 0; // Executes a query
virtual void lockTable( const QString& table );
virtual void unlockTable( const QString& table );
***************
*** 73,77 ****
// Setters + Getters
! void setActiveConnection( int id = CONN_MAIN );
void setUserName( const QString &data ) { _username = data; }
void setPassword( const QString &data ) { _password = data; }
--- 72,76 ----
// Setters + Getters
! virtual void setActiveConnection( int id = CONN_MAIN );
void setUserName( const QString &data ) { _username = data; }
void setPassword( const QString &data ) { _password = data; }
***************
*** 105,108 ****
--- 104,108 ----
class cMySQLDriver : public cDBDriver
{
+ std::map< int, st_mysql* > connections;
public:
const char *name() const { return "mysql"; }
***************
*** 117,121 ****
void unlockTable( const QString& table );
QString error();
!
bool exec( const QString &query );
cDBResult query( const QString &query );
--- 117,121 ----
void unlockTable( const QString& table );
QString error();
! void setActiveConnection( int id );
bool exec( const QString &query );
cDBResult query( const QString &query );
Index: persistentbroker.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/persistentbroker.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** persistentbroker.cpp 1 Sep 2003 21:14:20 -0000 1.20
--- persistentbroker.cpp 2 Sep 2003 01:07:44 -0000 1.21
***************
*** 67,71 ****
else if( driver == "mysql" )
{
! connection = new cDBDriver;
sqlite = false;
}
--- 67,71 ----
else if( driver == "mysql" )
{
! connection = new cMySQLDriver;
sqlite = false;
}
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.446
retrieving revision 1.447
diff -C2 -d -r1.446 -r1.447
*** wolfpack.cpp 30 Aug 2003 17:00:10 -0000 1.446
--- wolfpack.cpp 2 Sep 2003 01:07:44 -0000 1.447
***************
*** 715,718 ****
--- 715,719 ----
if( !persistentBroker->openDriver( SrvParams->databaseDriver() ) )
{
+ clConsole.log( LOG_FATAL, QString("Error trying to open %1 database driver, check your wolfpack.xml").arg(SrvParams->databaseDriver()) );
exit( -1 );
}
Index: wpconsole.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wpconsole.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** wpconsole.cpp 4 Jul 2003 16:30:48 -0000 1.23
--- wpconsole.cpp 2 Sep 2003 01:07:44 -0000 1.24
***************
*** 143,147 ****
{
if (errorstrm != NULL)
! (*errorstrm) << sMessage;
}
--- 143,147 ----
{
if (errorstrm != NULL)
! (*errorstrm) << sMessage.latin1();
}
|