On Sat, Sep 25, 2021 at 09:16:33AM +0200, Pierre Couderc wrote:
> 
> On 9/24/21 5:31 PM, Henning Follmann wrote:
> > 
> > and I see you do not do any error checking.
> > This would be a first step to find out where it fails.
> > 
> > I added some code...
> > 
> 
> You hare fully right, I have corrected, but I have the same result and no
> more idea.. :

I do not have much time this weekend, but I will try to set up my
computer to reproduce your setup  - maybe on Monday ...

In the meanwhile a few thoughts,
have you tried to use the odbc lib from unixodbc instead of
libiodbc?

Another thing I have myself no clue but, what happens if you do
not set the odbc version?

And just one thought about your loop:

try
do {
/* in there look at SQLSTATE
   for anything other than SQL_SUCCESS
   I am concerned that SQL_NO_DATA is
   not a reliable break indicator */



}while (ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO)

> 
> nous@pcouderc:~/projets/tttt/build$ ./ttest
> D  0.0:ln 19:main(): Start  : Compile time : Sep 25 2021 09:03:28
> 
> 0x55cee70a5ed0
> 
> 
> 
> nous@pcouderc:~/projets/tttt/build$ cat ../main.cpp
> #include <iostream>
> #include <string>
> #include <stdio.h>
> #pragma GCC diagnostic ignored "-Wendif-labels"
> #pragma GCC diagnostic ignored "-Wwrite-strings"
> 
> 
> #define TDBG clock_t ttdbg=clock();float
> ftdbg=((float)ttdbg)/CLOCKS_PER_SEC;
> #define DBG_(fmt, args...) {TDBG fprintf(stdout,string( string("D%5.1f:ln
> %d:%s(): ")+fmt).c_str(),ftdbg,__LINE__, __func__, ##args);fflush(stdout);}
> 
> using namespace std;
> extern "C"
> {
> #include <sql.h>
> #include <sqlext.h>
> }
> int main(int argc, char **argv)
> {
>     DBG_("Start  : Compile time : " __DATE__" " __TIME__"\n");
>     SQLHENV env;
>     SQLCHAR driver[256];
>     SQLCHAR attr[256];
>     SQLSMALLINT driver_ret;
>     SQLSMALLINT attr_ret;
>     SQLUSMALLINT direction;
>     SQLRETURN ret;
> 
>     ret=SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &env);
>     if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
>             cerr << "Failed to allocate handle" << endl;
>             return -1;
>     }
>     ret=SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
>     if (ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO) {
>             cerr << "Failed SQLSetEnvAttr" << endl;
>             return -1;
>     }
>     cout << env<<endl;
>     direction = SQL_FETCH_FIRST;
>     while(1)
>     {
>     ret = SQLDrivers(env, direction,
>                                             driver, sizeof(driver),
> &driver_ret,
>                                             attr, sizeof(attr), &attr_ret);
>             if(ret==SQL_NO_DATA) break;
>             printf("%s - %s\n", driver, attr);
>             if (ret == SQL_SUCCESS_WITH_INFO) printf("\tdata truncation\n");
>             direction = SQL_FETCH_NEXT;
>     }
>     return 0;
> }
> 
> 
> 


Have a nice weekend.
-H

-- 
Henning Follmann           | hfollm...@itcfollmann.com

Reply via email to