Hi,
I'm trying to fetch more than 1 row at a time with SQLDBC and I'm having
troubles either allocating enough memory or problems accessing more than
just the first row of each fetch. First I'll give a little example of
the allocation and access of 1 row then maybe someone can show me how it
needs to be altered for more than 1 row.
// not a real working example but basically what i'm doing that works
for 1 row
char ** resultSet = (char **) malloc(sizeof(char *)*(numOfColumns+1));
for(int i = 1; i <= numOfColumns; i++)
{
int colLength = meta->getColumnLength(i) + 1;
resultSet[i] = (char *) malloc(sizeof(char *)*colLength);
rc = result->bindColumn(i, SQLDBC_HOSTTYPE_ASCII, resultSet[i], NULL,
colLength, true);
}
while(result->next() == SQLDBC_OK)
{
rowSet = result->getRowSet();
rc = rowSet->fetch();
for(i = 1; i <= numOfColumns; i++)
{
printf("%s\n", resultSet[i]);
}
}
That isn't a full code listing but it shows what I'm doing and it works
when you do result->setRowSetSize(1); but its not setup for having the
row set size more than 1, so I'm looking for suggestions on how to deal
with allocating the memory and accessing with a larger setRowSetSize.