aboutsummaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorclick <none@none>2010-05-06 09:53:09 +0200
committerclick <none@none>2010-05-06 09:53:09 +0200
commitcb84d3e617975d172ec1be043810554bac09cb83 (patch)
tree4e2ed1445865704d8ac6959f240847942a7659f0 /src/shared
parent38061a6fa6dc661125175e82ff98104761acb70a (diff)
Cleanup : Remove postgreSQL-support (not used and has also been broken for a long time)
--HG-- branch : trunk
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/Database/CMakeLists.txt5
-rw-r--r--src/shared/Database/DatabaseEnv.h11
-rw-r--r--src/shared/Database/DatabaseMysql.cpp3
-rw-r--r--src/shared/Database/DatabaseMysql.h3
-rw-r--r--src/shared/Database/DatabasePostgre.cpp384
-rw-r--r--src/shared/Database/DatabasePostgre.h77
-rw-r--r--src/shared/Database/PGSQLDelayThread.h33
-rw-r--r--src/shared/Database/QueryResultMysql.cpp3
-rw-r--r--src/shared/Database/QueryResultMysql.h3
-rw-r--r--src/shared/Database/QueryResultPostgre.cpp139
-rw-r--r--src/shared/Database/QueryResultPostgre.h52
-rw-r--r--src/shared/Database/SQLStorage.cpp4
-rw-r--r--src/shared/Database/SqlDelayThread.cpp4
13 files changed, 0 insertions, 721 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()