Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id D934C9F9FB2 for ; Mon, 18 Dec 2006 18:54:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 78291-10 for ; Mon, 18 Dec 2006 18:53:59 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id E0B5A9F9C35 for ; Mon, 18 Dec 2006 18:53:58 -0400 (AST) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id B4396308F7; Mon, 18 Dec 2006 23:53:57 +0100 (MET) From: "lothar.behrens@lollisoft.de" X-Newsgroups: pgsql.interfaces.odbc Subject: Still SQLSetPos problem even with minimal sample, SQL_NULL_DATA and SQL_COLUMN_IGNORE ? Date: 18 Dec 2006 14:53:44 -0800 Organization: http://groups.google.com Lines: 93 Message-ID: <1166482424.555811.255330@j72g2000cwa.googlegroups.com> References: <1165751917.708138.93120@j72g2000cwa.googlegroups.com> <457CACE1.2090907@tpf.co.jp> <1165848049.639913.7360@n67g2000cwd.googlegroups.com> <457DF1D9.7080804@tpf.co.jp> <1165955153.386694.185060@f1g2000cwa.googlegroups.com> <457F4E43.108@tpf.co.jp> <1166311419.967140.317720@16g2000cwy.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Complaints-To: groups-abuse@google.com In-Reply-To: <1166311419.967140.317720@16g2000cwy.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/312.8.1 (KHTML, like Gecko) Safari/312.6,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: j72g2000cwa.googlegroups.com; posting-host=84.161.41.181; posting-account=ZEv0oQwAAAARGOrW-5pO2M_10hQ_J_Pj To: pgsql-odbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/76 X-Sequence-Number: 8523 Hi, I have implemented setting SQL_COLUMN_IGNORE, SQL_NULL_DATA and have added functions to indicate this state. I have made a 'small' sample application to demonstrate this, but I still use my ODBC wrapper classes in that sample application. You may get access to the full code. Ask for it! The first insert is with valid foreign keys and no column set to NULL. This insert works. My next insert has set the columns to NULL, but it inserts the values of the last insert. SetNull("column XYZ"); does not work, even I check before and after the update command, that the columns are still set to NULL. This is as expected. If I set illegal foreign keys and also have set NULL column, I get the following error: lbDB.cpp, 3417: Error in lbQuery: (SQLSetPos()) HY000: 7 - [unixODBC]Error while executing the query; FEHLER: Einf=FCgen oder Aktualisieren in Tabelle =BBuser_anwendungen=AB verletzt Fremdschl=FCssel-Constraint =BBcst_user_anwendungen_anwendungenid=AB Currently I have made an array of long (cbBufferLength[2]) and set this explicitely short before the call to SQLSetPos: if (mode =3D=3D 1) // 1 means adding cbBufferLength[1] =3D SQL_NULL_DATA+SQL_COLUMN_IGNORE; else cbBufferLength[0] =3D SQL_NULL_DATA+SQL_COLUMN_IGNORE; SQLRETURN ret; ret =3D SQLDescribeCol( hstmt, _column, ColumnName, BufferLength, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable); _isNullable =3D Nullable =3D=3D 1; if (ret !=3D SQL_SUCCESS) { printf("Error: Failed to get column description for column %d.\n", _column); query->dbError("SQLDescribeCol()", hstmt); } ret =3D SQLBindCol(hstmt, _column, DataType, buffer, 0, cbBufferLength); // ... lbErrCodes LB_STDCALL lbQuery::update() { lbErrCodes err =3D ERR_NONE; if (boundColumns !=3D NULL) { boundColumns->indicateNullValues(); // calls the above code per NULL column. boundColumns->unbindReadonlyColumns(); // Unbinds readonly columns if ((mode =3D=3D 1) && (!boundColumns->hasValidData())) { // either set valid with setNull() or setString("...") per column. _CL_LOG << "Error: Query has not got valid data to be added." LOG_ mode =3D 0; return ERR_DB_UPDATEFAILED; } } if (mode =3D=3D 1) { retcode =3D SQLSetPos(hstmt, 2, SQL_ADD, SQL_LOCK_NO_CHANGE); if (retcode !=3D SQL_SUCCESS) { dbError("SQLSetPos()", hstmt); _LOG << "lbQuery::update(...) adding failed." LOG_ // ... The functions are definitely called and cbBufferLength[1] is set to -7 (SQL_NULL_DATA+SQL_COLUMN_IGNORE) I have no idea what could be wrong. :-( Hope to get a light :-) Thanks, Lothar