Tidy up database class files

This commit is contained in:
Vinnie Falco
2013-06-21 07:18:21 -07:00
parent 30213d24fa
commit 8a6d53ac64
9 changed files with 55 additions and 52 deletions

View File

@@ -1,5 +1,3 @@
// VFALCO TODO Rename the protobuf namespace from ripple to 'wire' or something
//
package protocol;
enum MessageType

View File

@@ -4,9 +4,11 @@
*/
//==============================================================================
#ifndef __DATABASE__
#define __DATABASE__
#ifndef RIPPLE_DATABASE_RIPPLEHEADER
#define RIPPLE_DATABASE_RIPPLEHEADER
// VFALCO Get rid of these macros
//
#define SQL_FOREACH(_db, _strQuery) \
if ((_db)->executeSQL(_strQuery)) \
for (bool _bMore = (_db)->startIterRows(); _bMore; _bMore = (_db)->getNextRow())
@@ -23,21 +25,15 @@ class JobQueue;
class Database
{
protected:
int mNumCol;
std::string mUser;
std::string mHost;
std::string mDBPass;
std::vector<std::string> mColNameTable;
bool getColNumber (const char* colName, int* retIndex);
public:
// VFALCO TODO how are user and password even used?
//
Database (const char* host, const char* user, const char* pass);
static Database* newMysqlDatabase (const char* host, const char* user, const char* pass);
virtual ~Database ();
virtual void connect () = 0;
virtual void disconnect () = 0;
std::string& getPass ()
@@ -104,6 +100,15 @@ public:
{
return -1;
}
protected:
bool getColNumber (const char* colName, int* retIndex);
int mNumCol;
std::string mUser;
std::string mHost;
std::string mDBPass;
std::vector <std::string> mColNameTable;
};
#endif

View File

@@ -6,7 +6,7 @@
SETUP_LOG (SqliteDatabase)
using namespace std;
//using namespace std;
SqliteStatement::SqliteStatement (SqliteDatabase* db, const char* sql, bool aux)
{

View File

@@ -4,8 +4,8 @@
*/
//==============================================================================
#ifndef RIPPLE_SQLITEDATABASE_H
#define RIPPLE_SQLITEDATABASE_H
#ifndef RIPPLE_SQLITEDATABASE_RIPPLEHEADER
#define RIPPLE_SQLITEDATABASE_RIPPLEHEADER
struct sqlite3;
struct sqlite3_stmt;