Re: VARCHAR, CHAR types changed ?

From: "lothar(dot)behrens(at)lollisoft(dot)de" <lothar(dot)behrens(at)lollisoft(dot)de>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: VARCHAR, CHAR types changed ?
Date: 2005-11-25 13:20:49
Message-ID: 1132924849.659236.187420@o13g2000cwo.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

I have tried to use ANSI driver. It crashes :-(

My code to connect and setup a statement looks like this:

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, (unsigned char*) DSN, SQL_NTS,
(unsigned char*) user, SQL_NTS,
(unsigned char*) passwd, SQL_NTS);

SQLSetConnectOption(hdbc, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_ON);

SQLSetStmtOption(hstmt, SQL_ATTR_CONCURRENCY, SQL_CONCUR_ROWVER);
SQLSetStmtOption(hstmt, SQL_CURSOR_TYPE, SQL_CURSOR_KEYSET_DRIVEN);

This is my standard setup to do database work. All these steps do not
report any error.

The following happens:

char buf[] = "create table regressiontest ("
"test char(100) DEFAULT 'Nothing',\n"
"btest bool DEFAULT false, "
"btest1 bool DEFAULT false"
");";

// Do not internally collect meta data, like foreign key to primary key
mapping
query->skipFKCollecting();
query->query(buf);

// Tese statements work properly
query1->query("insert into regressiontest (test) values('Nix')");
query1->query("insert into regressiontest (btest) values(true)");
query1->query("insert into regressiontest (btest1) values(true)");

// This statement crashes inside SQLExecDirect(...)
query1->query("select test, btest, btest1 from regressiontest");

query1->PrintData();
query->query("drop table regressiontest");

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 ?

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Dave Page 2005-11-25 14:35:13 Re: VARCHAR, CHAR types changed ?
Previous Message Dave Page 2005-11-25 12:31:27 Re: VARCHAR, CHAR types changed ?