Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

ODBC driver failure



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
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++)


Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group