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 52F359DCAA8 for ; Mon, 5 Dec 2005 11:16:46 -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 73401-01 for ; Mon, 5 Dec 2005 11:16:49 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp.pzkagis.cz (gis6.netbox.cz [83.240.30.214]) by postgresql.org (Postfix) with ESMTP id B9A039DCAAC for ; Mon, 5 Dec 2005 11:16:41 -0400 (AST) Received: (from luf@localhost) by smtp.pzkagis.cz (8.11.6/8.11.6) id jB5FGkc16276 for pgsql-odbc@postgresql.org; Mon, 5 Dec 2005 16:16:46 +0100 Date: Mon, 5 Dec 2005 16:16:46 +0100 From: Ludek Finstrle To: pgsql-odbc@postgresql.org Subject: ODBC driver failure Message-ID: <20051205151646.GA16162@soptik.pzkagis.cz> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lrZ03NoBR/3+SXJZ" Content-Disposition: inline User-Agent: Mutt/1.4i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[UPPERCASE_25_50=0] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/41 X-Sequence-Number: 6520 --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, ODBC driver fail (raise exception) with these steps: 1) SQLPrepare (SELECT relname FROM pg_class WHERE relname != ?) 2) SQLExecute I found the bug and fix it. Patch is attached. Regards Luf --lrZ03NoBR/3+SXJZ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="psqlodbc-bindparam_count_error.diff" diff -c psqlodbc.orig\convert.c psqlodbc\convert.c *** psqlodbc.orig\convert.c Wed Nov 30 13:44:14 2005 --- psqlodbc\convert.c Mon Dec 05 17:17:11 2005 *************** *** 1860,1873 **** } if (marker_count > 0) { ! CVT_APPEND_CHAR(qb, '('); ! for (i = 0; i < marker_count; i++) { ! if (i > 0) ! CVT_APPEND_STR(qb, ", "); ! CVT_APPEND_STR(qb, pgtype_to_name(stmt, ipdopts->parameters[i].PGType)); } - CVT_APPEND_CHAR(qb, ')'); } CVT_APPEND_STR(qb, " as "); for (qp->opos = 0; qp->opos < qp->stmt_len; qp->opos++) --- 1860,1883 ---- } if (marker_count > 0) { ! if (ipdopts && (ipdopts->allocated == marker_count)) { ! CVT_APPEND_CHAR(qb, '('); ! for (i = 0; i < marker_count; i++) ! { ! if (i > 0) ! CVT_APPEND_STR(qb, ", "); ! CVT_APPEND_STR(qb, pgtype_to_name(stmt, ipdopts->parameters[i].PGType)); ! } ! CVT_APPEND_CHAR(qb, ')'); ! } ! else ! { ! SC_set_error(stmt, STMT_COUNT_FIELD_INCORRECT, "The # of binded parameters < the # of parameter markers"); ! SC_set_sqlstate(stmt, "07002"); ! QB_Destructor(qb); ! return SQL_ERROR; } } CVT_APPEND_STR(qb, " as "); for (qp->opos = 0; qp->opos < qp->stmt_len; qp->opos++) --lrZ03NoBR/3+SXJZ--