In that case, I would recommend that you use the binding functions to access the data. If you wanted to emulate a struct-type data access, you could still do this.
Instead of using DBGetColDouble(), use DBBindColDouble() and bind the fields to struct fields.
ex:
struct DBTable
{
double m_ValDB;
// more fields
int m_ValDB_status;
// more field status variables
};
int SelectAndBind(struct DBTable *table)
{
int hstmt = DBActivateSQL (hdbc, "SELECT ValDB FROM Account");
DBBindColDouble (hstmt, 1, &table->m_ValDB, &table->m_ValDB_status);
// bind other fields as needed
return hstmt;
}
void ProcessResults(void)
{
struct DBTable table;
int hstmt = SelectAndBind(&table);
while (DBFetchNext(hstmt) == 0)
{
if (table.m_valDB_status >= 0)
{
// process table.m_ValDB
}
}
}You still have to maintain the column -> SQL mapping in one place, but everywhere else you can use the named variable instead.
Regards,
-alex
Message Edited by Alex D on 12-19-2006 10:07 AM