diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/Database/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/shared/Database/DatabaseEnv.h | 11 | ||||
-rw-r--r-- | src/shared/Database/DatabaseMysql.cpp | 3 | ||||
-rw-r--r-- | src/shared/Database/DatabaseMysql.h | 3 | ||||
-rw-r--r-- | src/shared/Database/DatabasePostgre.cpp | 384 | ||||
-rw-r--r-- | src/shared/Database/DatabasePostgre.h | 77 | ||||
-rw-r--r-- | src/shared/Database/PGSQLDelayThread.h | 33 | ||||
-rw-r--r-- | src/shared/Database/QueryResultMysql.cpp | 3 | ||||
-rw-r--r-- | src/shared/Database/QueryResultMysql.h | 3 | ||||
-rw-r--r-- | src/shared/Database/QueryResultPostgre.cpp | 139 | ||||
-rw-r--r-- | src/shared/Database/QueryResultPostgre.h | 52 | ||||
-rw-r--r-- | src/shared/Database/SQLStorage.cpp | 4 | ||||
-rw-r--r-- | src/shared/Database/SqlDelayThread.cpp | 4 | ||||
-rw-r--r-- | src/trinitycore/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/trinitycore/trinitycore.conf.dist | 6 | ||||
-rw-r--r-- | src/trinityrealm/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/trinityrealm/trinityrealm.conf.dist | 6 |
17 files changed, 0 insertions, 743 deletions
diff --git a/src/shared/Database/CMakeLists.txt b/src/shared/Database/CMakeLists.txt index adbd0c6f998..e046906ad67 100644 --- a/src/shared/Database/CMakeLists.txt +++ b/src/shared/Database/CMakeLists.txt @@ -7,18 +7,13 @@ SET(trinitydatabase_STAT_SRCS DatabaseEnv.h DatabaseImpl.h DatabaseMysql.cpp - DatabasePostgre.cpp DatabaseMysql.h - DatabasePostgre.h Field.cpp Field.h MySQLDelayThread.h - PGSQLDelayThread.h QueryResult.h QueryResultMysql.cpp QueryResultMysql.h - QueryResultPostgre.cpp - QueryResultPostgre.h SQLStorage.cpp SQLStorage.h SqlDelayThread.cpp diff --git a/src/shared/Database/DatabaseEnv.h b/src/shared/Database/DatabaseEnv.h index 67afe0b6162..6546fc217a7 100644 --- a/src/shared/Database/DatabaseEnv.h +++ b/src/shared/Database/DatabaseEnv.h @@ -28,16 +28,6 @@ #include "Database/Field.h" #include "Database/QueryResult.h" -#ifdef DO_POSTGRESQL -#include "Database/QueryResultPostgre.h" -#include "Database/Database.h" -#include "Database/DatabasePostgre.h" -typedef DatabasePostgre DatabaseType; -#define _LIKE_ "ILIKE" -#define _TABLE_SIM_ "\"" -#define _CONCAT3_(A,B,C) "( " A " || " B " || " C " )" -#define _OFFSET_ "LIMIT 1 OFFSET %d" -#else #include "Database/QueryResultMysql.h" #include "Database/Database.h" #include "Database/DatabaseMysql.h" @@ -46,7 +36,6 @@ typedef DatabaseMysql DatabaseType; #define _TABLE_SIM_ "`" #define _CONCAT3_(A,B,C) "CONCAT( " A " , " B " , " C " )" #define _OFFSET_ "LIMIT %d,1" -#endif extern DatabaseType WorldDatabase; extern DatabaseType CharacterDatabase; diff --git a/src/shared/Database/DatabaseMysql.cpp b/src/shared/Database/DatabaseMysql.cpp index 2d5a7b928cc..a595d347e5b 100644 --- a/src/shared/Database/DatabaseMysql.cpp +++ b/src/shared/Database/DatabaseMysql.cpp @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef DO_POSTGRESQL - #include "Util.h" #include "Policies/SingletonImp.h" #include "Platform/Define.h" @@ -435,4 +433,3 @@ void DatabaseMysql::HaltDelayThread() m_delayThread = NULL; m_threadBody = NULL; } -#endif diff --git a/src/shared/Database/DatabaseMysql.h b/src/shared/Database/DatabaseMysql.h index 43462558498..cc88843fa1e 100644 --- a/src/shared/Database/DatabaseMysql.h +++ b/src/shared/Database/DatabaseMysql.h @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef DO_POSTGRESQL - #ifndef _DATABASEMYSQL_H #define _DATABASEMYSQL_H @@ -79,5 +77,4 @@ class DatabaseMysql : public Database bool _Query(const char *sql, MYSQL_RES **pResult, MYSQL_FIELD **pFields, uint64* pRowCount, uint32* pFieldCount); }; #endif -#endif diff --git a/src/shared/Database/DatabasePostgre.cpp b/src/shared/Database/DatabasePostgre.cpp deleted file mode 100644 index a1283538b20..00000000000 --- a/src/shared/Database/DatabasePostgre.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef DO_POSTGRESQL - -#include "Util.h" -#include "Policies/SingletonImp.h" -#include "Platform/Define.h" -#include "Threading.h" -#include "DatabaseEnv.h" -#include "Database/PGSQLDelayThread.h" -#include "Database/SqlOperations.h" -#include "Timer.h" - -void DatabasePostgre::ThreadStart() -{ -} - -void DatabasePostgre::ThreadEnd() -{ -} - -size_t DatabasePostgre::db_count = 0; - -DatabasePostgre::DatabasePostgre() : Database(), mPGconn(NULL) -{ - // before first connection - if( db_count++ == 0 ) - { - - if (!PQisthreadsafe()) - { - sLog.outError("FATAL ERROR: PostgreSQL libpq isn't thread-safe."); - exit(1); - } - } -} - -DatabasePostgre::~DatabasePostgre() -{ - - if (m_delayThread) - HaltDelayThread(); - - if( mPGconn ) - { - PQfinish(mPGconn); - mPGconn = NULL; - } -} - -bool DatabasePostgre::Initialize(const char *infoString) -{ - if(!Database::Initialize(infoString)) - return false; - - tranThread = NULL; - - InitDelayThread(); - - Tokens tokens = StrSplit(infoString, ";"); - - Tokens::iterator iter; - - std::string host, port_or_socket_dir, user, password, database; - - iter = tokens.begin(); - - if(iter != tokens.end()) - host = *iter++; - if(iter != tokens.end()) - port_or_socket_dir = *iter++; - if(iter != tokens.end()) - user = *iter++; - if(iter != tokens.end()) - password = *iter++; - if(iter != tokens.end()) - database = *iter++; - - if (host == ".") - mPGconn = PQsetdbLogin(NULL, port_or_socket_dir == "." ? NULL : port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str()); - else - mPGconn = PQsetdbLogin(host.c_str(), port_or_socket_dir.c_str(), NULL, NULL, database.c_str(), user.c_str(), password.c_str()); - - /* check to see that the backend connection was successfully made */ - if (PQstatus(mPGconn) != CONNECTION_OK) - { - sLog.outError( "Could not connect to Postgre database at %s: %s", - host.c_str(), PQerrorMessage(mPGconn)); - PQfinish(mPGconn); - return false; - } - else - { - sLog.outDetail( "Connected to Postgre database at %s", - host.c_str()); - sLog.outString( "PostgreSQL server ver: %d",PQserverVersion(mPGconn)); - return true; - } - -} - -bool DatabasePostgre::_Query(const char *sql, PGresult** pResult, uint64* pRowCount, uint32* pFieldCount) -{ - if (!mPGconn) - return 0; - - // guarded block for thread-safe request - ACE_Guard<ACE_Thread_Mutex> query_connection_guard(mMutex); - #ifdef MANGOS_DEBUG - uint32 _s = getMSTime(); - #endif - // Send the query - *pResult = PQexec(mPGconn, sql); - if(!*pResult ) - return false; - - if (PQresultStatus(*pResult) != PGRES_TUPLES_OK) - { - sLog.outErrorDb( "SQL : %s", sql ); - sLog.outErrorDb( "SQL %s", PQerrorMessage(mPGconn)); - PQclear(*pResult); - return false; - } - else - { - #ifdef TRINITY_DEBUG - sLog.outDebug("[%u ms] SQL: %s", getMSTime() - _s, sql ); - #endif - } - - *pRowCount = PQntuples(*pResult); - *pFieldCount = PQnfields(*pResult); - // end guarded block - - if (!*pRowCount) - { - PQclear(*pResult); - return false; - } - return true; -} - -QueryResult_AutoPtr DatabasePostgre::Query(const char *sql) -{ - if (!mPGconn) - return QueryResult_AutoPtr(NULL); - - PGresult* result = NULL; - uint64 rowCount = 0; - uint32 fieldCount = 0; - - if(!_Query(sql,&result,&rowCount,&fieldCount)) - return QueryResult_AutoPtr(NULL); - - QueryResultPostgre * queryResult = new QueryResultPostgre(result, rowCount, fieldCount); - queryResult->NextRow(); - - return QueryResult_AutoPtr(queryResult); -} - -QueryNamedResult* DatabasePostgre::QueryNamed(const char *sql) -{ - if (!mPGconn) - return 0; - - PGresult* result = NULL; - uint64 rowCount = 0; - uint32 fieldCount = 0; - - if(!_Query(sql,&result,&rowCount,&fieldCount)) - return NULL; - - QueryFieldNames names(fieldCount); - for (uint32 i = 0; i < fieldCount; i++) - names[i] = PQfname(result, i); - - QueryResultPostgre * queryResult = new QueryResultPostgre(result, rowCount, fieldCount); - queryResult->NextRow(); - - return new QueryNamedResult(queryResult,names); -} - -bool DatabasePostgre::Execute(const char *sql) -{ - - if (!mPGconn) - return false; - - // don't use queued execution if it has not been initialized - if (!m_threadBody) - return DirectExecute(sql); - - tranThread = ACE_Based::Thread::current(); // owner of this transaction - TransactionQueues::iterator i = m_tranQueues.find(tranThread); - if (i != m_tranQueues.end() && i->second != NULL) - { // Statement for transaction - i->second->DelayExecute(sql); - } - else - { - // Simple sql statement - m_threadBody->Delay(new SqlStatement(sql)); - } - - return true; -} - -bool DatabasePostgre::DirectExecute(const char* sql) -{ - if (!mPGconn) - return false; - { - // guarded block for thread-safe request - ACE_Guard<ACE_Thread_Mutex> query_connection_guard(mMutex); - #ifdef MANGOS_DEBUG - uint32 _s = getMSTime(); - #endif - PGresult *res = PQexec(mPGconn, sql); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - sLog.outErrorDb( "SQL: %s", sql ); - sLog.outErrorDb( "SQL %s", PQerrorMessage(mPGconn) ); - return false; - } - else - { - #ifdef TRINITY_DEBUG - sLog.outDebug("[%u ms] SQL: %s", getMSTime() - _s, sql ); - #endif - } - PQclear(res); - - // end guarded block - } - return true; -} - -bool DatabasePostgre::_TransactionCmd(const char *sql) -{ - if (!mPGconn) - return false; - - PGresult *res = PQexec(mPGconn, sql); - if (PQresultStatus(res) != PGRES_COMMAND_OK) - { - sLog.outError("SQL: %s", sql); - sLog.outError("SQL ERROR: %s", PQerrorMessage(mPGconn)); - return false; - } - else - { - DEBUG_LOG("SQL: %s", sql); - } - return true; -} - -bool DatabasePostgre::BeginTransaction() -{ - if (!mPGconn) - return false; - // don't use queued execution if it has not been initialized - if (!m_threadBody) - { - if (tranThread == ACE_Based::Thread::current()) - return false; // huh? this thread already started transaction - mMutex.acquire(); - if (!_TransactionCmd("START TRANSACTION")) - { - mMutex.release(); // can't start transaction - return false; - } - return true; - } - // transaction started - tranThread = ACE_Based::Thread::current(); // owner of this transaction - TransactionQueues::iterator i = m_tranQueues.find(tranThread); - if (i != m_tranQueues.end() && i->second != NULL) - // If for thread exists queue and also contains transaction - // delete that transaction (not allow trans in trans) - delete i->second; - - m_tranQueues[tranThread] = new SqlTransaction(); - - return true; -} - -bool DatabasePostgre::CommitTransaction() -{ - if (!mPGconn) - return false; - - // don't use queued execution if it has not been initialized - if (!m_threadBody) - { - if (tranThread != ACE_Based::Thread::current()) - return false; - bool _res = _TransactionCmd("COMMIT"); - tranThread = NULL; - mMutex.release(); - return _res; - } - tranThread = ACE_Based::Thread::current(); - TransactionQueues::iterator i = m_tranQueues.find(tranThread); - if (i != m_tranQueues.end() && i->second != NULL) - { - m_threadBody->Delay(i->second); - i->second = NULL; - return true; - } - else - return false; -} - -bool DatabasePostgre::RollbackTransaction() -{ - if (!mPGconn) - return false; - // don't use queued execution if it has not been initialized - if (!m_threadBody) - { - if (tranThread != ACE_Based::Thread::current()) - return false; - bool _res = _TransactionCmd("ROLLBACK"); - tranThread = NULL; - mMutex.release(); - return _res; - } - tranThread = ACE_Based::Thread::current(); - TransactionQueues::iterator i = m_tranQueues.find(tranThread); - if (i != m_tranQueues.end() && i->second != NULL) - { - delete i->second; - i->second = NULL; - } - return true; -} - -unsigned long DatabasePostgre::escape_string(char *to, const char *from, unsigned long length) -{ - if (!mPGconn || !to || !from || !length) - return 0; - - return PQescapeString(to, from, length); -} - -void DatabasePostgre::InitDelayThread() -{ - assert(!m_delayThread); - - //New delay thread for delay execute - m_threadBody = new PGSQLDelayThread(this); // Will be deleted on m_delayThread delete - m_delayThread = new ACE_Based::Thread(m_threadBody); -} - -void DatabasePostgre::HaltDelayThread() -{ - if (!m_threadBody || !m_delayThread) return; - - m_threadBody->Stop(); //Stop event - m_delayThread->wait(); //Wait for flush to DB - delete m_delayThread; //This also deletes m_threadBody - m_delayThread = NULL; - m_threadBody = NULL; -} -#endif - diff --git a/src/shared/Database/DatabasePostgre.h b/src/shared/Database/DatabasePostgre.h deleted file mode 100644 index cd93f416bfe..00000000000 --- a/src/shared/Database/DatabasePostgre.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _DatabasePostgre_H -#define _DatabasePostgre_H - -#include "Policies/Singleton.h" -#include <stdarg.h> - -#ifdef WIN32 -#define FD_SETSIZE 1024 -#include <winsock2.h> -#include <postgre/libpq-fe.h> -#else -#include <libpq-fe.h> -#endif - -class DatabasePostgre : public Database -{ - friend class Trinity::OperatorNew<DatabasePostgre>; - - public: - DatabasePostgre(); - ~DatabasePostgre(); - - //! Initializes Postgres and connects to a server. - /*! infoString should be formated like hostname;username;password;database. */ - bool Initialize(const char *infoString); - void InitDelayThread(); - void HaltDelayThread(); - QueryResult_AutoPtr Query(const char *sql); - QueryNamedResult* QueryNamed(const char *sql); - bool Execute(const char *sql); - bool DirectExecute(const char* sql); - bool BeginTransaction(); - bool CommitTransaction(); - bool RollbackTransaction(); - - operator bool () const { return mPGconn != NULL; } - - unsigned long escape_string(char *to, const char *from, unsigned long length); - using Database::escape_string; - - // must be call before first query in thread - void ThreadStart(); - // must be call before finish thread run - void ThreadEnd(); - private: - ACE_Thread_Mutex mMutex; - ACE_Based::Thread * tranThread; - - PGconn *mPGconn; - - static size_t db_count; - - bool _TransactionCmd(const char *sql); - bool _Query(const char *sql, PGresult **pResult, uint64* pRowCount, uint32* pFieldCount); -}; -#endif - diff --git a/src/shared/Database/PGSQLDelayThread.h b/src/shared/Database/PGSQLDelayThread.h deleted file mode 100644 index 2f0dd4958b3..00000000000 --- a/src/shared/Database/PGSQLDelayThread.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __PGSQLDELAYTHREAD_H -#define __PGSQLDELAYTHREAD_H - -#include "Database/SqlDelayThread.h" - -class PGSQLDelayThread : public SqlDelayThread -{ - public: - PGSQLDelayThread(Database* db) : SqlDelayThread(db) {} - void Stop() { SqlDelayThread::Stop(); } -}; -#endif //__PGSQLDELAYTHREAD_H - diff --git a/src/shared/Database/QueryResultMysql.cpp b/src/shared/Database/QueryResultMysql.cpp index e4694e1b9b6..b2bc181a166 100644 --- a/src/shared/Database/QueryResultMysql.cpp +++ b/src/shared/Database/QueryResultMysql.cpp @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef DO_POSTGRESQL - #include "DatabaseEnv.h" QueryResultMysql::QueryResultMysql(MYSQL_RES *result, MYSQL_FIELD *fields, uint64 rowCount, uint32 fieldCount) : @@ -104,4 +102,3 @@ enum Field::DataTypes QueryResultMysql::ConvertNativeType(enum_field_types mysql return Field::DB_TYPE_UNKNOWN; } } -#endif diff --git a/src/shared/Database/QueryResultMysql.h b/src/shared/Database/QueryResultMysql.h index 4a1749c21c5..a9a7a60f123 100644 --- a/src/shared/Database/QueryResultMysql.h +++ b/src/shared/Database/QueryResultMysql.h @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef DO_POSTGRESQL - #if !defined(QUERYRESULTMYSQL_H) #define QUERYRESULTMYSQL_H @@ -47,4 +45,3 @@ class QueryResultMysql : public QueryResult MYSQL_RES *mResult; }; #endif -#endif diff --git a/src/shared/Database/QueryResultPostgre.cpp b/src/shared/Database/QueryResultPostgre.cpp deleted file mode 100644 index 21e72a884b7..00000000000 --- a/src/shared/Database/QueryResultPostgre.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifdef DO_POSTGRESQL - -#include "DatabaseEnv.h" - -QueryResultPostgre::QueryResultPostgre(PGresult *result, uint64 rowCount, uint32 fieldCount) : - QueryResult(rowCount, fieldCount), mResult(result), mTableIndex(0) -{ - - mCurrentRow = new Field[mFieldCount]; - ASSERT(mCurrentRow); - - for (uint32 i = 0; i < mFieldCount; i++) - mCurrentRow[i].SetType(ConvertNativeType(PQftype( result, i ))); -} - -QueryResultPostgre::~QueryResultPostgre() -{ - EndQuery(); -} - -bool QueryResultPostgre::NextRow() -{ - if (!mResult) - return false; - - if (mTableIndex >= mRowCount) - { - EndQuery(); - return false; - } - - char* pPQgetvalue; - for (int j = 0; j < mFieldCount; j++) - { - pPQgetvalue = PQgetvalue(mResult, mTableIndex, j); - if(pPQgetvalue && !(*pPQgetvalue)) - pPQgetvalue = NULL; - - mCurrentRow[j].SetValue(pPQgetvalue); - } - ++mTableIndex; - - return true; -} - -void QueryResultPostgre::EndQuery() -{ - if (mCurrentRow) - { - delete [] mCurrentRow; - mCurrentRow = 0; - } - - if (mResult) - { - PQclear(mResult); - mResult = 0; - } -} - -// see types in #include <postgre/pg_type.h> -enum Field::DataTypes QueryResultPostgre::ConvertNativeType(Oid pOid ) const -{ - switch (pOid) - { - case BPCHAROID: - case CIDOID: - case CIDROID: - case CIRCLEOID: - case INETOID: - case NAMEOID: - case TEXTOID: - case VARCHAROID: - return Field::DB_TYPE_STRING; - case CASHOID: - case FLOAT4OID: - case FLOAT8OID: - case NUMERICOID: - return Field::DB_TYPE_FLOAT; - case DATEOID: // Date - case RELTIMEOID: // Date - case TIMEOID: // Time - case TIMETZOID: // Time - case ABSTIMEOID: // DateTime - case INTERVALOID: // DateTime - case TIMESTAMPOID: // DateTime - case TIMESTAMPTZOID: // DateTime - case INT2OID: // Int - case INT2VECTOROID: // Int - case INT4OID: // Int - case OIDOID: // Int - case CHAROID: // UInt - case INT8OID: // LongLong - return Field::DB_TYPE_INTEGER; - case BOOLOID: - return Field::DB_TYPE_BOOL; // Bool -/* - case BOXOID: Rect; - case LINEOID: Rect; - case VARBITOID: BitArray; - case BYTEAOID: ByteArray; -*/ - case LSEGOID: - case OIDVECTOROID: - case PATHOID: - case POINTOID: - case POLYGONOID: - case REGPROCOID: - case TIDOID: - case TINTERVALOID: - case UNKNOWNOID: - case XIDOID: - default: - return Field::DB_TYPE_UNKNOWN; - } - return Field::DB_TYPE_UNKNOWN; -} -#endif - diff --git a/src/shared/Database/QueryResultPostgre.h b/src/shared/Database/QueryResultPostgre.h deleted file mode 100644 index bf7e7fa3f9a..00000000000 --- a/src/shared/Database/QueryResultPostgre.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#if !defined(QUERYRESULTPOSTGRE_H) -#define QUERYRESULTPOSTGRE_H - -#ifdef WIN32 -#define FD_SETSIZE 1024 -#include <winsock2.h> -#include <postgre/libpq-fe.h> -#include <postgre/pg_type.h> -#else -#include <libpq-fe.h> -#include <postgres.h> -#include <catalog/pg_type.h> -#endif - -class QueryResultPostgre : public QueryResult -{ - public: - QueryResultPostgre(PGresult *result, uint64 rowCount, uint32 fieldCount); - - ~QueryResultPostgre(); - - bool NextRow(); - - private: - enum Field::DataTypes ConvertNativeType(Oid pOid) const; - void EndQuery(); - - PGresult *mResult; - uint32 mTableIndex; -}; -#endif - diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index d3029c858b2..4813c764cba 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -21,11 +21,7 @@ #include "SQLStorage.h" #include "SQLStorageImpl.h" -#ifdef DO_POSTGRESQL -extern DatabasePostgre WorldDatabase; -#else extern DatabaseMysql WorldDatabase; -#endif const char CreatureInfosrcfmt[]="iiiiiiiiiisssiiiiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiifffliiiiiiiliiisi"; const char CreatureInfodstfmt[]="iiiiiiiiiisssibbiiiifffiffiifiiiiiiiiiiffiiiiiiiiiiiiiiiiiiiiiiiisiifffliiiiiiiliiiii"; diff --git a/src/shared/Database/SqlDelayThread.cpp b/src/shared/Database/SqlDelayThread.cpp index 7707d9cf293..43de3c63ffc 100644 --- a/src/shared/Database/SqlDelayThread.cpp +++ b/src/shared/Database/SqlDelayThread.cpp @@ -28,9 +28,7 @@ SqlDelayThread::SqlDelayThread(Database* db) : m_dbEngine(db), m_running(true) void SqlDelayThread::run() { - #ifndef DO_POSTGRESQL mysql_thread_init(); - #endif SqlAsyncTask * s = NULL; @@ -47,9 +45,7 @@ void SqlDelayThread::run() } } - #ifndef DO_POSTGRESQL mysql_thread_end(); - #endif } void SqlDelayThread::Stop() diff --git a/src/trinitycore/CMakeLists.txt b/src/trinitycore/CMakeLists.txt index 3cd1ac1abec..0efdc63c09e 100644 --- a/src/trinitycore/CMakeLists.txt +++ b/src/trinitycore/CMakeLists.txt @@ -33,10 +33,6 @@ add_definitions( IF (DO_MYSQL) SET(trinity-core_LINK_FLAGS "-pthread ${trinity-core_LINK_FLAGS}") ENDIF(DO_MYSQL) -IF (DO_POSTGRESQL) - SET(trinity-core_LINK_FLAGS "-pthread ${trinity-core_LINK_FLAGS}") -ENDIF(DO_POSTGRESQL) - IF (CMAKE_SYSTEM_NAME MATCHES "Darwin") SET(trinity-core_LINK_FLAGS "-framework Carbon ${trinity-core_LINK_FLAGS}") @@ -68,7 +64,6 @@ ${SCRIPT_LIB} ${READLINE_LIBRARY} ${TERMCAP_LIBRARY} ${MYSQL_LIBRARIES} -${POSTGRESQL_LIBRARIES} ${SSLLIB} ${ACE_LIBRARY} ${ZLIB} diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist index 9b1aad966d2..274412fc5dc 100644 --- a/src/trinitycore/trinitycore.conf.dist +++ b/src/trinitycore/trinitycore.conf.dist @@ -26,7 +26,6 @@ # CharacterDatabaseInfo # Database connection settings for the world server. # Default: -# ---MYSQL--- # hostname;port;username;password;database # .;somenumber;username;password;database # - use named pipes in Windows @@ -34,11 +33,6 @@ # "enable-named-pipe" to [mysqld] section my.ini # .;/path/to/unix_socket;username;password;database # - use Unix sockets in Unix/Linux -# ---PGSQL--- -# hostname;port;username;password;database -# .;/path/to/unix_socket/DIRECTORY or . for default path; -# username;password;database -# - use Unix sockets in Unix/Linux # # MaxPingTime # Settings for maximum database-ping interval (minutes between pings) diff --git a/src/trinityrealm/CMakeLists.txt b/src/trinityrealm/CMakeLists.txt index 9a6128fa656..8f3e9b87540 100644 --- a/src/trinityrealm/CMakeLists.txt +++ b/src/trinityrealm/CMakeLists.txt @@ -31,9 +31,6 @@ add_definitions( IF (DO_MYSQL) SET(trinity-realm_LINK_FLAGS "-pthread ${trinity-realm_LINK_FLAGS}") ENDIF(DO_MYSQL) -IF (DO_POSTGRESQL) - SET(trinity-realm_LINK_FLAGS "-pthread ${trinity-realm_LINK_FLAGS}") -ENDIF(DO_POSTGRESQL) IF (CMAKE_SYSTEM_NAME MATCHES "Darwin") SET(trinity-realm_LINK_FLAGS "-framework Carbon ${trinity-realm_LINK_FLAGS}") @@ -52,7 +49,6 @@ trinityconfig zlib ${SSLLIB} ${MYSQL_LIBRARIES} -${POSTGRESQL_LIBRARIES} ${OSX_LIBS} ) @@ -62,4 +58,3 @@ install(TARGETS trinity-realm DESTINATION bin) ########### install files ############### install(FILES trinityrealm.conf.dist DESTINATION etc) - diff --git a/src/trinityrealm/trinityrealm.conf.dist b/src/trinityrealm/trinityrealm.conf.dist index a561e652cc1..e98b9386878 100644 --- a/src/trinityrealm/trinityrealm.conf.dist +++ b/src/trinityrealm/trinityrealm.conf.dist @@ -8,7 +8,6 @@ # LoginDatabaseInfo # Database connection settings for the realm server. # Default: -# ---MYSQL--- # hostname;port;username;password;database # .;somenumber;username;password;database # - use named pipes in Windows @@ -16,11 +15,6 @@ # "enable-named-pipe" to [mysqld] section my.ini # .;/path/to/unix_socket;username;password;database # - use Unix sockets in Unix/Linux -# ---PGSQL--- -# hostname;port;username;password;database -# .;/path/to/unix_socket/DIRECTORY or . for default path; -# username;password;database -# - use Unix sockets in Unix/Linux # # LogsDir # Logs directory setting. |