Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDOpv-0005c9-Py for pgsql-odbc@arkaria.postgresql.org; Fri, 19 Oct 2018 07:04:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gDOpr-0005Rx-D4 for pgsql-odbc@arkaria.postgresql.org; Fri, 19 Oct 2018 07:04:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDOpr-0005Rp-77 for pgsql-odbc@lists.postgresql.org; Fri, 19 Oct 2018 07:04:39 +0000 Received: from webclient5.webclient5.de ([136.243.32.184]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gDOpn-0006yE-Vp for pgsql-odbc@lists.postgresql.org; Fri, 19 Oct 2018 07:04:38 +0000 Received: from [10.1.2.4] (unknown [94.101.37.79]) by webclient5.webclient5.de (Postfix) with ESMTPSA id 06D595583965 for ; Fri, 19 Oct 2018 09:04:31 +0200 (CEST) Subject: Re: What is the problem with this code? To: pgsql-odbc@lists.postgresql.org References: From: Clemens Ladisch Message-ID: <33da99f0-c583-6a0f-65f7-12873df6e632@ladisch.de> Date: Fri, 19 Oct 2018 09:04:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.99.4 at webclient5 X-Virus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Igor Korot wrote: > SQLWCHAR *qry1 = new SQLWCHAR[query1.length() + 2]; > memset( qry1, '\0', query1.length() + 2 ); memset expects the length to be in bytes. > ret = SQLPrepare( m_hstmt, qry1, SQL_NTS ); > ret = SQLDescribeCol( m_hstmt, 1, columnName, 256, &columnNameLen, &columnDataType, &columnDataSize, &columnDataDigits, &columnDataNullable ); > > The SQLDescribeCol() call fails with the error invalid column number". Does SQLExecute work? Does SQLNumResultCols give 1? The specification says "for performance reasons, an application should not call SQLDescribeCol before executing a statement." But it should work anyway; if not, this would be a bug. What are the settings of "Parse Statements" and "Server side prepare" of the data source? Regards, Clemens