I can not paste original code, as it is against org policy. I can try to explain with e.g
As per odbc steps to connect sql server we are doing following things
I am passing void pointer from C code for binding output from stored proc.
step1: Connection creation, Command preparation and execution
step 2: Using SQLDescribeCol function i try to find column attributes. such as data type, lenght etc..
e.g
Code:
if(datatype == SQL_VARCHAR)
{
ctype=SQL_C_CHAR;
}
step 3: Using SQLBindCol(cmd, 1, ctype, data, sizeof(data), &indicator)
step 4:
Code:
while(SQLFETCH(cmd))
{ parseData(data);}
void parseData(void *data, type)
{ if(type =SQL_VARCHAR)
{
char val[] ;
val = (char *)data;
}
}
Note: Their might be syntax error in this code. This is just for reference