pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lothar.behrens@lollisoft.de
To: pgsql-odbc@postgresql.org
Subject: Updating bool column problems
Date: Sat, 30 Apr 2005 12:06:22 +0200
Message-ID: <427374BE.10264.7971DC@localhost> (raw)

Hi,

I have detected that my test application - a console app, crashes when I try to 
update a bool column. I haven't realized this with my GUI app.

Here are the code snippets, that may relate to the problem:

Binding the column of type SQL_BIT (rows is 2):

buffer = malloc((sizeof(bool))*rows);
_DataType = DataType;
bound = 1;
memset(buffer, 0, sizeof(bool)*rows);
ret = SQLBindCol(hstmt, column, DataType, buffer, sizeof(bool), &cbBufferLength);
if (ret != SQL_SUCCESS) {
        _LOG << "Error: Binding column '" << colName->charrep() << "' failed!" LOG_

        q->dbError("SQLBindCol()");
}
break;

Set the new data is like this:

bool l = false; // or true depending on input

*((bool*) buffer) = l;
//memcpy(buffer, &l, sizeof(bool));

And this is the simple code to update it, where it crashes inside the psqlodbc.dll 
(SQLDummyOrdinal):

retcode = SQLSetPos(hstmt, 1, SQL_UPDATE, SQL_LOCK_NO_CHANGE);

Any ideas ?

Thanks

Lothar

-- 
Lothar Behrens		www.lollisoft.de
Rosmarinstr 3		My public project:
40235 Düsseldorf  	http://sourceforge.net/projects/lbdmf






Message-ID: <427374BE.10264.7971DC@localhost>
Permalink:  ../427374BE.10264.7971DC@localhost/
Also on:    postgresql.org/message-id/427374BE.10264.7971DC@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: lothar.behrens@lollisoft.de
  Subject: Re: Updating bool column problems
  In-Reply-To: <427374BE.10264.7971DC@localhost>
  References: <427374BE.10264.7971DC@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox