Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZcpEK-0002As-0C for pgsql-odbc@arkaria.postgresql.org; Fri, 18 Sep 2015 06:33:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZcpEJ-0001eg-DM for pgsql-odbc@arkaria.postgresql.org; Fri, 18 Sep 2015 06:33:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZcpEI-0001eO-OW for pgsql-odbc@postgresql.org; Fri, 18 Sep 2015 06:33:07 +0000 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZcpEE-0004Q6-PY for pgsql-odbc@postgresql.org; Fri, 18 Sep 2015 06:33:05 +0000 Received: by wiclk2 with SMTP id lk2so50851402wic.0 for ; Thu, 17 Sep 2015 23:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Ll3DQ+7mRSn6v3dp9Rf+UP88IGszDLT2WfMhrZtuNgM=; b=yzm9NlkvuyqZiB9bDEVYtV6iW/3NLj+iGSaT+7r78GZxWMEf2VLJzfb2jSbfoeK6Tj Ama1lPE90NBaFlI2qYcwV2r4A+M2P0PjOIpwAmNmcWVaDHC4eXXiqP9Oo5ePTeXn113u wmRC+3sOEyO2gnGt9sSS2vxEh1lATYuKJoHcMyuIhqgLPxUYpJ7JPgHGONFmjiuqeYB5 voIR0Kea0YU7umaCJopZm5hwAss1C4dZ5PajJa4HW9gbPWnR0c6ZOwYixqqk6radcPzP 4E5Yfe6qAZM1/5lIzh9tTEYsFJq3duDdAWT1KezfS+pGKxpN+T6hN2+1jKM1iC4FvYiF miPA== X-Received: by 10.180.219.101 with SMTP id pn5mr34702715wic.89.1442557981147; Thu, 17 Sep 2015 23:33:01 -0700 (PDT) Received: from [192.168.1.110] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id pk7sm7127510wjb.2.2015.09.17.23.32.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 23:33:00 -0700 (PDT) Message-ID: <55FBB01A.1070004@iki.fi> Date: Fri, 18 Sep 2015 09:32:58 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 MIME-Version: 1.0 To: PSequel Support CC: pgsql-odbc@postgresql.org Subject: Re: Bug in the SQLGetDiagRec function of psqlodbc References: <55F9625D.6040001@iki.fi> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 09/18/2015 08:13 AM, PSequel Support wrote: > Thanks for your reply! Actually I've tried calling SQLFreeStmt after each > query, but it doesn't seem to change anything. See the example code below. > > #include #include #include > void printError(SQLHANDLE handle) { > char message[256]; > SQLSMALLINT i = 0; > while (SQLGetDiagRec(SQL_HANDLE_DBC, handle, ++i, NULL, NULL, > (SQLCHAR*)message, sizeof(message), NULL) != SQL_NO_DATA) { > printf("%s\n", message); > }} > ... Oh, you're getting the diagnostic from the *connection* handle, not the statement handle. According to the documentation of SQLExecDirect(), it sets the diagnostics on the statement handle. I agree that psqlODBC's behaviour here is pretty strange, and probably incorrect. I wouldn't expect SQLExecDirect to set any diagnostics on the connection handle, at least for a syntax error. But if it does, the second call probably should do so as well, and overwrite the previous error message. But the immediate fix for your application would be to get the diagnostics from the statement handle instead of the connection handle. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc