I have a class that is used to create a database connection:
class DBHandler
{
public:
DBHandler();
~DBHandler();
int connect();
int execQuery( string query);
string getField( int row, int col);
};
Now there is another class that is used to get some information from the database,
class DBManager
{
public:
DBManager();
~DBManager();
string getUsername()
{
}
string getUsername (struct QueryDetails& qDetails)
{
}
};
Now here is the problem:
1) to which I must follow:
- A) If I use approach 1, then I need to request a hard code.
- B) If I use approach 2, I need to populate the structure every time before calling the getUsername function.
2) Is there a better solution than two that would be common?
PS: Structure Definition
struct QueryDetails
{
string tableName;
vector<string> colList;
...
};
source
share