X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1463C11F6223 for ; Thu, 30 Mar 2006 06:47:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 19695-09 for ; Thu, 30 Mar 2006 06:47:10 -0400 (AST) Received: from pgfoundry.org (pgfoundry.org [200.46.204.130]) by postgresql.org (Postfix) with ESMTP id DD4EE11F6222 for ; Thu, 30 Mar 2006 06:47:08 -0400 (AST) Received: from localhost (av.hub.org [200.46.204.144]) by pgfoundry.org (Postfix) with ESMTP id 9A8A910338CC; Thu, 30 Mar 2006 10:47:09 +0000 (GMT) Received: from pgfoundry.org ([200.46.204.130]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 23113-04; Thu, 30 Mar 2006 06:47:07 -0400 (AST) Received: by pgfoundry.org (Postfix, from userid 80) id 28833103385C; Thu, 30 Mar 2006 10:47:07 +0000 (GMT) To: noreply@pgfoundry.org From: Subject: [ psqlodbc-Bugs-1000601 ] Strange different behaviour of with SQLColAttribute with SQL_DESC_OCTET or SQL_DESC_LENGHT Content-type: text/plain; charset=UTF-8 Message-Id: <20060330104707.28833103385C@pgfoundry.org> Date: Thu, 30 Mar 2006 10:47:07 +0000 (GMT) X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=-0.5 required=5 tests=[ALL_TRUSTED=-1.44, AWL=0.390, NO_REAL_NAME=0.55, UPPERCASE_25_50=0] X-Spam-Score: -0.5 X-Spam-Level: X-Archive-Number: 200603/225 X-Sequence-Number: 7511 Bugs item #1000601, was opened at 2006-03-30 10:47 You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000601&group_id=1000125 Category: Interface (example) Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Strange different behaviour of with SQLColAttribute with SQL_DESC_OCTET or SQL_DESC_LENGHT Initial Comment: Dear ladies and gentlemen I stumbeled upon the following problelm PSQL 8.1.x, (Unicode) System Windows 2003 Server I have a database test with the following table t2 (i_val integer) I run a query against this table and try to retrieve informaton about the result. Here's the code (bare all error handling) now #include #include #include #include #include #include #include "odb.h" enum {SOME_LIMIT=512}; int main(void){ char * dsn = "DSN=t2_psql"; enum {BUF_SIZE=512}; SQLHENV henv; SQLHDBC hdbc; SQLHSTMT hstmt; SQLRETURN rc; SQLINTEGER data_size; SQLCHAR con_out[BUF_SIZE]; SQLSMALLINT con_out_count; rc = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv); assert(SUCCEEDED(rc)); rc = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0); assert(SUCCEEDED(rc)); rc = SQLAllocHandle (SQL_HANDLE_DBC, henv, &hdbc); assert(SUCCEEDED(rc)); rc = SQLDriverConnect(hdbc, NULL, dsn, SQL_NTS, con_out, sizeof(con_out), &con_out_count, SQL_DRIVER_COMPLETE); assert(SUCCEEDED(rc)); rc = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt); assert(SUCCEEDED(rc)); rc = SQLExecDirect(hstmt, (SQLCHAR*) "select * from t2", SQL_NTS); assert(SUCCEEDED(rc)); rc = SQLColAttribute(hstmt, 1, SQL_DESC_OCTET_LENGTH, NULL, 0, NULL, &con_out_count); assert(SUCCEEDED(rc)); printf("con_out_count = %d\n", con_out_count); /* con_out_count = -1; rc = SQLColAttribute(hstmt, 1, SQL_DESC_LENGTH, NULL, 0, NULL, &con_out_count); printf("con_out_count = %d\n", con_out_count); */ SQLCloseCursor(hstmt); SQLFreeHandle(SQL_HANDLE_STMT, hstmt); rc = SQLDisconnect(hdbc); SQLFreeHandle(SQL_HANDLE_DBC, hdbc); SQLFreeHandle(SQL_HANDLE_ENV, henv); return 0; } If I run SQLColAttribute with SQL_DESC_OCTET_LENGTH I got as size for the first field an integer! 0 But if I use SQL_DESC_LENGTH I got 4. Of course here the 4 is correct AFAIKT. This difference leads to a crash in an application in which I try to fetch the information for a generic SQL call. Now is this an error in my usage? Is this correct behaviour or is it a bug in psqlODBC? Regards Friedrich ---------------------------------------------------------------------- You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1000601&group_id=1000125