Changeset 70fd0e0 in tol


Ignore:
Timestamp:
Feb 15, 2011, 10:43:05 AM (16 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
978b431
Parents:
b7e6cec
Message:

more examples in order to find out what is happening with teradata

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@3197 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tol/dbdrivers
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • tol/dbdrivers/Jamfile

    rb7e6cec r70fd0e0  
    4242        ;
    4343}
     44
     45exe listDSN : listDSN.c odbc : $(odbc_inc) ;
     46exe testOCnn : testOCnn.c odbc : $(odbc_inc) ;
     47
     48explicit listDSN ;
     49explicit testOCnn ;
  • tol/dbdrivers/libtolodbc.c

    rb7e6cec r70fd0e0  
    5959#define MAX_TEXT_FIELD_LENGTH 2048
    6060
    61 //#define TRACE_DEEP 1
     61#define TRACE_DEEP 1
    6262
    6363typedef struct odbcdx {
    … …  
    8080static DBOutWriter stdOutWriter = 0;
    8181
     82void extract_error(
     83    char *fn,
     84    SQLHANDLE handle,
     85    SQLSMALLINT type)
     86{
     87    SQLINTEGER   i = 0;
     88    SQLINTEGER   native;
     89    SQLCHAR      state[ 7 ];
     90    SQLCHAR      text[256];
     91    SQLSMALLINT  len;
     92    SQLRETURN    ret;
     93
     94    fprintf(stderr,
     95            "\n"
     96            "The driver reported the following diagnostics whilst running "
     97            "%s\n\n",
     98            fn);
     99
     100    do
     101    {
     102        ret = SQLGetDiagRec(type, handle, ++i, state, &native, text,
     103                            sizeof(text), &len );
     104        if (SQL_SUCCEEDED(ret))
     105            printf("%s:%ld:%ld:%s\n", state, i, native, text);
     106    }
     107    while( ret == SQL_SUCCESS );
     108}
     109
     110
    82111//-------------------------------------------------------------------
    83112void getDiagRec(odbcd *dbd, int diagType)
    … …  
    93122    handle = dbd->hstmt;
    94123  } else if(diagType==GET_DIAG_DBC) {
     124#ifdef TRACE_DEEP
     125  printf( "Diagnostic for SQL_HANDLE_DBC" );
     126#endif
    95127    handleType = SQL_HANDLE_DBC;
    96128    handle = dbd->hdbc;
    97129  }
    98130
     131#ifdef TRACE_DEEP
     132  extract_error( "TRACE_DEEP", handle, handleType );
     133#endif
    99134  i = 1;
    100135  while ((rc = SQLGetDiagRec(handleType, handle, i, SqlState,
    101136                             &NativeError, Msg, strlen((char*)Msg),
    102137                             &MsgLen)) != SQL_NO_DATA)
    103     {
     138  {
    104139      if(rc==SQL_SUCCESS) {
    105140        char outmsg[SQL_MAX_MESSAGE_LENGTH + 50];
    … …  
    219254  printf( "1.2: SQLSetEnvAttr\n");
    220255#endif
     256  //SQLSetEnvAttr(env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0);
    221257  status = SQLSetEnvAttr(dbd->henv, SQL_ATTR_ODBC_VERSION,
    222                          (long *)SQL_OV_ODBC2, 0);
     258                         (void *)SQL_OV_ODBC3, 0);
    223259  if(!checkSQLRet(status, dbd, __LINE__, NO_DIAG)) {
    224260    closeODBC(dbd, 1); //"1" -> last step done: SQLAllocHandle SQLHENV
Note: See TracChangeset for help on using the changeset viewer.