Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYKEI-0001nR-Lq for pgsql-odbc@arkaria.postgresql.org; Thu, 10 Apr 2014 19:01:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WYKEI-0003Gu-4q for pgsql-odbc@arkaria.postgresql.org; Thu, 10 Apr 2014 19:01:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYKEG-0003FW-NS for pgsql-odbc@postgresql.org; Thu, 10 Apr 2014 19:01:40 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WYKED-0007Qe-JF for pgsql-odbc@postgresql.org; Thu, 10 Apr 2014 19:01:40 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 7C5D4285B3 for ; Thu, 10 Apr 2014 12:01:32 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 747B5B31CC for ; Thu, 10 Apr 2014 12:01:32 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id 9FC95120032 for ; Thu, 10 Apr 2014 12:01:25 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA for ; Thu, 10 Apr 2014 12:01:24 -0700 (PDT) Message-ID: <5346EA8A.5080902@vmware.com> Date: Thu, 10 Apr 2014 22:01:30 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: "pgsql-odbc@postgresql.org" Subject: SQLGetDiagRec should not clear error. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.5 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org A colleague of mine pointed out that calling SQLGetDiagRec on a connection, after the connection has failed, clears the current error. The consequence is that if you call SQLGetDiagRec twice, and the first call returns an error, the second call might return no error. According to the ODBC spec: > Calls to SQLGetDiagRec are nondestructive to the header and record > fields. The application can call SQLGetDiagRec again at a later time to > retrieve a field from a record as long as no other function, except > SQLGetDiagRec, SQLGetDiagField, or SQLError, has been called in the interim. Digging into the commit log, the code line that clears the error message in CC_get_error has been there since the very first commit. I pushed a patch to fix that, removing the line in CC_get_error that clears the error number. I also added a regression test that demonstrates the issue. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc