This commit is contained in:
jed
2011-10-28 16:51:35 -07:00
parent e68b0fb8d1
commit 7436a8deec
29 changed files with 141 additions and 129 deletions

View File

@@ -70,7 +70,13 @@ int SqliteDatabase::getLastInsertID()
// returns false if there are no results
bool SqliteDatabase::startIterRows()
{
needs to fill out the column table
mColNameTable.clear();
mColNameTable.resize(sqlite3_column_count(mCurrentStmt));
for(unsigned n=0; n<mColNameTable.size(); n++)
{
mColNameTable[n]=sqlite3_column_name(mCurrentStmt,n);
}
return(mMoreRows);
}

View File

@@ -7,14 +7,10 @@ Database::Database(const char* host,const char* user,const char* pass) : mNumCol
mDBPass=pass;
mHost=host;
mUser=user;
mColNameTable=NULL;
}
Database::~Database()
{
delete[] mColNameTable;
}
@@ -83,7 +79,7 @@ uint64 Database::getBigInt(const char* colName)
// returns false if can't find col
bool Database::getColNumber(const char* colName,int* retIndex)
{
for(int n=0; n<mNumCol; n++)
for(unsigned int n=0; n<mColNameTable.size(); n++)
{
if(stricmp(colName,mColNameTable[n].c_str())==0)
{

View File

@@ -2,6 +2,7 @@
#define __DATABASE__
#include <string>
#include <vector>
#include "../types.h"
/*
@@ -14,7 +15,7 @@ protected:
std::string mUser;
std::string mHost;
std::string mDBPass;
std::string* mColNameTable;
std::vector<std::string> mColNameTable;
bool getColNumber(const char* colName, int* retIndex);