Unix Technical Forum

Updating bool column problems

This is a discussion on Updating bool column problems within the pgsql Interfaces odbc forums, part of the PostgreSQL category; --> Hi, I have detected that my test application - a console app, crashes when I try to update a ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces odbc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-16-2008, 02:11 AM
lothar.behrens@lollisoft.de
 
Posts: n/a
Default Updating bool column problems

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




---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:35 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com