Re: VARCHAR, CHAR types changed ?

From: lothar(dot)behrens(at)lollisoft(dot)de
To: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: VARCHAR, CHAR types changed ?
Date: 2005-11-25 19:27:38
Message-ID: 438773BA.28272.54410F@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Am 25 Nov 2005 um 14:35 hat Dave Page geschrieben:

My query function first calls SQLExecDirect(hstmt, _query, SQL_NTS);
I have changed this to do exactly the same as your sample and pass the length of the
string. No way.

As you have put together a complete sample application, I have tried this compiled
with Open Watcom 1.3 and MS Visual C++ 6.0. Both do the same. They crash inside
the call to SQLExecDirect.

My registered ODBC driver DLL is 335.872 bytes and from 11.11.2005 08:29:42

With Open Watcom debugger, I found the crash inside ConfigDSN. Is there any
change in the ordinals inside the PSQLODBCA.dll ?

The same happens, if I rename the DLL filenames :-)

Regards

Lothar

>
>
> > -----Original Message-----
> > From: pgsql-odbc-owner(at)postgresql(dot)org
> > [mailto:pgsql-odbc-owner(at)postgresql(dot)org] On Behalf Of
> > lothar(dot)behrens(at)lollisoft(dot)de
> > Sent: 25 November 2005 13:21
> > To: pgsql-odbc(at)postgresql(dot)org
> > Subject: Re: [ODBC] VARCHAR, CHAR types changed ?
> >
> > I have tried to use ANSI driver. It crashes :-(
> >
> > My code to connect and setup a statement looks like this:
> >
> <snip code>
>
> >
> > The code is simple console based, but my database classes encapsulate
> > all ODBC
> > CLI calls. The internal statement handle is reused. The table get's
> > created and filled.
> >
> > Any ideas ?
>
> Well, I've tried the code below which is roughly as close as I can get
> to what you posted (not having your query class), and it SQLExecDirect's
> just fine here. Any thoughts on what might be significantly different
> here?:
>
> Regards, Dave.
>
> #include <windows.h>
> #include <sqlext.h>
> #include <stdio.h>
>
>
> int main(void)
> {
> HENV henv = NULL; // Env
> Handle from SQLAllocEnv()
> HDBC hdbc = NULL; //
> Connection handle
> HSTMT hstmt = NULL; //
> Statement handle
> UCHAR DSN[SQL_MAX_DSN_LENGTH] = "ansi"; // Data
> Source Name buffer
> UCHAR user[64] = "postgres"; // User
> ID buffer
> UCHAR* passwd = NULL; //
> Password buffer
>
> SQLAllocEnv (&henv);
>
> SQLAllocConnect (henv, &hdbc);
>
> SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (void*) SQL_OV_ODBC3, 0);
>
> SQLSetConnectAttr(hdbc,
> SQL_ATTR_ODBC_CURSORS,
> SQL_CUR_USE_IF_NEEDED, 0);
>
> SQLConnect(hdbc, DSN, SQL_NTS,
> user, SQL_NTS,
> passwd, SQL_NTS);
>
> SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON);
>
> SQLAllocStmt (hdbc, &hstmt);
>
> SQLSetStmtOption(hstmt, SQL_ATTR_CONCURRENCY, SQL_CONCUR_ROWVER);
> SQLSetStmtOption(hstmt, SQL_CURSOR_TYPE, SQL_CURSOR_KEYSET_DRIVEN);
>
>
>
> UCHAR buf1[] = "create table regressiontest ("
> "test char(100) DEFAULT 'Nothing',\n"
> "btest bool DEFAULT false, "
> "btest1 bool DEFAULT false"
> ");";
> UCHAR buf2[] = "insert into regressiontest (test) values('Nix')";
> UCHAR buf3[] = "insert into regressiontest (btest) values(true)";
> UCHAR buf4[] = "insert into regressiontest (btest1) values(true)";
>
>
> SQLExecDirect(hstmt, buf1, sizeof(buf1));
> SQLExecDirect(hstmt, buf2, sizeof(buf2));
> SQLExecDirect(hstmt, buf3, sizeof(buf3));
> SQLExecDirect(hstmt, buf4, sizeof(buf4));
>
> // This statement crashes inside SQLExecDirect(...)
> UCHAR buf5[] = "select test, btest, btest1 from regressiontest";
> SQLExecDirect(hstmt, buf5, sizeof(buf5));
>
> // UCHAR buf6[] = "drop table regressiontest";
> // SQLExecDirect(hstmt, buf6, sizeof(buf6));
>
> // Free the allocated statement handle
> SQLFreeStmt (hstmt, SQL_DROP);
>
> // Free the allocated connection handle
> SQLFreeConnect (hdbc);
>
> // Free the allocated ODBC environment handle
> SQLFreeEnv (henv);
>
> return 0;
> }
>
>

--
Lothar Behrens | Rapid Prototyping ...
Rosmarinstr 3 |
40235 Düsseldorf | www.lollisoft.de

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message lothar.behrens 2005-11-25 23:22:38 Re: VARCHAR, CHAR types changed ?
Previous Message Dave Page 2005-11-25 14:35:13 Re: VARCHAR, CHAR types changed ?