diff --git a/src/interfaces/odbc/GNUmakefile b/src/interfaces/odbc/GNUmakefile
index 488fad6c3b534a21d738bf5794d8c6b6a691cd71..c2c1936fa5260db7c3442d839a6b0826d6187343 100644
--- a/src/interfaces/odbc/GNUmakefile
+++ b/src/interfaces/odbc/GNUmakefile
@@ -2,7 +2,7 @@
 #
 # GNUMakefile for psqlodbc (Postgres ODBC driver)
 #
-# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.12 2001/02/10 16:51:40 petere Exp $
+# $Header: /cvsroot/pgsql/src/interfaces/odbc/Attic/GNUmakefile,v 1.13 2001/02/14 05:45:38 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -24,6 +24,7 @@ OBJS = info.o bind.o columninfo.o connection.o convert.o drvconn.o \
         gpps.o tuple.o tuplelist.o dlg_specific.o $(OBJX)
 
 SHLIB_LINK = $(filter -lm, $(LIBS))
+
 all: all-lib
 
 # Shared library stuff
@@ -32,7 +33,6 @@ include $(top_srcdir)/src/Makefile.shlib
 # Symbols must be resolved to the version in the shared library because
 # the driver manager (e.g., iodbc) provides some symbols with the same
 # names and we don't want those.  (This issue is probably ELF specific.)
-
 LINK.shared += $(shlib_symbolic)
 
 odbc_headers = isql.h isqlext.h iodbc.h
diff --git a/src/interfaces/odbc/bind.c b/src/interfaces/odbc/bind.c
index 16a375301fb5c29d720ba6f31aef472c046fa912..6ec25f80d6372fc0d76451919fdb51694a7e1832 100644
--- a/src/interfaces/odbc/bind.c
+++ b/src/interfaces/odbc/bind.c
@@ -1,14 +1,15 @@
-/* Module:			bind.c
+
+/* Module:          bind.c
  *
- * Description:		This module contains routines related to binding
- *					columns and parameters.
+ * Description:     This module contains routines related to binding 
+ *                  columns and parameters.
  *
- * Classes:			BindInfoClass, ParameterInfoClass
+ * Classes:         BindInfoClass, ParameterInfoClass
  *
- * API functions:	SQLBindParameter, SQLBindCol, SQLDescribeParam, SQLNumParams,
- *					SQLParamOptions(NI)
+ * API functions:   SQLBindParameter, SQLBindCol, SQLDescribeParam, SQLNumParams,
+ *                  SQLParamOptions(NI)
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -33,44 +34,39 @@
 #include "sqlext.h"
 #endif
 
-/*		Bind parameters on a statement handle */
-
-RETCODE SQL_API
-SQLBindParameter(
-				 HSTMT hstmt,
-				 UWORD ipar,
-				 SWORD fParamType,
-				 SWORD fCType,
-				 SWORD fSqlType,
-				 UDWORD cbColDef,
-				 SWORD ibScale,
-				 PTR rgbValue,
-				 SDWORD cbValueMax,
-				 SDWORD FAR *pcbValue)
+/*      Bind parameters on a statement handle */
+
+RETCODE SQL_API SQLBindParameter(
+        HSTMT      hstmt,
+        UWORD      ipar,
+        SWORD      fParamType,
+        SWORD      fCType,
+        SWORD      fSqlType,
+        UDWORD     cbColDef,
+        SWORD      ibScale,
+        PTR        rgbValue,
+        SDWORD     cbValueMax,
+        SDWORD FAR *pcbValue)
 {
-	StatementClass *stmt = (StatementClass *) hstmt;
-	static char *func = "SQLBindParameter";
+StatementClass *stmt = (StatementClass *) hstmt;
+static char *func="SQLBindParameter";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (stmt->parameters_allocated < ipar)
-	{
+	if(stmt->parameters_allocated < ipar) {
 		ParameterInfoClass *old_parameters;
-		int			i,
-					old_parameters_allocated;
+		int i, old_parameters_allocated;
 
 		old_parameters = stmt->parameters;
 		old_parameters_allocated = stmt->parameters_allocated;
 
-		stmt->parameters = (ParameterInfoClass *) malloc(sizeof(ParameterInfoClass) * (ipar));
-		if (!stmt->parameters)
-		{
+		stmt->parameters = (ParameterInfoClass *) malloc(sizeof(ParameterInfoClass)*(ipar));
+		if ( ! stmt->parameters) {
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Could not allocate memory for statement parameters";
 			SC_log_error(func, "", stmt);
@@ -80,23 +76,18 @@ SQLBindParameter(
 		stmt->parameters_allocated = ipar;
 
 		/* copy the old parameters over */
-		for (i = 0; i < old_parameters_allocated; i++)
-		{
+		for(i = 0; i < old_parameters_allocated; i++) {
 			/* a structure copy should work */
 			stmt->parameters[i] = old_parameters[i];
 		}
 
 		/* get rid of the old parameters, if there were any */
-		if (old_parameters)
+		if(old_parameters)
 			free(old_parameters);
 
-		/*
-		 * zero out the newly allocated parameters (in case they skipped
-		 * some,
-		 */
+		/* zero out the newly allocated parameters (in case they skipped some, */
 		/* so we don't accidentally try to use them later) */
-		for (; i < stmt->parameters_allocated; i++)
-		{
+		for(; i < stmt->parameters_allocated; i++) {
 			stmt->parameters[i].buflen = 0;
 			stmt->parameters[i].buffer = 0;
 			stmt->parameters[i].used = 0;
@@ -112,8 +103,7 @@ SQLBindParameter(
 		}
 	}
 
-	ipar--;						/* use zero based column numbers for the
-								 * below part */
+	ipar--;		/* use zero based column numbers for the below part */
 
 	/* store the given info */
 	stmt->parameters[ipar].buflen = cbValueMax;
@@ -125,83 +115,74 @@ SQLBindParameter(
 	stmt->parameters[ipar].precision = cbColDef;
 	stmt->parameters[ipar].scale = ibScale;
 
-	/*
-	 * If rebinding a parameter that had data-at-exec stuff in it, then
-	 * free that stuff
-	 */
-	if (stmt->parameters[ipar].EXEC_used)
-	{
+	/*	If rebinding a parameter that had data-at-exec stuff in it,
+		then free that stuff
+	*/
+	if (stmt->parameters[ipar].EXEC_used) {
 		free(stmt->parameters[ipar].EXEC_used);
 		stmt->parameters[ipar].EXEC_used = NULL;
 	}
 
-	if (stmt->parameters[ipar].EXEC_buffer)
-	{
+	if (stmt->parameters[ipar].EXEC_buffer) {
 		if (stmt->parameters[ipar].SQLType != SQL_LONGVARBINARY)
 			free(stmt->parameters[ipar].EXEC_buffer);
 		stmt->parameters[ipar].EXEC_buffer = NULL;
 	}
 
-	/* Data at exec macro only valid for C char/binary data */
+	/*	Data at exec macro only valid for C char/binary data */
 	if ((fSqlType == SQL_LONGVARBINARY || fSqlType == SQL_LONGVARCHAR) && pcbValue && *pcbValue <= SQL_LEN_DATA_AT_EXEC_OFFSET)
 		stmt->parameters[ipar].data_at_exec = TRUE;
 	else
 		stmt->parameters[ipar].data_at_exec = FALSE;
 
-	mylog("SQLBindParamater: ipar=%d, paramType=%d, fCType=%d, fSqlType=%d, cbColDef=%d, ibScale=%d, rgbValue=%d, *pcbValue = %d, data_at_exec = %d\n", ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, pcbValue ? *pcbValue : -777, stmt->parameters[ipar].data_at_exec);
+	mylog("SQLBindParamater: ipar=%d, paramType=%d, fCType=%d, fSqlType=%d, cbColDef=%d, ibScale=%d, rgbValue=%d, *pcbValue = %d, data_at_exec = %d\n", ipar, fParamType, fCType, fSqlType, cbColDef, ibScale, rgbValue, pcbValue ? *pcbValue: -777, stmt->parameters[ipar].data_at_exec);
 
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
-
-/*		Associate a user-supplied buffer with a database column. */
-RETCODE SQL_API
-SQLBindCol(
-		   HSTMT hstmt,
-		   UWORD icol,
-		   SWORD fCType,
-		   PTR rgbValue,
-		   SDWORD cbValueMax,
-		   SDWORD FAR *pcbValue)
-{
-	StatementClass *stmt = (StatementClass *) hstmt;
-	static char *func = "SQLBindCol";
+/*      -       -       -       -       -       -       -       -       - */
 
-	mylog("%s: entering...\n", func);
+/*      Associate a user-supplied buffer with a database column. */
+RETCODE SQL_API SQLBindCol(
+        HSTMT      hstmt,
+        UWORD      icol,
+        SWORD      fCType,
+        PTR        rgbValue,
+        SDWORD     cbValueMax,
+        SDWORD FAR *pcbValue)
+{
+StatementClass *stmt = (StatementClass *) hstmt;
+static char *func="SQLBindCol";
 
-	mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
+	mylog( "%s: entering...\n", func);
+    
+mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 
 	SC_clear_error(stmt);
-
-	if (stmt->status == STMT_EXECUTING)
-	{
+    
+	if( stmt->status == STMT_EXECUTING) {
 		stmt->errormsg = "Can't bind columns while statement is still executing.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	/* If the bookmark column is being bound, then just save it */
-	if (icol == 0)
-	{
-		if (rgbValue == NULL)
-		{
+	/*	If the bookmark column is being bound, then just save it */
+	if (icol == 0) {
+
+		if (rgbValue == NULL) {
 			stmt->bookmark.buffer = NULL;
 			stmt->bookmark.used = NULL;
 		}
-		else
-		{
-			/* Make sure it is the bookmark data type */
-			if (fCType != SQL_C_BOOKMARK)
-			{
+		else {
+			/*	Make sure it is the bookmark data type */
+			if ( fCType != SQL_C_BOOKMARK) {
 				stmt->errormsg = "Column 0 is not of type SQL_C_BOOKMARK";
 				stmt->errornumber = STMT_PROGRAM_TYPE_OUT_OF_RANGE;
 				SC_log_error(func, "", stmt);
@@ -214,42 +195,37 @@ SQLBindCol(
 		return SQL_SUCCESS;
 	}
 
-	/* allocate enough bindings if not already done */
-	/* Most likely, execution of a statement would have setup the  */
-	/* necessary bindings. But some apps call BindCol before any */
-	/* statement is executed. */
-	if (icol > stmt->bindings_allocated)
+	/*	allocate enough bindings if not already done */
+	/*	Most likely, execution of a statement would have setup the  */
+	/*	necessary bindings. But some apps call BindCol before any */
+	/*	statement is executed. */
+	if ( icol > stmt->bindings_allocated)
 		extend_bindings(stmt, icol);
 
-	/* check to see if the bindings were allocated */
-	if (!stmt->bindings)
-	{
+	/*	check to see if the bindings were allocated */
+	if ( ! stmt->bindings) {
 		stmt->errormsg = "Could not allocate memory for bindings.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	icol--;						/* use zero based col numbers from here
-								 * out */
+	icol--;		/* use zero based col numbers from here out */
 
-	/* Reset for SQLGetData */
+	/*	Reset for SQLGetData */
 	stmt->bindings[icol].data_left = -1;
 
-	if (rgbValue == NULL)
-	{
+	if (rgbValue == NULL) {
 		/* we have to unbind the column */
 		stmt->bindings[icol].buflen = 0;
 		stmt->bindings[icol].buffer = NULL;
-		stmt->bindings[icol].used = NULL;
+		stmt->bindings[icol].used =   NULL;
 		stmt->bindings[icol].returntype = SQL_C_CHAR;
-	}
-	else
-	{
+	} else {
 		/* ok, bind that column */
-		stmt->bindings[icol].buflen = cbValueMax;
-		stmt->bindings[icol].buffer = rgbValue;
-		stmt->bindings[icol].used = pcbValue;
+		stmt->bindings[icol].buflen     = cbValueMax;
+		stmt->bindings[icol].buffer     = rgbValue;
+		stmt->bindings[icol].used       = pcbValue;
 		stmt->bindings[icol].returntype = fCType;
 
 		mylog("       bound buffer[%d] = %u\n", icol, stmt->bindings[icol].buffer);
@@ -258,37 +234,34 @@ SQLBindCol(
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-/*	Returns the description of a parameter marker. */
+/*  Returns the description of a parameter marker. */
 /*	This function is listed as not being supported by SQLGetFunctions() because it is  */
 /*	used to describe "parameter markers" (not bound parameters), in which case,  */
 /*	the dbms should return info on the markers.  Since Postgres doesn't support that, */
 /*	it is best to say this function is not supported and let the application assume a  */
 /*	data type (most likely varchar). */
 
-RETCODE SQL_API
-SQLDescribeParam(
-				 HSTMT hstmt,
-				 UWORD ipar,
-				 SWORD FAR *pfSqlType,
-				 UDWORD FAR *pcbColDef,
-				 SWORD FAR *pibScale,
-				 SWORD FAR *pfNullable)
+RETCODE SQL_API SQLDescribeParam(
+        HSTMT      hstmt,
+        UWORD      ipar,
+        SWORD  FAR *pfSqlType,
+        UDWORD FAR *pcbColDef,
+        SWORD  FAR *pibScale,
+        SWORD  FAR *pfNullable)
 {
-	StatementClass *stmt = (StatementClass *) hstmt;
-	static char *func = "SQLDescribeParam";
+StatementClass *stmt = (StatementClass *) hstmt;
+static char *func = "SQLDescribeParam";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if ((ipar < 1) || (ipar > stmt->parameters_allocated))
-	{
+	if( (ipar < 1) || (ipar > stmt->parameters_allocated) ) {
 		stmt->errormsg = "Invalid parameter number for SQLDescribeParam.";
 		stmt->errornumber = STMT_BAD_PARAMETER_NUMBER_ERROR;
 		SC_log_error(func, "", stmt);
@@ -297,45 +270,41 @@ SQLDescribeParam(
 
 	ipar--;
 
-	/*
-	 * This implementation is not very good, since it is supposed to
-	 * describe
-	 */
-	/* parameter markers, not bound parameters.  */
-	if (pfSqlType)
+	/*	This implementation is not very good, since it is supposed to describe */
+	/*	parameter markers, not bound parameters.  */
+	if(pfSqlType)
 		*pfSqlType = stmt->parameters[ipar].SQLType;
 
-	if (pcbColDef)
+	if(pcbColDef)
 		*pcbColDef = stmt->parameters[ipar].precision;
 
-	if (pibScale)
+	if(pibScale)
 		*pibScale = stmt->parameters[ipar].scale;
 
-	if (pfNullable)
+	if(pfNullable)
 		*pfNullable = pgtype_nullable(stmt, stmt->parameters[ipar].paramType);
 
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-/*		Sets multiple values (arrays) for the set of parameter markers. */
+/*      Sets multiple values (arrays) for the set of parameter markers. */
 
-RETCODE SQL_API
-SQLParamOptions(
-				HSTMT hstmt,
-				UDWORD crow,
-				UDWORD FAR *pirow)
+RETCODE SQL_API SQLParamOptions(
+        HSTMT      hstmt,
+        UDWORD     crow,
+        UDWORD FAR *pirow)
 {
-	static char *func = "SQLParamOptions";
+static char *func = "SQLParamOptions";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
 	return SQL_ERROR;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
 /*	This function should really talk to the dbms to determine the number of  */
 /*	"parameter markers" (not bound parameters) in the statement.  But, since */
@@ -344,49 +313,43 @@ SQLParamOptions(
 /*	like it does for SQLDescribeParam is that some applications don't care and try  */
 /*	to call it anyway. */
 /*	If the statement does not have parameters, it should just return 0. */
-RETCODE SQL_API
-SQLNumParams(
-			 HSTMT hstmt,
-			 SWORD FAR *pcpar)
+RETCODE SQL_API SQLNumParams(
+        HSTMT      hstmt,
+        SWORD  FAR *pcpar)
 {
-	StatementClass *stmt = (StatementClass *) hstmt;
-	char		in_quote = FALSE;
-	unsigned int i;
-	static char *func = "SQLNumParams";
+StatementClass *stmt = (StatementClass *) hstmt;
+char in_quote = FALSE;
+unsigned int i;
+static char *func = "SQLNumParams";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if(!stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	if (pcpar)
 		*pcpar = 0;
-	else
-	{
+	else {
 		SC_log_error(func, "pcpar was null", stmt);
 		return SQL_ERROR;
 	}
 
 
-	if (!stmt->statement)
-	{
+	if(!stmt->statement) {
 		/* no statement has been allocated */
 		stmt->errormsg = "SQLNumParams called with no statement ready.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
-	}
-	else
-	{
-		for (i = 0; i < strlen(stmt->statement); i++)
-		{
-			if (stmt->statement[i] == '?' && !in_quote)
+	} else {
+
+		for(i=0; i < strlen(stmt->statement); i++) {
+
+			if(stmt->statement[i] == '?' && !in_quote)
 				(*pcpar)++;
-			else
-			{
+			else {
 				if (stmt->statement[i] == '\'')
 					in_quote = (in_quote ? FALSE : TRUE);
 			}
@@ -397,20 +360,20 @@ SQLNumParams(
 }
 
 /********************************************************************
- *	 Bindings Implementation
+ *   Bindings Implementation
  */
 BindInfoClass *
 create_empty_bindings(int num_columns)
 {
-	BindInfoClass *new_bindings;
-	int			i;
+BindInfoClass *new_bindings;
+int i;
 
-	new_bindings = (BindInfoClass *) malloc(num_columns * sizeof(BindInfoClass));
-	if (!new_bindings)
+	new_bindings = (BindInfoClass *)malloc(num_columns * sizeof(BindInfoClass));
+	if(!new_bindings) {
 		return 0;
+	}
 
-	for (i = 0; i < num_columns; i++)
-	{
+	for(i=0; i < num_columns; i++) {
 		new_bindings[i].buflen = 0;
 		new_bindings[i].buffer = NULL;
 		new_bindings[i].used = NULL;
@@ -423,23 +386,21 @@ create_empty_bindings(int num_columns)
 void
 extend_bindings(StatementClass *stmt, int num_columns)
 {
-	static char *func = "extend_bindings";
-	BindInfoClass *new_bindings;
-	int			i;
+static char *func="extend_bindings";
+BindInfoClass *new_bindings;
+int i;
 
-	mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func, stmt, stmt->bindings_allocated, num_columns);
+mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func, stmt, stmt->bindings_allocated, num_columns);
 
 	/* if we have too few, allocate room for more, and copy the old */
 	/* entries into the new structure */
-	if (stmt->bindings_allocated < num_columns)
-	{
+	if(stmt->bindings_allocated < num_columns) {
+
 		new_bindings = create_empty_bindings(num_columns);
-		if (!new_bindings)
-		{
-			mylog("%s: unable to create %d new bindings from %d old bindings\n", func, num_columns, stmt->bindings_allocated);
+		if ( ! new_bindings) {
+           mylog("%s: unable to create %d new bindings from %d old bindings\n", func, num_columns, stmt->bindings_allocated);
 
-			if (stmt->bindings)
-			{
+			if (stmt->bindings) {
 				free(stmt->bindings);
 				stmt->bindings = NULL;
 			}
@@ -447,9 +408,8 @@ extend_bindings(StatementClass *stmt, int num_columns)
 			return;
 		}
 
-		if (stmt->bindings)
-		{
-			for (i = 0; i < stmt->bindings_allocated; i++)
+		if(stmt->bindings) {
+			for(i=0; i<stmt->bindings_allocated; i++)
 				new_bindings[i] = stmt->bindings[i];
 
 			free(stmt->bindings);
@@ -457,14 +417,15 @@ extend_bindings(StatementClass *stmt, int num_columns)
 
 		stmt->bindings = new_bindings;
 		stmt->bindings_allocated = num_columns;
-	}
-	/* There is no reason to zero out extra bindings if there are */
-	/* more than needed.  If an app has allocated extra bindings,  */
-	/* let it worry about it by unbinding those columns. */
 
-	/* SQLBindCol(1..) ... SQLBindCol(10...)   # got 10 bindings */
-	/* SQLExecDirect(...)  # returns 5 cols */
-	/* SQLExecDirect(...)  # returns 10 cols  (now OK) */
+    } 
+	/*	There is no reason to zero out extra bindings if there are */
+	/*	more than needed.  If an app has allocated extra bindings,  */
+	/*	let it worry about it by unbinding those columns. */
+
+	/*	SQLBindCol(1..) ... SQLBindCol(10...)	# got 10 bindings */
+	/*	SQLExecDirect(...)  # returns 5 cols */
+	/*	SQLExecDirect(...)	# returns 10 cols  (now OK) */
 
 	mylog("exit extend_bindings\n");
 }
diff --git a/src/interfaces/odbc/bind.h b/src/interfaces/odbc/bind.h
index 58e5fb190ab21ef5b67c5186bac4452ce2215a18..39e594f34601c286b0d92123541b99e682f286d9 100644
--- a/src/interfaces/odbc/bind.h
+++ b/src/interfaces/odbc/bind.h
@@ -1,9 +1,9 @@
 
-/* File:			bind.h
+/* File:            bind.h
  *
- * Description:		See "bind.c"
+ * Description:     See "bind.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -15,40 +15,33 @@
 /*
  * BindInfoClass -- stores information about a bound column
  */
-struct BindInfoClass_
-{
-	Int4		buflen;			/* size of buffer */
-	Int4		data_left;		/* amount of data left to read
-								 * (SQLGetData) */
-	char	   *buffer;			/* pointer to the buffer */
-	Int4	   *used;			/* used space in the buffer (for strings
-								 * not counting the '\0') */
-	Int2		returntype;		/* kind of conversion to be applied when
-								 * returning (SQL_C_DEFAULT,
-								 * SQL_C_CHAR...) */
+struct BindInfoClass_ {
+	Int4 buflen;		/* size of buffer */
+	Int4 data_left;		/* amount of data left to read (SQLGetData) */
+	char *buffer;		/* pointer to the buffer */
+	Int4 *used;			/* used space in the buffer (for strings not counting the '\0') */
+	Int2 returntype;	/* kind of conversion to be applied when returning (SQL_C_DEFAULT, SQL_C_CHAR...) */
 };
 
 /*
  * ParameterInfoClass -- stores information about a bound parameter
  */
-struct ParameterInfoClass_
-{
-	Int4		buflen;
-	char	   *buffer;
-	Int4	   *used;
-	Int2		paramType;
-	Int2		CType;
-	Int2		SQLType;
-	UInt4		precision;
-	Int2		scale;
-	Oid			lobj_oid;
-	Int4	   *EXEC_used;		/* amount of data OR the oid of the large
-								 * object */
-	char	   *EXEC_buffer;	/* the data or the FD of the large object */
-	char		data_at_exec;
+struct ParameterInfoClass_ {
+	Int4 buflen;
+	char *buffer;
+	Int4 *used;
+	Int2 paramType;
+	Int2 CType;
+	Int2 SQLType;
+	UInt4 precision;
+	Int2 scale;
+	Oid  lobj_oid;
+	Int4 *EXEC_used;		/* amount of data OR the oid of the large object */
+	char *EXEC_buffer;		/* the data or the FD of the large object */
+	char data_at_exec;
 };
 
 BindInfoClass *create_empty_bindings(int num_columns);
-void		extend_bindings(StatementClass *stmt, int num_columns);
+void extend_bindings(StatementClass *stmt, int num_columns);
 
 #endif
diff --git a/src/interfaces/odbc/columninfo.c b/src/interfaces/odbc/columninfo.c
index 91a4a7a44ac89665d383ef2bf9544e5a5071d24d..9e5223b83b39b306c98666fd0c8f2d43c50503a0 100644
--- a/src/interfaces/odbc/columninfo.c
+++ b/src/interfaces/odbc/columninfo.c
@@ -1,13 +1,14 @@
-/* Module:			columninfo.c
+
+/* Module:          columninfo.c
  *
- * Description:		This module contains routines related to
- *					reading and storing the field information from a query.
+ * Description:     This module contains routines related to 
+ *                  reading and storing the field information from a query.
  *
- * Classes:			ColumnInfoClass (Functions prefix: "CI_")
+ * Classes:         ColumnInfoClass (Functions prefix: "CI_")
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -20,12 +21,11 @@
 ColumnInfoClass *
 CI_Constructor()
 {
-	ColumnInfoClass *rv;
+ColumnInfoClass *rv;
 
 	rv = (ColumnInfoClass *) malloc(sizeof(ColumnInfoClass));
 
-	if (rv)
-	{
+	if (rv) {
 		rv->num_fields = 0;
 		rv->name = NULL;
 		rv->adtid = NULL;
@@ -45,21 +45,21 @@ CI_Destructor(ColumnInfoClass *self)
 	free(self);
 }
 
-/*	Read in field descriptions.
-	If self is not null, then also store the information.
+/*  Read in field descriptions.
+    If self is not null, then also store the information.
 	If self is null, then just read, don't store.
 */
 char
 CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
 {
-	Int2		lf;
-	int			new_num_fields;
-	Oid			new_adtid;
-	Int2		new_adtsize;
-	Int4		new_atttypmod = -1;
-	char		new_field_name[MAX_MESSAGE_LEN + 1];
-	SocketClass *sock;
-	ConnInfo   *ci;
+Int2 lf;
+int new_num_fields;
+Oid new_adtid;
+Int2 new_adtsize;
+Int4 new_atttypmod = -1;
+char new_field_name[MAX_MESSAGE_LEN+1];
+SocketClass *sock;
+ConnInfo *ci;
 
 	sock = CC_get_socket(conn);
 	ci = &conn->connInfo;
@@ -69,28 +69,28 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
 
 	mylog("num_fields = %d\n", new_num_fields);
 
-	if (self)
-	{							/* according to that allocate memory */
+	if (self) { 	/* according to that allocate memory */
 		CI_set_num_fields(self, new_num_fields);
 	}
 
 	/* now read in the descriptions */
-	for (lf = 0; lf < new_num_fields; lf++)
-	{
+	for(lf = 0; lf < new_num_fields; lf++) {
+
 		SOCK_get_string(sock, new_field_name, MAX_MESSAGE_LEN);
 		new_adtid = (Oid) SOCK_get_int(sock, 4);
 		new_adtsize = (Int2) SOCK_get_int(sock, 2);
 
-		/* If 6.4 protocol, then read the atttypmod field */
-		if (PG_VERSION_GE(conn, 6.4))
-		{
+		/*	If 6.4 protocol, then read the atttypmod field */
+		if (PG_VERSION_GE(conn, 6.4)) {
+
 			mylog("READING ATTTYPMOD\n");
 			new_atttypmod = (Int4) SOCK_get_int(sock, 4);
 
-			/* Subtract the header length */
+			/*	Subtract the header length */
 			new_atttypmod -= 4;
 			if (new_atttypmod < 0)
 				new_atttypmod = -1;
+
 		}
 
 		mylog("CI_read_fields: fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d\n", new_field_name, new_adtid, new_adtsize, new_atttypmod);
@@ -107,16 +107,15 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
 void
 CI_free_memory(ColumnInfoClass *self)
 {
-	register Int2 lf;
-	int			num_fields = self->num_fields;
+register Int2 lf;
+int num_fields = self->num_fields;
 
-	for (lf = 0; lf < num_fields; lf++)
-	{
-		if (self->name[lf])
-			free(self->name[lf]);
+	for (lf = 0; lf < num_fields; lf++) {
+		if( self->name[lf])
+			free (self->name[lf]);
 	}
 
-	/* Safe to call even if null */
+	/*	Safe to call even if null */
 	free(self->name);
 	free(self->adtid);
 	free(self->adtsize);
@@ -128,30 +127,33 @@ CI_free_memory(ColumnInfoClass *self)
 void
 CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
 {
-	CI_free_memory(self);		/* always safe to call */
+	CI_free_memory(self);	/* always safe to call */
 
 	self->num_fields = new_num_fields;
 
-	self->name = (char **) malloc(sizeof(char *) * self->num_fields);
-	self->adtid = (Oid *) malloc(sizeof(Oid) * self->num_fields);
-	self->adtsize = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
+	self->name = (char **) malloc (sizeof(char *) * self->num_fields);
+	self->adtid = (Oid *) malloc (sizeof(Oid) * self->num_fields);
+	self->adtsize = (Int2 *) malloc (sizeof(Int2) * self->num_fields);
 	self->display_size = (Int2 *) malloc(sizeof(Int2) * self->num_fields);
 	self->atttypmod = (Int4 *) malloc(sizeof(Int4) * self->num_fields);
 }
 
 void
-CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
-				  Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
+CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, 
+                                      Oid new_adtid, Int2 new_adtsize, Int4 new_atttypmod)
 {
+    
 	/* check bounds */
-	if ((field_num < 0) || (field_num >= self->num_fields))
+	if((field_num < 0) || (field_num >= self->num_fields)) {
 		return;
+	}
 
 	/* store the info */
-	self->name[field_num] = strdup(new_name);
+	self->name[field_num] = strdup(new_name);  
 	self->adtid[field_num] = new_adtid;
 	self->adtsize[field_num] = new_adtsize;
 	self->atttypmod[field_num] = new_atttypmod;
 
 	self->display_size[field_num] = 0;
 }
+
diff --git a/src/interfaces/odbc/columninfo.h b/src/interfaces/odbc/columninfo.h
index 964ebc7617b905718efb885ed294772a90be4c0c..3ec1cc92d50e3edee351f108a9dfed30f65f091c 100644
--- a/src/interfaces/odbc/columninfo.h
+++ b/src/interfaces/odbc/columninfo.h
@@ -1,9 +1,9 @@
 
-/* File:			columninfo.h
+/* File:            columninfo.h
  *
- * Description:		See "columninfo.c"
+ * Description:     See "columninfo.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -12,14 +12,13 @@
 
 #include "psqlodbc.h"
 
-struct ColumnInfoClass_
-{
-	Int2		num_fields;
-	char	  **name;			/* list of type names */
-	Oid		   *adtid;			/* list of type ids */
-	Int2	   *adtsize;		/* list type sizes */
-	Int2	   *display_size;	/* the display size (longest row) */
-	Int4	   *atttypmod;		/* the length of bpchar/varchar */
+struct ColumnInfoClass_ {
+	Int2	num_fields;
+	char	**name;				/* list of type names */
+	Oid		*adtid;				/* list of type ids */
+	Int2	*adtsize;			/* list type sizes */
+	Int2	*display_size;		/* the display size (longest row) */
+	Int4	*atttypmod;			/* the length of bpchar/varchar */
 };
 
 #define CI_get_num_fields(self)			(self->num_fields)
@@ -30,15 +29,15 @@ struct ColumnInfoClass_
 #define CI_get_atttypmod(self, col)		(self->atttypmod[col])
 
 ColumnInfoClass *CI_Constructor(void);
-void		CI_Destructor(ColumnInfoClass *self);
-void		CI_free_memory(ColumnInfoClass *self);
-char		CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn);
+void CI_Destructor(ColumnInfoClass *self);
+void CI_free_memory(ColumnInfoClass *self);
+char CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn);
 
 /* functions for setting up the fields from within the program, */
 /* without reading from a socket */
-void		CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
-void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
-				  Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
+void CI_set_num_fields(ColumnInfoClass *self, int new_num_fields);
+void CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name, 
+                       Oid new_adtid, Int2 new_adtsize, Int4 atttypmod);
 
 
 #endif
diff --git a/src/interfaces/odbc/connection.c b/src/interfaces/odbc/connection.c
index 2a4b62ef5ce435b6a31cccba112c3d3b534e0605..b528a69ea03ab2415677a2b99f05b6e2662d38a3 100644
--- a/src/interfaces/odbc/connection.c
+++ b/src/interfaces/odbc/connection.c
@@ -1,14 +1,15 @@
-/* Module:			connection.c
+
+/* Module:          connection.c
  *
- * Description:		This module contains routines related to
- *					connecting to and disconnecting from the Postgres DBMS.
+ * Description:     This module contains routines related to 
+ *                  connecting to and disconnecting from the Postgres DBMS.
  *
- * Classes:			ConnectionClass (Functions prefix: "CC_")
+ * Classes:         ConnectionClass (Functions prefix: "CC_")
  *
- * API functions:	SQLAllocConnect, SQLConnect, SQLDisconnect, SQLFreeConnect,
- *					SQLBrowseConnect(NI)
+ * API functions:   SQLAllocConnect, SQLConnect, SQLDisconnect, SQLFreeConnect,
+ *                  SQLBrowseConnect(NI)
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -26,73 +27,67 @@
 #include <odbcinst.h>
 #endif
 
-#define STMT_INCREMENT 16		/* how many statement holders to allocate
-								 * at a time */
+#define STMT_INCREMENT 16  /* how many statement holders to allocate at a time */
 
 #define PRN_NULLCHECK
 
 extern GLOBAL_VALUES globals;
 
 
-RETCODE SQL_API
-SQLAllocConnect(
-				HENV henv,
-				HDBC FAR *phdbc)
+RETCODE SQL_API SQLAllocConnect(
+                                HENV     henv,
+                                HDBC FAR *phdbc)
 {
-	EnvironmentClass *env = (EnvironmentClass *) henv;
-	ConnectionClass *conn;
-	static char *func = "SQLAllocConnect";
+EnvironmentClass *env = (EnvironmentClass *)henv;
+ConnectionClass *conn;
+static char *func="SQLAllocConnect";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
 	conn = CC_Constructor();
 	mylog("**** %s: henv = %u, conn = %u\n", func, henv, conn);
 
-	if (!conn)
-	{
-		env->errormsg = "Couldn't allocate memory for Connection object.";
-		env->errornumber = ENV_ALLOC_ERROR;
+    if( ! conn) {
+        env->errormsg = "Couldn't allocate memory for Connection object.";
+        env->errornumber = ENV_ALLOC_ERROR;
 		*phdbc = SQL_NULL_HDBC;
 		EN_log_error(func, "", env);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	if (!EN_add_connection(env, conn))
-	{
-		env->errormsg = "Maximum number of connections exceeded.";
-		env->errornumber = ENV_ALLOC_ERROR;
-		CC_Destructor(conn);
+    if ( ! EN_add_connection(env, conn)) {
+        env->errormsg = "Maximum number of connections exceeded.";
+        env->errornumber = ENV_ALLOC_ERROR;
+        CC_Destructor(conn);
 		*phdbc = SQL_NULL_HDBC;
 		EN_log_error(func, "", env);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
 	*phdbc = (HDBC) conn;
 
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLConnect(
-		   HDBC hdbc,
-		   UCHAR FAR *szDSN,
-		   SWORD cbDSN,
-		   UCHAR FAR *szUID,
-		   SWORD cbUID,
-		   UCHAR FAR *szAuthStr,
-		   SWORD cbAuthStr)
+RETCODE SQL_API SQLConnect(
+                           HDBC      hdbc,
+                           UCHAR FAR *szDSN,
+                           SWORD     cbDSN,
+                           UCHAR FAR *szUID,
+                           SWORD     cbUID,
+                           UCHAR FAR *szAuthStr,
+                           SWORD     cbAuthStr)
 {
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	ConnInfo   *ci;
-	static char *func = "SQLConnect";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+ConnInfo *ci;
+static char *func = "SQLConnect";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!conn)
-	{
+	if ( ! conn) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -101,15 +96,14 @@ SQLConnect(
 
 	make_string(szDSN, cbDSN, ci->dsn);
 
-	/* get the values for the DSN from the registry */
+	/*	get the values for the DSN from the registry */
 	getDSNinfo(ci, CONN_OVERWRITE);
-	/* initialize pg_version from connInfo.protocol    */
-	CC_initialize_pg_version(conn);
-
-	/*
-	 * override values from DSN info with UID and authStr(pwd) This only
-	 * occurs if the values are actually there.
-	 */
+	/*	initialize pg_version from connInfo.protocol	*/
+	CC_initialize_pg_version(conn); 
+	
+	/*	override values from DSN info with UID and authStr(pwd) 
+		This only occurs if the values are actually there.
+	*/
 	make_string(szUID, cbUID, ci->username);
 	make_string(szAuthStr, cbAuthStr, ci->password);
 
@@ -118,59 +112,54 @@ SQLConnect(
 
 	qlog("conn = %u, %s(DSN='%s', UID='%s', PWD='%s')\n", conn, func, ci->dsn, ci->username, ci->password);
 
-	if (CC_connect(conn, FALSE) <= 0)
-	{
-		/* Error messages are filled in */
+	if ( CC_connect(conn, FALSE) <= 0) {
+		/*	Error messages are filled in */
 		CC_log_error(func, "Error on CC_connect", conn);
 		return SQL_ERROR;
 	}
 
-	mylog("%s: returning...\n", func);
+	mylog( "%s: returning...\n", func);
 
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLBrowseConnect(
-				 HDBC hdbc,
-				 UCHAR FAR *szConnStrIn,
-				 SWORD cbConnStrIn,
-				 UCHAR FAR *szConnStrOut,
-				 SWORD cbConnStrOutMax,
-				 SWORD FAR *pcbConnStrOut)
+RETCODE SQL_API SQLBrowseConnect(
+        HDBC      hdbc,
+        UCHAR FAR *szConnStrIn,
+        SWORD     cbConnStrIn,
+        UCHAR FAR *szConnStrOut,
+        SWORD     cbConnStrOutMax,
+        SWORD FAR *pcbConnStrOut)
 {
-	static char *func = "SQLBrowseConnect";
+static char *func="SQLBrowseConnect";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
 /* Drop any hstmts open on hdbc and disconnect from database */
-RETCODE SQL_API
-SQLDisconnect(
-			  HDBC hdbc)
+RETCODE SQL_API SQLDisconnect(
+        HDBC      hdbc)
 {
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	static char *func = "SQLDisconnect";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+static char *func = "SQLDisconnect";
 
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!conn)
-	{
+	if ( ! conn) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	qlog("conn=%u, %s\n", conn, func);
 
-	if (conn->status == CONN_EXECUTING)
-	{
+	if (conn->status == CONN_EXECUTING) {
 		conn->errornumber = CONN_IN_USE;
 		conn->errormsg = "A transaction is currently being executed";
 		CC_log_error(func, "", conn);
@@ -179,7 +168,7 @@ SQLDisconnect(
 
 	mylog("%s: about to CC_cleanup\n", func);
 
-	/* Close the connection and free statements */
+	/*  Close the connection and free statements */
 	CC_cleanup(conn);
 
 	mylog("%s: done CC_cleanup\n", func);
@@ -189,27 +178,24 @@ SQLDisconnect(
 }
 
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLFreeConnect(
-			   HDBC hdbc)
+RETCODE SQL_API SQLFreeConnect(
+        HDBC      hdbc)
 {
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	static char *func = "SQLFreeConnect";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+static char *func = "SQLFreeConnect";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 	mylog("**** in %s: hdbc=%u\n", func, hdbc);
 
-	if (!conn)
-	{
+	if ( ! conn) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/* Remove the connection from the environment */
-	if (!EN_remove_connection(conn->henv, conn))
-	{
+	/*  Remove the connection from the environment */
+	if ( ! EN_remove_connection(conn->henv, conn)) {
 		conn->errornumber = CONN_IN_USE;
 		conn->errormsg = "A transaction is currently being executed";
 		CC_log_error(func, "", conn);
@@ -226,36 +212,35 @@ SQLFreeConnect(
 
 /*
 *
-*		IMPLEMENTATION CONNECTION CLASS
+*       IMPLEMENTATION CONNECTION CLASS
 *
 */
 
-ConnectionClass *
-CC_Constructor()
+ConnectionClass *CC_Constructor()
 {
-	ConnectionClass *rv;
+ConnectionClass *rv;
 
-	rv = (ConnectionClass *) malloc(sizeof(ConnectionClass));
+    rv = (ConnectionClass *)malloc(sizeof(ConnectionClass));
 
-	if (rv != NULL)
-	{
-		rv->henv = NULL;		/* not yet associated with an environment */
+    if (rv != NULL) {
 
-		rv->errormsg = NULL;
-		rv->errornumber = 0;
+		rv->henv = NULL; /* not yet associated with an environment */
+
+        rv->errormsg = NULL;
+        rv->errornumber = 0;
 		rv->errormsg_created = FALSE;
 
-		rv->status = CONN_NOT_CONNECTED;
-		rv->transact_status = CONN_IN_AUTOCOMMIT;		/* autocommit by default */
+        rv->status = CONN_NOT_CONNECTED;
+        rv->transact_status = CONN_IN_AUTOCOMMIT; /* autocommit by default */
 
 		memset(&rv->connInfo, 0, sizeof(ConnInfo));
 
 		rv->sock = SOCK_Constructor();
-		if (!rv->sock)
+		if ( ! rv->sock)
 			return NULL;
 
-		rv->stmts = (StatementClass **) malloc(sizeof(StatementClass *) * STMT_INCREMENT);
-		if (!rv->stmts)
+		rv->stmts = (StatementClass **) malloc( sizeof(StatementClass *) * STMT_INCREMENT);
+		if ( ! rv->stmts)
 			return NULL;
 		memset(rv->stmts, 0, sizeof(StatementClass *) * STMT_INCREMENT);
 
@@ -275,44 +260,43 @@ CC_Constructor()
 		rv->pg_version_major = 0;
 		rv->pg_version_minor = 0;
 
-		/* Initialize statement options to defaults */
-		/* Statements under this conn will inherit these options */
+
+		/*	Initialize statement options to defaults */
+		/*	Statements under this conn will inherit these options */
 
 		InitializeStatementOptions(&rv->stmtOptions);
-	}
-	return rv;
+
+
+    } 
+    return rv;
 }
 
 
 char
 CC_Destructor(ConnectionClass *self)
 {
+
 	mylog("enter CC_Destructor, self=%u\n", self);
 
 	if (self->status == CONN_EXECUTING)
 		return 0;
 
-	CC_cleanup(self);			/* cleanup socket and statements */
+	CC_cleanup(self);   /* cleanup socket and statements */
 
 	mylog("after CC_Cleanup\n");
 
-	/* Free up statement holders */
-	if (self->stmts)
-	{
+	/*  Free up statement holders */
+	if (self->stmts) {
 		free(self->stmts);
 		self->stmts = NULL;
 	}
 	mylog("after free statement holders\n");
 
-	/* Free cached table info */
-	if (self->col_info)
-	{
-		int			i;
-
-		for (i = 0; i < self->ntables; i++)
-		{
-			if (self->col_info[i]->result)		/* Free the SQLColumns
-												 * result structure */
+	/*	Free cached table info */
+	if (self->col_info) {
+		int i;
+		for (i = 0; i < self->ntables; i++) {
+			if (self->col_info[i]->result)		/*	Free the SQLColumns result structure */
 				QR_Destructor(self->col_info[i]->result);
 
 			free(self->col_info[i]);
@@ -320,6 +304,7 @@ CC_Destructor(ConnectionClass *self)
 		free(self->col_info);
 	}
 
+
 	free(self);
 
 	mylog("exit CC_Destructor\n");
@@ -331,14 +316,12 @@ CC_Destructor(ConnectionClass *self)
 int
 CC_cursor_count(ConnectionClass *self)
 {
-	StatementClass *stmt;
-	int			i,
-				count = 0;
+StatementClass *stmt;
+int i, count = 0;
 
 	mylog("CC_cursor_count: self=%u, num_stmts=%d\n", self, self->num_stmts);
 
-	for (i = 0; i < self->num_stmts; i++)
-	{
+	for (i = 0; i < self->num_stmts; i++) {
 		stmt = self->stmts[i];
 		if (stmt && stmt->result && stmt->result->cursor)
 			count++;
@@ -349,11 +332,11 @@ CC_cursor_count(ConnectionClass *self)
 	return count;
 }
 
-void
+void 
 CC_clear_error(ConnectionClass *self)
 {
-	self->errornumber = 0;
-	self->errormsg = NULL;
+	self->errornumber = 0; 
+	self->errormsg = NULL; 
 	self->errormsg_created = FALSE;
 }
 
@@ -362,10 +345,9 @@ CC_clear_error(ConnectionClass *self)
 char
 CC_abort(ConnectionClass *self)
 {
-	QResultClass *res;
+QResultClass *res;
 
-	if (CC_is_in_trans(self))
-	{
+	if ( CC_is_in_trans(self)) {
 		res = NULL;
 
 		mylog("CC_abort:  sending ABORT!\n");
@@ -377,6 +359,7 @@ CC_abort(ConnectionClass *self)
 			QR_Destructor(res);
 		else
 			return FALSE;
+
 	}
 
 	return TRUE;
@@ -386,8 +369,8 @@ CC_abort(ConnectionClass *self)
 char
 CC_cleanup(ConnectionClass *self)
 {
-	int			i;
-	StatementClass *stmt;
+int i;
+StatementClass *stmt;
 
 	if (self->status == CONN_EXECUTING)
 		return FALSE;
@@ -402,32 +385,31 @@ CC_cleanup(ConnectionClass *self)
 
 	mylog("after CC_abort\n");
 
-	/* This actually closes the connection to the dbase */
-	if (self->sock)
-	{
-		SOCK_Destructor(self->sock);
+	/*  This actually closes the connection to the dbase */
+	if (self->sock) {
+	    SOCK_Destructor(self->sock);
 		self->sock = NULL;
 	}
 
 	mylog("after SOCK destructor\n");
 
-	/* Free all the stmts on this connection */
-	for (i = 0; i < self->num_stmts; i++)
-	{
+	/*  Free all the stmts on this connection */
+	for (i = 0; i < self->num_stmts; i++) {
 		stmt = self->stmts[i];
-		if (stmt)
-		{
+		if (stmt) {
+
 			stmt->hdbc = NULL;	/* prevent any more dbase interactions */
+
 			SC_Destructor(stmt);
+
 			self->stmts[i] = NULL;
 		}
 	}
 
-	/* Check for translation dll */
+	/*	Check for translation dll */
 #ifdef WIN32
-	if (self->translation_handle)
-	{
-		FreeLibrary(self->translation_handle);
+	if ( self->translation_handle) {
+		FreeLibrary (self->translation_handle);
 		self->translation_handle = NULL;
 	}
 #endif
@@ -437,40 +419,37 @@ CC_cleanup(ConnectionClass *self)
 }
 
 int
-CC_set_translation(ConnectionClass *self)
+CC_set_translation (ConnectionClass *self)
 {
 
 #ifdef WIN32
 
-	if (self->translation_handle != NULL)
-	{
-		FreeLibrary(self->translation_handle);
+	if (self->translation_handle != NULL) {
+		FreeLibrary (self->translation_handle);
 		self->translation_handle = NULL;
 	}
 
 	if (self->connInfo.translation_dll[0] == 0)
 		return TRUE;
 
-	self->translation_option = atoi(self->connInfo.translation_option);
-	self->translation_handle = LoadLibrary(self->connInfo.translation_dll);
+	self->translation_option = atoi (self->connInfo.translation_option);
+	self->translation_handle = LoadLibrary (self->connInfo.translation_dll);
 
-	if (self->translation_handle == NULL)
-	{
+	if (self->translation_handle == NULL) {
 		self->errornumber = CONN_UNABLE_TO_LOAD_DLL;
 		self->errormsg = "Could not load the translation DLL.";
 		return FALSE;
 	}
 
 	self->DataSourceToDriver
-		= (DataSourceToDriverProc) GetProcAddress(self->translation_handle,
+	 = (DataSourceToDriverProc) GetProcAddress (self->translation_handle,
 												"SQLDataSourceToDriver");
 
 	self->DriverToDataSource
-		= (DriverToDataSourceProc) GetProcAddress(self->translation_handle,
+	 = (DriverToDataSourceProc) GetProcAddress (self->translation_handle,
 												"SQLDriverToDataSource");
 
-	if (self->DataSourceToDriver == NULL || self->DriverToDataSource == NULL)
-	{
+	if (self->DataSourceToDriver == NULL || self->DriverToDataSource == NULL) {
 		self->errornumber = CONN_UNABLE_TO_LOAD_DLL;
 		self->errormsg = "Could not find translation DLL functions.";
 		return FALSE;
@@ -479,55 +458,55 @@ CC_set_translation(ConnectionClass *self)
 	return TRUE;
 }
 
-char
+char 
 CC_connect(ConnectionClass *self, char do_password)
 {
-	StartupPacket sp;
-	QResultClass *res;
-	SocketClass *sock;
-	ConnInfo   *ci = &(self->connInfo);
-	int			areq = -1;
-	int			beresp;
-	char		msgbuffer[ERROR_MSG_LENGTH];
-	char		salt[2];
-	static char *func = "CC_connect";
+StartupPacket sp;
+StartupPacket6_2 sp62;
+QResultClass *res;
+SocketClass *sock;
+ConnInfo *ci = &(self->connInfo);
+int areq = -1;
+int beresp;
+char msgbuffer[ERROR_MSG_LENGTH]; 
+char salt[2];
+static char *func="CC_connect";
 
 	mylog("%s: entering...\n", func);
 
-	if (do_password)
+	if ( do_password)
+
 		sock = self->sock;		/* already connected, just authenticate */
 
-	else
-	{
+	else {
+
 		qlog("Global Options: Version='%s', fetch=%d, socket=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d\n",
-			 POSTGRESDRIVERVERSION,
-			 globals.fetch_max,
-			 globals.socket_buffersize,
-			 globals.unknown_sizes,
-			 globals.max_varchar_size,
-			 globals.max_longvarchar_size);
+			POSTGRESDRIVERVERSION,
+			globals.fetch_max, 
+			globals.socket_buffersize, 
+			globals.unknown_sizes, 
+			globals.max_varchar_size, 
+			globals.max_longvarchar_size);
 		qlog("                disable_optimizer=%d, ksqo=%d, unique_index=%d, use_declarefetch=%d\n",
-			 globals.disable_optimizer,
-			 globals.ksqo,
-			 globals.unique_index,
-			 globals.use_declarefetch);
+			globals.disable_optimizer,
+			globals.ksqo,
+			globals.unique_index,
+			globals.use_declarefetch);
 		qlog("                text_as_longvarchar=%d, unknowns_as_longvarchar=%d, bools_as_char=%d\n",
-			 globals.text_as_longvarchar,
-			 globals.unknowns_as_longvarchar,
-			 globals.bools_as_char);
+			globals.text_as_longvarchar, 
+			globals.unknowns_as_longvarchar, 
+			globals.bools_as_char);
 		qlog("                extra_systable_prefixes='%s', conn_settings='%s'\n",
-			 globals.extra_systable_prefixes,
-			 globals.conn_settings);
+			globals.extra_systable_prefixes, 
+			globals.conn_settings);
 
-		if (self->status != CONN_NOT_CONNECTED)
-		{
+		if (self->status != CONN_NOT_CONNECTED) {
 			self->errormsg = "Already connected.";
 			self->errornumber = CONN_OPENDB_ERROR;
 			return 0;
 		}
 
-		if (ci->server[0] == '\0' || ci->port[0] == '\0' || ci->database[0] == '\0')
-		{
+		if ( ci->server[0] == '\0' || ci->port[0] == '\0' || ci->database[0] == '\0') {
 			self->errornumber = CONN_INIREAD_ERROR;
 			self->errormsg = "Missing server name, port, or database name in call to CC_connect.";
 			return 0;
@@ -535,18 +514,15 @@ CC_connect(ConnectionClass *self, char do_password)
 
 		mylog("CC_connect(): DSN = '%s', server = '%s', port = '%s', database = '%s', username = '%s', password='%s'\n", ci->dsn, ci->server, ci->port, ci->database, ci->username, ci->password);
 
-		/*
-		 * If the socket was closed for some reason (like a SQLDisconnect,
-		 * but no SQLFreeConnect then create a socket now.
-		 */
-		if (!self->sock)
-		{
+		/* If the socket was closed for some reason (like a SQLDisconnect, but no SQLFreeConnect
+			then create a socket now.
+		*/
+		if ( ! self->sock) {
 			self->sock = SOCK_Constructor();
-			if (!self->sock)
-			{
-				self->errornumber = CONNECTION_SERVER_NOT_REACHED;
-				self->errormsg = "Could not open a socket to the server";
-				return 0;
+			if ( ! self->sock) {
+				 self->errornumber = CONNECTION_SERVER_NOT_REACHED;
+				 self->errormsg = "Could not open a socket to the server";
+				 return 0;
 			}
 		}
 
@@ -555,8 +531,7 @@ CC_connect(ConnectionClass *self, char do_password)
 		mylog("connecting to the server socket...\n");
 
 		SOCK_connect_to(sock, (short) atoi(ci->port), ci->server);
-		if (SOCK_get_errcode(sock) != 0)
-		{
+		if (SOCK_get_errcode(sock) != 0) {
 			mylog("connection to the server socket failed.\n");
 			self->errornumber = CONNECTION_SERVER_NOT_REACHED;
 			self->errormsg = "Could not connect to the server";
@@ -564,25 +539,40 @@ CC_connect(ConnectionClass *self, char do_password)
 		}
 		mylog("connection to the server socket succeeded.\n");
 
-		memset(&sp, 0, sizeof(StartupPacket));
+		if ( PROTOCOL_62(ci)) {
+			sock->reverse = TRUE;		/* make put_int and get_int work for 6.2 */
+
+			memset(&sp62, 0, sizeof(StartupPacket6_2));
+			SOCK_put_int(sock, htonl(4+sizeof(StartupPacket6_2)), 4);
+			sp62.authtype = htonl(NO_AUTHENTICATION);
+			strncpy(sp62.database, ci->database, PATH_SIZE);
+			strncpy(sp62.user, ci->username, NAMEDATALEN);
+			SOCK_put_n_char(sock, (char *) &sp62, sizeof(StartupPacket6_2));
+			SOCK_flush_output(sock);
+		}
+		else {
+			memset(&sp, 0, sizeof(StartupPacket));
 
-		mylog("sizeof startup packet = %d\n", sizeof(StartupPacket));
+			mylog("sizeof startup packet = %d\n", sizeof(StartupPacket));
 
-		/* Send length of Authentication Block */
-		SOCK_put_int(sock, 4 + sizeof(StartupPacket), 4);
+			/* Send length of Authentication Block */
+			SOCK_put_int(sock, 4+sizeof(StartupPacket), 4); 
 
-		sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST);
+			if ( PROTOCOL_63(ci))
+				sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_63);
+			else
+				sp.protoVersion = (ProtocolVersion) htonl(PG_PROTOCOL_LATEST);
 
-		strncpy(sp.database, ci->database, SM_DATABASE);
-		strncpy(sp.user, ci->username, SM_USER);
+			strncpy(sp.database, ci->database, SM_DATABASE);
+			strncpy(sp.user, ci->username, SM_USER);
 
-		SOCK_put_n_char(sock, (char *) &sp, sizeof(StartupPacket));
-		SOCK_flush_output(sock);
+			SOCK_put_n_char(sock, (char *) &sp, sizeof(StartupPacket));
+			SOCK_flush_output(sock);
+		}
 
 		mylog("sent the authentication block.\n");
 
-		if (sock->errornumber != 0)
-		{
+		if (sock->errornumber != 0) {
 			mylog("couldn't send the authentication block properly.\n");
 			self->errornumber = CONN_INVALID_AUTHENTICATION;
 			self->errormsg = "Sending the authentication packet failed";
@@ -591,109 +581,106 @@ CC_connect(ConnectionClass *self, char do_password)
 		mylog("sent the authentication block successfully.\n");
 	}
 
+
 	mylog("gonna do authentication\n");
 
 
 	/* *************************************************** */
-	/* Now get the authentication request from backend */
+	/*	Now get the authentication request from backend */
 	/* *************************************************** */
 
-	do
-	{
+	if ( ! PROTOCOL_62(ci))	do {
+
 		if (do_password)
 			beresp = 'R';
 		else
 			beresp = SOCK_get_char(sock);
 
-		switch (beresp)
-		{
-			case 'E':
-				mylog("auth got 'E'\n");
+		switch(beresp) {
+		case 'E':
+			mylog("auth got 'E'\n");
 
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-				self->errornumber = CONN_INVALID_AUTHENTICATION;
-				self->errormsg = msgbuffer;
-				qlog("ERROR from backend during authentication: '%s'\n", self->errormsg);
-				return 0;
-			case 'R':
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			self->errornumber = CONN_INVALID_AUTHENTICATION;
+			self->errormsg = msgbuffer;
+			qlog("ERROR from backend during authentication: '%s'\n", self->errormsg);
+			return 0;
+		case 'R':
 
-				if (do_password)
-				{
-					mylog("in 'R' do_password\n");
-					areq = AUTH_REQ_PASSWORD;
-					do_password = FALSE;
-				}
-				else
-				{
-					mylog("auth got 'R'\n");
+			if (do_password) {
+				mylog("in 'R' do_password\n");
+				areq = AUTH_REQ_PASSWORD;
+				do_password = FALSE;
+			}
+			else {
+				mylog("auth got 'R'\n");
 
-					areq = SOCK_get_int(sock, 4);
-					if (areq == AUTH_REQ_CRYPT)
-						SOCK_get_n_char(sock, salt, 2);
+				areq = SOCK_get_int(sock, 4);
+				if (areq == AUTH_REQ_CRYPT)
+					SOCK_get_n_char(sock, salt, 2);
 
-					mylog("areq = %d\n", areq);
-				}
-				switch (areq)
-				{
-					case AUTH_REQ_OK:
-						break;
+				mylog("areq = %d\n", areq);
+			}
+			switch(areq) {
+			case AUTH_REQ_OK:
+				break;
 
-					case AUTH_REQ_KRB4:
-						self->errormsg = "Kerberos 4 authentication not supported";
-						self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-						return 0;
+			case AUTH_REQ_KRB4:
+				self->errormsg = "Kerberos 4 authentication not supported";
+				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+				return 0;
 
-					case AUTH_REQ_KRB5:
-						self->errormsg = "Kerberos 5 authentication not supported";
-						self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-						return 0;
+			case AUTH_REQ_KRB5:
+				self->errormsg = "Kerberos 5 authentication not supported";
+				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+				return 0;
 
-					case AUTH_REQ_PASSWORD:
-						mylog("in AUTH_REQ_PASSWORD\n");
+			case AUTH_REQ_PASSWORD:
+				mylog("in AUTH_REQ_PASSWORD\n");
 
-						if (ci->password[0] == '\0')
-						{
-							self->errornumber = CONNECTION_NEED_PASSWORD;
-							self->errormsg = "A password is required for this connection.";
-							return -1;	/* need password */
-						}
+				if (ci->password[0] == '\0') {
+					self->errornumber = CONNECTION_NEED_PASSWORD;
+					self->errormsg = "A password is required for this connection.";
+					return -1;	/* need password */
+				}
 
-						mylog("past need password\n");
+				mylog("past need password\n");
 
-						SOCK_put_int(sock, 4 + strlen(ci->password) + 1, 4);
-						SOCK_put_n_char(sock, ci->password, strlen(ci->password) + 1);
-						SOCK_flush_output(sock);
+				SOCK_put_int(sock, 4+strlen(ci->password)+1, 4);
+				SOCK_put_n_char(sock, ci->password, strlen(ci->password) + 1);
+				SOCK_flush_output(sock);
 
-						mylog("past flush\n");
-						break;
+				mylog("past flush\n");
+				break;
 
-					case AUTH_REQ_CRYPT:
-						self->errormsg = "Password crypt authentication not supported";
-						self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-						return 0;
+			case AUTH_REQ_CRYPT:
+				self->errormsg = "Password crypt authentication not supported";
+				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
+				return 0;
 
-					default:
-						self->errormsg = "Unknown authentication type";
-						self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
-						return 0;
-				}
-				break;
 			default:
-				self->errormsg = "Unexpected protocol character during authentication";
-				self->errornumber = CONN_INVALID_AUTHENTICATION;
+				self->errormsg = "Unknown authentication type";
+				self->errornumber = CONN_AUTH_TYPE_UNSUPPORTED;
 				return 0;
+			}
+			break;
+		default:
+			self->errormsg = "Unexpected protocol character during authentication";
+			self->errornumber = CONN_INVALID_AUTHENTICATION;
+			return 0;
 		}
-	} while (areq != AUTH_REQ_OK);
 
-	CC_clear_error(self);		/* clear any password error */
+	} while (areq != AUTH_REQ_OK);		
+
+
+	CC_clear_error(self);	/* clear any password error */
 
 	/* send an empty query in order to find out whether the specified */
 	/* database really exists on the server machine */
 	mylog("sending an empty query...\n");
 
 	res = CC_send_query(self, " ", NULL);
-	if (res == NULL || QR_get_status(res) != PGRES_EMPTY_QUERY)
-	{
+	if ( res == NULL || QR_get_status(res) != PGRES_EMPTY_QUERY) {
 		mylog("got no result from the empty query.  (probably database does not exist)\n");
 		self->errornumber = CONNECTION_NO_SUCH_DATABASE;
 		self->errormsg = "The database does not exist on the server\nor user authentication failed.";
@@ -706,43 +693,38 @@ CC_connect(ConnectionClass *self, char do_password)
 
 	mylog("empty query seems to be OK.\n");
 
-	CC_set_translation(self);
+	CC_set_translation (self);
 
 	/**********************************************/
 	/*******   Send any initial settings  *********/
 	/**********************************************/
 
-	/*
-	 * Since these functions allocate statements, and since the connection
-	 * is not established yet, it would violate odbc state transition
-	 * rules.  Therefore, these functions call the corresponding local
-	 * function instead.
-	 */
+	/*	Since these functions allocate statements, and since the connection is not
+		established yet, it would violate odbc state transition rules.  Therefore,
+		these functions call the corresponding local function instead.
+	*/
 	CC_send_settings(self);
-	CC_lookup_lo(self);			/* a hack to get the oid of our large
-								 * object oid type */
-	CC_lookup_pg_version(self); /* Get PostgreSQL version for SQLGetInfo
-								 * use */
+	CC_lookup_lo(self);		/* a hack to get the oid of our large object oid type */
+	CC_lookup_pg_version(self);	/* Get PostgreSQL version for SQLGetInfo use */
 
-	CC_clear_error(self);		/* clear any initial command errors */
+	CC_clear_error(self);	/* clear any initial command errors */
 	self->status = CONN_CONNECTED;
 
 	mylog("%s: returning...\n", func);
 
 	return 1;
+
 }
 
 char
 CC_add_statement(ConnectionClass *self, StatementClass *stmt)
 {
-	int			i;
+int i;
 
 	mylog("CC_add_statement: self=%u, stmt=%u\n", self, stmt);
 
-	for (i = 0; i < self->num_stmts; i++)
-	{
-		if (!self->stmts[i])
-		{
+	for (i = 0; i < self->num_stmts; i++) {
+		if ( ! self->stmts[i]) {
 			stmt->hdbc = self;
 			self->stmts[i] = stmt;
 			return TRUE;
@@ -750,8 +732,8 @@ CC_add_statement(ConnectionClass *self, StatementClass *stmt)
 	}
 
 	/* no more room -- allocate more memory */
-	self->stmts = (StatementClass **) realloc(self->stmts, sizeof(StatementClass *) * (STMT_INCREMENT + self->num_stmts));
-	if (!self->stmts)
+	self->stmts = (StatementClass **) realloc( self->stmts, sizeof(StatementClass *) * (STMT_INCREMENT + self->num_stmts));
+	if ( ! self->stmts)
 		return FALSE;
 
 	memset(&self->stmts[self->num_stmts], 0, sizeof(StatementClass *) * STMT_INCREMENT);
@@ -764,15 +746,13 @@ CC_add_statement(ConnectionClass *self, StatementClass *stmt)
 	return TRUE;
 }
 
-char
+char 
 CC_remove_statement(ConnectionClass *self, StatementClass *stmt)
 {
-	int			i;
+int i;
 
-	for (i = 0; i < self->num_stmts; i++)
-	{
-		if (self->stmts[i] == stmt && stmt->status != STMT_EXECUTING)
-		{
+	for (i = 0; i < self->num_stmts; i++) {
+		if (self->stmts[i] == stmt && stmt->status != STMT_EXECUTING) {
 			self->stmts[i] = NULL;
 			return TRUE;
 		}
@@ -787,9 +767,9 @@ CC_remove_statement(ConnectionClass *self, StatementClass *stmt)
 char *
 CC_create_errormsg(ConnectionClass *self)
 {
-	SocketClass *sock = self->sock;
-	int			pos;
-	static char msg[4096];
+SocketClass *sock = self->sock;
+int pos;
+static char msg[4096];
 
 	mylog("enter CC_create_errormsg\n");
 
@@ -800,8 +780,7 @@ CC_create_errormsg(ConnectionClass *self)
 
 	mylog("msg = '%s'\n", msg);
 
-	if (sock && sock->errormsg && sock->errormsg[0] != '\0')
-	{
+	if (sock && sock->errormsg && sock->errormsg[0] != '\0') {
 		pos = strlen(msg);
 		sprintf(&msg[pos], ";\n%s", sock->errormsg);
 	}
@@ -811,22 +790,20 @@ CC_create_errormsg(ConnectionClass *self)
 }
 
 
-char
+char 
 CC_get_error(ConnectionClass *self, int *number, char **message)
 {
-	int			rv;
+int rv;
 
 	mylog("enter CC_get_error\n");
 
-	/* Create a very informative errormsg if it hasn't been done yet. */
-	if (!self->errormsg_created)
-	{
+	/*	Create a very informative errormsg if it hasn't been done yet. */
+	if ( ! self->errormsg_created) {
 		self->errormsg = CC_create_errormsg(self);
 		self->errormsg_created = TRUE;
 	}
 
-	if (self->errornumber)
-	{
+	if (self->errornumber) {
 		*number = self->errornumber;
 		*message = self->errormsg;
 	}
@@ -845,29 +822,25 @@ CC_get_error(ConnectionClass *self, int *number, char **message)
 	needs to be re-filled).
 
 	The "cursor" is used by SQLExecute to associate a statement handle as the cursor name
-	(i.e., C3326857) for SQL select statements.  This cursor is then used in future
+	(i.e., C3326857) for SQL select statements.  This cursor is then used in future 
 	'declare cursor C3326857 for ...' and 'fetch 100 in C3326857' statements.
 */
 QResultClass *
 CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 {
-	QResultClass *result_in,
-			   *res = NULL;
-	char		swallow;
-	int			id;
-	SocketClass *sock = self->sock;
-	static char msgbuffer[MAX_MESSAGE_LEN + 1];
-	char		cmdbuffer[MAX_MESSAGE_LEN + 1]; /* QR_set_command() dups
-												 * this string so dont
-												 * need static */
+QResultClass *result_in, *res = NULL;
+char swallow;
+int id;
+SocketClass *sock = self->sock;
+static char msgbuffer[MAX_MESSAGE_LEN+1];
+char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont need static */
 
 
 	mylog("send_query(): conn=%u, query='%s'\n", self, query);
 	qlog("conn=%u, query='%s'\n", self, query);
 
 	/* Indicate that we are sending a query to the backend */
-	if (strlen(query) > MAX_MESSAGE_LEN - 2)
-	{
+	if(strlen(query) > MAX_MESSAGE_LEN-2) {
 		self->errornumber = CONNECTION_MSG_TOO_LONG;
 		self->errormsg = "Query string is too long";
 		return NULL;
@@ -876,8 +849,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 	if ((NULL == query) || (query[0] == '\0'))
 		return NULL;
 
-	if (SOCK_get_errcode(sock) != 0)
-	{
+	if (SOCK_get_errcode(sock) != 0) {
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send Query to backend";
 		CC_set_no_trans(self);
@@ -885,8 +857,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 	}
 
 	SOCK_put_char(sock, 'Q');
-	if (SOCK_get_errcode(sock) != 0)
-	{
+	if (SOCK_get_errcode(sock) != 0) {
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send Query to backend";
 		CC_set_no_trans(self);
@@ -896,8 +867,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 	SOCK_put_string(sock, query);
 	SOCK_flush_output(sock);
 
-	if (SOCK_get_errcode(sock) != 0)
-	{
+	if (SOCK_get_errcode(sock) != 0) {
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send Query to backend";
 		CC_set_no_trans(self);
@@ -906,13 +876,11 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 
 	mylog("send_query: done sending query\n");
 
-	while (1)
-	{
+	while(1) {
 		/* what type of message is coming now ? */
 		id = SOCK_get_char(sock);
 
-		if ((SOCK_get_errcode(sock) != 0) || (id == EOF))
-		{
+		if ((SOCK_get_errcode(sock) != 0) || (id == EOF)) {
 			self->errornumber = CONNECTION_NO_RESPONSE;
 			self->errormsg = "No response from the backend";
 			if (res)
@@ -925,218 +893,197 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 
 		mylog("send_query: got id = '%c'\n", id);
 
-		switch (id)
-		{
-			case 'A':			/* Asynchronous Messages are ignored */
-				(void) SOCK_get_int(sock, 4);	/* id of notification */
-				SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
-				/* name of the relation the message comes from */
-				break;
-			case 'C':			/* portal query command, no tuples
-								 * returned */
-				/* read in the return message from the backend */
-				SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
-				if (SOCK_get_errcode(sock) != 0)
-				{
-					self->errornumber = CONNECTION_NO_RESPONSE;
-					self->errormsg = "No response from backend while receiving a portal query command";
-					mylog("send_query: 'C' - %s\n", self->errormsg);
-					CC_set_no_trans(self);
-					return NULL;
-				}
-				else
-				{
-					char		clear = 0;
-
-					mylog("send_query: ok - 'C' - %s\n", cmdbuffer);
-
-					if (res == NULL)	/* allow for "show" style notices */
-						res = QR_Constructor();
-
-					mylog("send_query: setting cmdbuffer = '%s'\n", cmdbuffer);
-
-					/* Only save the first command */
-					QR_set_status(res, PGRES_COMMAND_OK);
-					QR_set_command(res, cmdbuffer);
-
-					/*
-					 * (Quotation from the original comments) since
-					 * backend may produce more than one result for some
-					 * commands we need to poll until clear so we send an
-					 * empty query, and keep reading out of the pipe until
-					 * an 'I' is received
-					 */
-
-					SOCK_put_string(sock, "Q ");
-					SOCK_flush_output(sock);
-
-					while (!clear)
-					{
-						id = SOCK_get_char(sock);
-						switch (id)
-						{
-							case 'I':
-								(void) SOCK_get_char(sock);
-								clear = TRUE;
-								break;
-							case 'Z':
-								break;
-							case 'C':
-								SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-								qlog("Command response: '%s'\n", cmdbuffer);
-								break;
-							case 'N':
-								SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-								qlog("NOTICE from backend during clear: '%s'\n", cmdbuffer);
-								break;
-							case 'E':
-								SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-								qlog("ERROR from backend during clear: '%s'\n", cmdbuffer);
-
-								/*
-								 * We must report this type of error as
-								 * well (practically for reference
-								 * integrity violation error reporting,
-								 * from PostgreSQL 7.0). (Zoltan Kovacs,
-								 * 04/26/2000)
-								 */
-								self->errormsg = cmdbuffer;
-								if (!strncmp(self->errormsg, "FATAL", 5))
-								{
-									self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
-									CC_set_no_trans(self);
-								}
-								else
-									self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
-								QR_set_status(res, PGRES_NONFATAL_ERROR);
-								break;
-						}
-					}
-
-					mylog("send_query: returning res = %u\n", res);
-					return res;
-				}
-			case 'K':			/* Secret key (6.4 protocol) */
-				(void) SOCK_get_int(sock, 4);	/* pid */
-				(void) SOCK_get_int(sock, 4);	/* key */
-
-				break;
-			case 'Z':			/* Backend is ready for new query (6.4) */
-				break;
-			case 'N':			/* NOTICE: */
-				SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
-
-				res = QR_Constructor();
-				QR_set_status(res, PGRES_NONFATAL_ERROR);
-				QR_set_notice(res, cmdbuffer);	/* will dup this string */
+		switch (id) {
+		case 'A' : /* Asynchronous Messages are ignored */
+			(void)SOCK_get_int(sock, 4); /* id of notification */
+			SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
+			/* name of the relation the message comes from */
+			break;
+		case 'C' : /* portal query command, no tuples returned */
+			/* read in the return message from the backend */
+			SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
+			if (SOCK_get_errcode(sock) != 0) {
+				self->errornumber = CONNECTION_NO_RESPONSE;
+				self->errormsg = "No response from backend while receiving a portal query command";
+				mylog("send_query: 'C' - %s\n", self->errormsg);
+				CC_set_no_trans(self);
+				return NULL;
+			} else {
 
-				mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
-				qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer);
+				char clear = 0;
 
-				continue;		/* dont return a result -- continue
-								 * reading */
+				mylog("send_query: ok - 'C' - %s\n", cmdbuffer);
 
-			case 'I':			/* The server sends an empty query */
-				/* There is a closing '\0' following the 'I', so we eat it */
-				swallow = SOCK_get_char(sock);
-				if ((swallow != '\0') || SOCK_get_errcode(sock) != 0)
-				{
-					self->errornumber = CONNECTION_BACKEND_CRAZY;
-					self->errormsg = "Unexpected protocol character from backend (send_query - I)";
-					res = QR_Constructor();
-					QR_set_status(res, PGRES_FATAL_ERROR);
-					return res;
-				}
-				else
-				{
-					/* We return the empty query */
+				if (res == NULL)	/* allow for "show" style notices */
 					res = QR_Constructor();
-					QR_set_status(res, PGRES_EMPTY_QUERY);
-					return res;
-				}
-				break;
-			case 'E':
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
 
-				/* Remove a newline */
-				if (msgbuffer[0] != '\0' && msgbuffer[strlen(msgbuffer) - 1] == '\n')
-					msgbuffer[strlen(msgbuffer) - 1] = '\0';
+				mylog("send_query: setting cmdbuffer = '%s'\n", cmdbuffer);
 
-				self->errormsg = msgbuffer;
+				/*	Only save the first command */
+				QR_set_status(res, PGRES_COMMAND_OK);
+				QR_set_command(res, cmdbuffer);
 
-				mylog("send_query: 'E' - %s\n", self->errormsg);
-				qlog("ERROR from backend during send_query: '%s'\n", self->errormsg);
+				/* (Quotation from the original comments)
+					since backend may produce more than one result for some commands
+					we need to poll until clear
+					so we send an empty query, and keep reading out of the pipe
+					until an 'I' is received
+				*/
 
-				/* We should report that an error occured. Zoltan */
-				res = QR_Constructor();
 
-				if (!strncmp(self->errormsg, "FATAL", 5))
-				{
-					self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
-					CC_set_no_trans(self);
-					QR_set_status(res, PGRES_FATAL_ERROR);
-				}
-				else
-				{
-					self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
-					QR_set_status(res, PGRES_NONFATAL_ERROR);
+				SOCK_put_string(sock, "Q ");
+				SOCK_flush_output(sock);
+
+				while( ! clear) {
+					id = SOCK_get_char(sock);
+					switch(id) {
+					case 'I':
+						(void) SOCK_get_char(sock);
+						clear = TRUE;
+						break;
+					case 'Z':
+						break;
+					case 'C':
+						SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+						qlog("Command response: '%s'\n", cmdbuffer);
+						break;
+					case 'N':
+						SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+						qlog("NOTICE from backend during clear: '%s'\n", cmdbuffer);
+						break;
+					case 'E':
+						SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
+						qlog("ERROR from backend during clear: '%s'\n", cmdbuffer);
+						/* We must report this type of error as well
+						   (practically for reference integrity violation
+						   error reporting, from PostgreSQL 7.0).
+						   (Zoltan Kovacs, 04/26/2000)
+						*/
+						self->errormsg = cmdbuffer;
+						if ( ! strncmp(self->errormsg, "FATAL", 5)) {
+						    self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
+						    CC_set_no_trans(self);
+						    }
+						else 
+						    self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
+						QR_set_status(res, PGRES_NONFATAL_ERROR);
+						break;
+					}
 				}
+				
+				mylog("send_query: returning res = %u\n", res);
+				return res;
+			}
+		case 'K':	/* Secret key (6.4 protocol) */
+			(void)SOCK_get_int(sock, 4); /* pid */
+			(void)SOCK_get_int(sock, 4); /* key */
 
-				return res;		/* instead of NULL. Zoltan */
+			break;
+		case 'Z':	/* Backend is ready for new query (6.4) */
+			break;
+		case 'N' : /* NOTICE: */
+			SOCK_get_string(sock, cmdbuffer, ERROR_MSG_LENGTH);
 
-			case 'P':			/* get the Portal name */
-				SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
-				break;
-			case 'T':			/* Tuple results start here */
-				result_in = qi ? qi->result_in : NULL;
-
-				if (result_in == NULL)
-				{
-					result_in = QR_Constructor();
-					mylog("send_query: 'T' no result_in: res = %u\n", result_in);
-					if (!result_in)
-					{
-						self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
-						self->errormsg = "Could not create result info in send_query.";
-						return NULL;
-					}
+			res = QR_Constructor();
+			QR_set_status(res, PGRES_NONFATAL_ERROR);
+			QR_set_notice(res, cmdbuffer);	/* will dup this string */
 
-					if (qi)
-						QR_set_cache_size(result_in, qi->row_size);
+			mylog("~~~ NOTICE: '%s'\n", cmdbuffer);
+			qlog("NOTICE from backend during send_query: '%s'\n", cmdbuffer);
 
-					if (!QR_fetch_tuples(result_in, self, qi ? qi->cursor : NULL))
-					{
-						self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
-						self->errormsg = QR_get_message(result_in);
-						return NULL;
-					}
-				}
-				else
-				{				/* next fetch, so reuse an existing result */
-					if (!QR_fetch_tuples(result_in, NULL, NULL))
-					{
-						self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
-						self->errormsg = QR_get_message(result_in);
-						return NULL;
-					}
-				}
+			continue;		/* dont return a result -- continue reading */
 
-				return result_in;
-			case 'D':			/* Copy in command began successfully */
+		case 'I' : /* The server sends an empty query */
+				/* There is a closing '\0' following the 'I', so we eat it */
+			swallow = SOCK_get_char(sock);
+			if ((swallow != '\0') || SOCK_get_errcode(sock) != 0) {
+				self->errornumber = CONNECTION_BACKEND_CRAZY;
+				self->errormsg = "Unexpected protocol character from backend (send_query - I)";
 				res = QR_Constructor();
-				QR_set_status(res, PGRES_COPY_IN);
+				QR_set_status(res, PGRES_FATAL_ERROR);
 				return res;
-			case 'B':			/* Copy out command began successfully */
+			} else {
+				/* We return the empty query */
 				res = QR_Constructor();
-				QR_set_status(res, PGRES_COPY_OUT);
+				QR_set_status(res, PGRES_EMPTY_QUERY);
 				return res;
-			default:
-				self->errornumber = CONNECTION_BACKEND_CRAZY;
-				self->errormsg = "Unexpected protocol character from backend (send_query)";
+			}
+			break;
+		case 'E' : 
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+
+			/*	Remove a newline */
+			if (msgbuffer[0] != '\0' && msgbuffer[strlen(msgbuffer)-1] == '\n')
+				msgbuffer[strlen(msgbuffer)-1] = '\0';
+
+			self->errormsg = msgbuffer;
+
+			mylog("send_query: 'E' - %s\n", self->errormsg);
+			qlog("ERROR from backend during send_query: '%s'\n", self->errormsg);
+
+			/* We should report that an error occured. Zoltan */
+			res = QR_Constructor();
+
+			if ( ! strncmp(self->errormsg, "FATAL", 5)) {
+				self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
 				CC_set_no_trans(self);
+				QR_set_status(res, PGRES_FATAL_ERROR);
+			}
+			else {
+				self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
+				QR_set_status(res, PGRES_NONFATAL_ERROR);
+			}
 
-				mylog("send_query: error - %s\n", self->errormsg);
-				return NULL;
+			return res; /* instead of NULL. Zoltan */
+
+		case 'P' : /* get the Portal name */
+			SOCK_get_string(sock, msgbuffer, MAX_MESSAGE_LEN);
+			break;
+		case 'T': /* Tuple results start here */
+			result_in = qi ? qi->result_in : NULL;
+
+			if ( result_in == NULL) {
+				result_in = QR_Constructor();
+				mylog("send_query: 'T' no result_in: res = %u\n", result_in);
+				if ( ! result_in) {
+					self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
+					self->errormsg = "Could not create result info in send_query.";
+					return NULL;
+				}
+
+				if (qi)
+					QR_set_cache_size(result_in, qi->row_size);
+
+				if ( ! QR_fetch_tuples(result_in, self, qi ? qi->cursor : NULL)) {
+					self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
+					self->errormsg = QR_get_message(result_in);
+					return NULL;
+				}
+			}
+			else {  /* next fetch, so reuse an existing result */
+				if ( ! QR_fetch_tuples(result_in, NULL, NULL)) {
+					self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
+					self->errormsg = QR_get_message(result_in);
+					return NULL;
+				}
+			}
+
+			return result_in;
+		case 'D': /* Copy in command began successfully */
+			res = QR_Constructor();
+			QR_set_status(res, PGRES_COPY_IN);
+			return res;
+		case 'B': /* Copy out command began successfully */
+			res = QR_Constructor();
+			QR_set_status(res, PGRES_COPY_OUT);
+			return res;
+		default:
+			self->errornumber = CONNECTION_BACKEND_CRAZY;
+			self->errormsg = "Unexpected protocol character from backend (send_query)";
+			CC_set_no_trans(self);
+
+			mylog("send_query: error - %s\n", self->errormsg);
+			return NULL;
 		}
 	}
 }
@@ -1144,17 +1091,14 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
 int
 CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *args, int nargs)
 {
-	char		id,
-				c,
-				done;
-	SocketClass *sock = self->sock;
-	static char msgbuffer[MAX_MESSAGE_LEN + 1];
-	int			i;
+char id, c, done;
+SocketClass *sock = self->sock;
+static char msgbuffer[MAX_MESSAGE_LEN+1];
+int i;
 
 	mylog("send_function(): conn=%u, fnid=%d, result_is_int=%d, nargs=%d\n", self, fnid, result_is_int, nargs);
 
-	if (SOCK_get_errcode(sock) != 0)
-	{
+	if (SOCK_get_errcode(sock) != 0) {
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send function to backend";
 		CC_set_no_trans(self);
@@ -1162,28 +1106,30 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
 	}
 
 	SOCK_put_string(sock, "F ");
-	if (SOCK_get_errcode(sock) != 0)
-	{
+	if (SOCK_get_errcode(sock) != 0) {
 		self->errornumber = CONNECTION_COULD_NOT_SEND;
 		self->errormsg = "Could not send function to backend";
 		CC_set_no_trans(self);
 		return FALSE;
 	}
 
-	SOCK_put_int(sock, fnid, 4);
-	SOCK_put_int(sock, nargs, 4);
+	SOCK_put_int(sock, fnid, 4); 
+	SOCK_put_int(sock, nargs, 4); 
+
 
 	mylog("send_function: done sending function\n");
 
-	for (i = 0; i < nargs; ++i)
-	{
+	for (i = 0; i < nargs; ++i) {
+
 		mylog("  arg[%d]: len = %d, isint = %d, integer = %d, ptr = %u\n", i, args[i].len, args[i].isint, args[i].u.integer, args[i].u.ptr);
 
 		SOCK_put_int(sock, args[i].len, 4);
-		if (args[i].isint)
+		if (args[i].isint) 
 			SOCK_put_int(sock, args[i].u.integer, 4);
 		else
 			SOCK_put_n_char(sock, (char *) args[i].u.ptr, args[i].len);
+
+
 	}
 
 	mylog("    done sending args\n");
@@ -1192,97 +1138,92 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
 	mylog("  after flush output\n");
 
 	done = FALSE;
-	while (!done)
-	{
+	while ( ! done) {
 		id = SOCK_get_char(sock);
 		mylog("   got id = %c\n", id);
 
-		switch (id)
-		{
-			case 'V':
-				done = TRUE;
-				break;			/* ok */
+		switch(id) {
+		case 'V':
+			done = TRUE;
+			break;		/* ok */
 
-			case 'N':
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-				mylog("send_function(V): 'N' - %s\n", msgbuffer);
-				/* continue reading */
-				break;
+		case 'N':
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			mylog("send_function(V): 'N' - %s\n", msgbuffer);
+			/*	continue reading */
+			break;
 
-			case 'E':
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-				self->errormsg = msgbuffer;
+		case 'E':
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			self->errormsg = msgbuffer;
 
-				mylog("send_function(V): 'E' - %s\n", self->errormsg);
-				qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
+			mylog("send_function(V): 'E' - %s\n", self->errormsg);
+			qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
 
-				return FALSE;
+			return FALSE;
 
-			case 'Z':
-				break;
+		case 'Z':
+			break;
 
-			default:
-				self->errornumber = CONNECTION_BACKEND_CRAZY;
-				self->errormsg = "Unexpected protocol character from backend (send_function, args)";
-				CC_set_no_trans(self);
+		default:
+			self->errornumber = CONNECTION_BACKEND_CRAZY;
+			self->errormsg = "Unexpected protocol character from backend (send_function, args)";
+			CC_set_no_trans(self);
 
-				mylog("send_function: error - %s\n", self->errormsg);
-				return FALSE;
+			mylog("send_function: error - %s\n", self->errormsg);
+			return FALSE;
 		}
 	}
 
 	id = SOCK_get_char(sock);
-	for (;;)
-	{
-		switch (id)
-		{
-			case 'G':			/* function returned properly */
-				mylog("  got G!\n");
+	for (;;) {
+		switch (id) {
+		case 'G':	/* function returned properly */
+			mylog("  got G!\n");
 
-				*actual_result_len = SOCK_get_int(sock, 4);
-				mylog("  actual_result_len = %d\n", *actual_result_len);
+			*actual_result_len = SOCK_get_int(sock, 4);
+			mylog("  actual_result_len = %d\n", *actual_result_len);
 
-				if (result_is_int)
-					*((int *) result_buf) = SOCK_get_int(sock, 4);
-				else
-					SOCK_get_n_char(sock, (char *) result_buf, *actual_result_len);
+			if (result_is_int)
+				*((int *) result_buf) = SOCK_get_int(sock, 4);
+			else
+				SOCK_get_n_char(sock, (char *) result_buf, *actual_result_len);
 
-				mylog("  after get result\n");
+			mylog("  after get result\n");
 
-				c = SOCK_get_char(sock);		/* get the last '0' */
+			c = SOCK_get_char(sock);	/* get the last '0' */
 
-				mylog("   after get 0\n");
+			mylog("   after get 0\n");
 
-				return TRUE;
+			return TRUE;
 
-			case 'E':
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-				self->errormsg = msgbuffer;
+		case 'E':
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			self->errormsg = msgbuffer;
 
-				mylog("send_function(G): 'E' - %s\n", self->errormsg);
-				qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
+			mylog("send_function(G): 'E' - %s\n", self->errormsg);
+			qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
 
-				return FALSE;
+			return FALSE;
 
-			case 'N':
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+		case 'N':
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
 
-				mylog("send_function(G): 'N' - %s\n", msgbuffer);
-				qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer);
+			mylog("send_function(G): 'N' - %s\n", msgbuffer);
+			qlog("NOTICE from backend during send_function: '%s'\n", msgbuffer);
 
-				continue;		/* dont return a result -- continue
-								 * reading */
+			continue;		/* dont return a result -- continue reading */
 
-			case '0':			/* empty result */
-				return TRUE;
+		case '0':	/* empty result */
+			return TRUE;
 
-			default:
-				self->errornumber = CONNECTION_BACKEND_CRAZY;
-				self->errormsg = "Unexpected protocol character from backend (send_function, result)";
-				CC_set_no_trans(self);
+		default:
+			self->errornumber = CONNECTION_BACKEND_CRAZY;
+			self->errormsg = "Unexpected protocol character from backend (send_function, result)";
+			CC_set_no_trans(self);
 
-				mylog("send_function: error - %s\n", self->errormsg);
-				return FALSE;
+			mylog("send_function: error - %s\n", self->errormsg);
+			return FALSE;
 		}
 	}
 }
@@ -1291,68 +1232,65 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
 char
 CC_send_settings(ConnectionClass *self)
 {
-	/* char ini_query[MAX_MESSAGE_LEN]; */
-	ConnInfo   *ci = &(self->connInfo);
-
+  /* char ini_query[MAX_MESSAGE_LEN]; */
+ConnInfo *ci = &(self->connInfo);
 /* QResultClass *res; */
-	HSTMT		hstmt;
-	StatementClass *stmt;
-	RETCODE		result;
-	char		status = TRUE;
-	char	   *cs,
-			   *ptr;
-	static char *func = "CC_send_settings";
+HSTMT hstmt;
+StatementClass *stmt;
+RETCODE result;
+char status = TRUE;
+char *cs, *ptr;
+static char *func="CC_send_settings";
 
 
 	mylog("%s: entering...\n", func);
 
-/*	This function must use the local odbc API functions since the odbc state
+/*	This function must use the local odbc API functions since the odbc state 
 	has not transitioned to "connected" yet.
 */
 
-	result = SQLAllocStmt(self, &hstmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	result = SQLAllocStmt( self, &hstmt);
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		return FALSE;
+	}
 	stmt = (StatementClass *) hstmt;
 
-	stmt->internal = TRUE;		/* ensure no BEGIN/COMMIT/ABORT stuff */
+	stmt->internal = TRUE;	/* ensure no BEGIN/COMMIT/ABORT stuff */
 
-	/* Set the Datestyle to the format the driver expects it to be in */
+	/*	Set the Datestyle to the format the driver expects it to be in */
 	result = SQLExecDirect(hstmt, "set DateStyle to 'ISO'", SQL_NTS);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 		status = FALSE;
 
 	mylog("%s: result %d, status %d from set DateStyle\n", func, result, status);
 
-	/* Disable genetic optimizer based on global flag */
-	if (globals.disable_optimizer)
-	{
+	/*	Disable genetic optimizer based on global flag */
+	if (globals.disable_optimizer) {
 		result = SQLExecDirect(hstmt, "set geqo to 'OFF'", SQL_NTS);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 			status = FALSE;
 
 		mylog("%s: result %d, status %d from set geqo\n", func, result, status);
+	
 	}
 
-	/* KSQO */
-	if (globals.ksqo)
-	{
+	/*	KSQO */
+	if (globals.ksqo) {
 		result = SQLExecDirect(hstmt, "set ksqo to 'ON'", SQL_NTS);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 			status = FALSE;
 
 		mylog("%s: result %d, status %d from set ksqo\n", func, result, status);
+	
 	}
 
-	/* Global settings */
-	if (globals.conn_settings[0] != '\0')
-	{
+	/*	Global settings */
+	if (globals.conn_settings[0] != '\0') {
 		cs = strdup(globals.conn_settings);
 		ptr = strtok(cs, ";");
-		while (ptr)
-		{
+		while (ptr) {
 			result = SQLExecDirect(hstmt, ptr, SQL_NTS);
-			if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+			if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 				status = FALSE;
 
 			mylog("%s: result %d, status %d from '%s'\n", func, result, status, ptr);
@@ -1362,16 +1300,14 @@ CC_send_settings(ConnectionClass *self)
 
 		free(cs);
 	}
-
-	/* Per Datasource settings */
-	if (ci->conn_settings[0] != '\0')
-	{
+	
+	/*	Per Datasource settings */
+	if (ci->conn_settings[0] != '\0') {
 		cs = strdup(ci->conn_settings);
 		ptr = strtok(cs, ";");
-		while (ptr)
-		{
+		while (ptr) {
 			result = SQLExecDirect(hstmt, ptr, SQL_NTS);
-			if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+			if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
 				status = FALSE;
 
 			mylog("%s: result %d, status %d from '%s'\n", func, result, status, ptr);
@@ -1393,40 +1329,38 @@ CC_send_settings(ConnectionClass *self)
 	will go away and the define 'PG_TYPE_LO' will be updated.
 */
 void
-CC_lookup_lo(ConnectionClass *self)
+CC_lookup_lo(ConnectionClass *self) 
 {
-	HSTMT		hstmt;
-	StatementClass *stmt;
-	RETCODE		result;
-	static char *func = "CC_lookup_lo";
+HSTMT hstmt;
+StatementClass *stmt;
+RETCODE result;
+static char *func = "CC_lookup_lo";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-/*	This function must use the local odbc API functions since the odbc state
+/*	This function must use the local odbc API functions since the odbc state 
 	has not transitioned to "connected" yet.
 */
-	result = SQLAllocStmt(self, &hstmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	result = SQLAllocStmt( self, &hstmt);
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		return;
+	}
 	stmt = (StatementClass *) hstmt;
 
 	result = SQLExecDirect(hstmt, "select oid from pg_type where typname='" PG_TYPE_LO_NAME "'", SQL_NTS);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLFetch(hstmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLGetData(hstmt, 1, SQL_C_SLONG, &self->lobj_type, sizeof(self->lobj_type), NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
@@ -1442,57 +1376,63 @@ CC_lookup_lo(ConnectionClass *self)
 	h-inoue 01-2-2001
 */
 void
-CC_initialize_pg_version(ConnectionClass *self)
+CC_initialize_pg_version(ConnectionClass *self) 
 {
-	strcpy(self->pg_version, self->connInfo.protocol);
-	self->pg_version_number = (float) 6.4;
-	self->pg_version_major = 6;
-	self->pg_version_minor = 4;
+	strcpy(self->pg_version, self->connInfo.protocol); 
+	if (PROTOCOL_62(&self->connInfo)) {
+		self->pg_version_number = (float) 6.2;
+		self->pg_version_major = 6;
+		self->pg_version_minor = 2;
+	} else if (PROTOCOL_63(&self->connInfo)) {
+		self->pg_version_number = (float) 6.3;
+		self->pg_version_major = 6;
+		self->pg_version_minor = 3;
+	} else {
+		self->pg_version_number = (float) 6.4;
+		self->pg_version_major = 6;
+		self->pg_version_minor = 4;
+	}
 }
-
 /*	This function gets the version of PostgreSQL that we're connected to.
-	This is used to return the correct info in SQLGetInfo
+    This is used to return the correct info in SQLGetInfo
 	DJP - 25-1-2001
 */
 void
-CC_lookup_pg_version(ConnectionClass *self)
+CC_lookup_pg_version(ConnectionClass *self) 
 {
-	HSTMT		hstmt;
-	StatementClass *stmt;
-	RETCODE		result;
-	char		szVersion[32];
-	int			major,
-				minor;
-	static char *func = "CC_lookup_pg_version";
+HSTMT hstmt;
+StatementClass *stmt;
+RETCODE result;
+char	szVersion[32];
+int	major, minor;
+static char *func = "CC_lookup_pg_version";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-/*	This function must use the local odbc API functions since the odbc state
+/*	This function must use the local odbc API functions since the odbc state 
 	has not transitioned to "connected" yet.
 */
-	result = SQLAllocStmt(self, &hstmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
+	result = SQLAllocStmt( self, &hstmt);
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		return;
+	}
 	stmt = (StatementClass *) hstmt;
 
-	/* get the server's version if possible	 */
+	/*	get the server's version if possible	*/
 	result = SQLExecDirect(hstmt, "select version()", SQL_NTS);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLFetch(hstmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
 
 	result = SQLGetData(hstmt, 1, SQL_C_CHAR, self->pg_version, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		SQLFreeStmt(hstmt, SQL_DROP);
 		return;
 	}
@@ -1500,8 +1440,7 @@ CC_lookup_pg_version(ConnectionClass *self)
 	/* Extract the Major and Minor numbers from the string. */
 	/* This assumes the string starts 'Postgresql X.X' */
 	strcpy(szVersion, "0.0");
-	if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2)
-	{
+	if (sscanf(self->pg_version, "%*s %d.%d", &major, &minor) >= 2) {
 		sprintf(szVersion, "%d.%d", major, minor);
 		self->pg_version_major = major;
 		self->pg_version_minor = minor;
@@ -1523,25 +1462,23 @@ CC_log_error(char *func, char *desc, ConnectionClass *self)
 #define nullcheck(a) (a ? a : "(NULL)")
 #endif
 
-	if (self)
-	{
-		qlog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
-		mylog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
+	if (self) {
+		qlog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck (self->errormsg));
+		mylog("CONN ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck (self->errormsg));
 		qlog("            ------------------------------------------------------------\n");
 		qlog("            henv=%u, conn=%u, status=%u, num_stmts=%d\n", self->henv, self, self->status, self->num_stmts);
 		qlog("            sock=%u, stmts=%u, lobj_type=%d\n", self->sock, self->stmts, self->lobj_type);
 
 		qlog("            ---------------- Socket Info -------------------------------\n");
-		if (self->sock)
-		{
-			SocketClass *sock = self->sock;
-
-			qlog("            socket=%d, reverse=%d, errornumber=%d, errormsg='%s'\n", sock->socket, sock->reverse, sock->errornumber, nullcheck(sock->errormsg));
-			qlog("            buffer_in=%u, buffer_out=%u\n", sock->buffer_in, sock->buffer_out);
-			qlog("            buffer_filled_in=%d, buffer_filled_out=%d, buffer_read_in=%d\n", sock->buffer_filled_in, sock->buffer_filled_out, sock->buffer_read_in);
+		if (self->sock) {
+		SocketClass *sock = self->sock;
+		qlog("            socket=%d, reverse=%d, errornumber=%d, errormsg='%s'\n", sock->socket, sock->reverse, sock->errornumber, nullcheck(sock->errormsg));
+		qlog("            buffer_in=%u, buffer_out=%u\n", sock->buffer_in, sock->buffer_out);
+		qlog("            buffer_filled_in=%d, buffer_filled_out=%d, buffer_read_in=%d\n", sock->buffer_filled_in, sock->buffer_filled_out, sock->buffer_read_in);
 		}
 	}
 	else
 		qlog("INVALID CONNECTION HANDLE ERROR: func=%s, desc='%s'\n", func, desc);
 #undef PRN_NULLCHECK
 }
+
diff --git a/src/interfaces/odbc/connection.h b/src/interfaces/odbc/connection.h
index 706420ef56824d39096c07afc86ef794f85eadca..8222d98518039bbe4b73b39e6a532ffff237d870 100644
--- a/src/interfaces/odbc/connection.h
+++ b/src/interfaces/odbc/connection.h
@@ -1,9 +1,9 @@
 
-/* File:			connection.h
+/* File:            connection.h
  *
- * Description:		See "connection.c"
+ * Description:     See "connection.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -27,14 +27,11 @@
 #endif
 
 
-typedef enum
-{
-	CONN_NOT_CONNECTED,		/* Connection has not been established */
-	CONN_CONNECTED,			/* Connection is up and has been
-							 * established */
-	CONN_DOWN,				/* Connection is broken */
-	CONN_EXECUTING			/* the connection is currently executing a
-							 * statement */
+typedef enum {
+    CONN_NOT_CONNECTED,      /* Connection has not been established */
+    CONN_CONNECTED,      /* Connection is up and has been established */
+    CONN_DOWN,            /* Connection is broken */
+    CONN_EXECUTING     /* the connection is currently executing a statement */
 } CONN_Status;
 
 /*	These errors have general sql error state */
@@ -53,7 +50,7 @@ typedef enum
 #define CONN_INIREAD_ERROR 201
 #define CONN_OPENDB_ERROR 202
 #define CONN_STMT_ALLOC_ERROR 203
-#define CONN_IN_USE 204
+#define CONN_IN_USE 204 
 #define CONN_UNSUPPORTED_OPTION 205
 /* Used by SetConnectoption to indicate unsupported options */
 #define CONN_INVALID_ARGUMENT_NO 206
@@ -93,11 +90,11 @@ typedef enum
 #define AUTH_REQ_CRYPT		4
 
 /*	Startup Packet sizes */
-#define SM_DATABASE			64
-#define SM_USER				32
-#define SM_OPTIONS			64
-#define SM_UNUSED			64
-#define SM_TTY				64
+#define SM_DATABASE		64
+#define SM_USER			32
+#define SM_OPTIONS		64
+#define SM_UNUSED		64
+#define SM_TTY			64
 
 /*	Old 6.2 protocol defines */
 #define NO_AUTHENTICATION	7
@@ -109,44 +106,63 @@ typedef unsigned int ProtocolVersion;
 
 #define PG_PROTOCOL(major, minor)	(((major) << 16) | (minor))
 #define PG_PROTOCOL_LATEST		PG_PROTOCOL(2, 0)
+#define PG_PROTOCOL_63			PG_PROTOCOL(1, 0)
+#define PG_PROTOCOL_62			PG_PROTOCOL(0, 0)
 
-/*	This startup packet is to support latest Postgres protocol */
+/*	This startup packet is to support latest Postgres protocol (6.4, 6.3) */
 typedef struct _StartupPacket
 {
-	ProtocolVersion protoVersion;
-	char		database[SM_DATABASE];
-	char		user[SM_USER];
-	char		options[SM_OPTIONS];
-	char		unused[SM_UNUSED];
-	char		tty[SM_TTY];
+	ProtocolVersion	protoVersion;
+	char			database[SM_DATABASE];
+	char			user[SM_USER];
+	char			options[SM_OPTIONS];
+	char			unused[SM_UNUSED];
+	char			tty[SM_TTY];
 } StartupPacket;
 
 
+/*	This startup packet is to support pre-Postgres 6.3 protocol */
+typedef struct _StartupPacket6_2
+{
+	unsigned int	authtype;
+	char			database[PATH_SIZE];
+	char			user[NAMEDATALEN];
+	char			options[ARGV_SIZE];
+	char			execfile[ARGV_SIZE];
+	char			tty[PATH_SIZE];
+} StartupPacket6_2;
+
+
 /*	Structure to hold all the connection attributes for a specific
 	connection (used for both registry and file, DSN and DRIVER)
 */
-typedef struct
-{
-	char		dsn[MEDIUM_REGISTRY_LEN];
-	char		desc[MEDIUM_REGISTRY_LEN];
-	char		driver[MEDIUM_REGISTRY_LEN];
-	char		server[MEDIUM_REGISTRY_LEN];
-	char		database[MEDIUM_REGISTRY_LEN];
-	char		username[MEDIUM_REGISTRY_LEN];
-	char		password[MEDIUM_REGISTRY_LEN];
-	char		conn_settings[LARGE_REGISTRY_LEN];
-	char		protocol[SMALL_REGISTRY_LEN];
-	char		port[SMALL_REGISTRY_LEN];
-	char		onlyread[SMALL_REGISTRY_LEN];
-	char		fake_oid_index[SMALL_REGISTRY_LEN];
-	char		show_oid_column[SMALL_REGISTRY_LEN];
-	char		row_versioning[SMALL_REGISTRY_LEN];
-	char		show_system_tables[SMALL_REGISTRY_LEN];
-	char		translation_dll[MEDIUM_REGISTRY_LEN];
-	char		translation_option[SMALL_REGISTRY_LEN];
-	char		focus_password;
+typedef struct {
+	char	dsn[MEDIUM_REGISTRY_LEN];
+	char	desc[MEDIUM_REGISTRY_LEN];
+	char	driver[MEDIUM_REGISTRY_LEN];
+	char	server[MEDIUM_REGISTRY_LEN];
+	char	database[MEDIUM_REGISTRY_LEN];
+	char	username[MEDIUM_REGISTRY_LEN];
+	char	password[MEDIUM_REGISTRY_LEN];
+	char	conn_settings[LARGE_REGISTRY_LEN];
+	char	protocol[SMALL_REGISTRY_LEN];
+	char	port[SMALL_REGISTRY_LEN];
+	char	onlyread[SMALL_REGISTRY_LEN];	
+	char	fake_oid_index[SMALL_REGISTRY_LEN];
+	char	show_oid_column[SMALL_REGISTRY_LEN];
+	char	row_versioning[SMALL_REGISTRY_LEN];
+	char	show_system_tables[SMALL_REGISTRY_LEN];
+	char    translation_dll[MEDIUM_REGISTRY_LEN];
+	char    translation_option[SMALL_REGISTRY_LEN];
+	char	focus_password;
 } ConnInfo;
 
+/*	Macro to determine is the connection using 6.2 protocol? */
+#define PROTOCOL_62(conninfo_)		(strncmp((conninfo_)->protocol, PG62, strlen(PG62)) == 0)
+
+/*	Macro to determine is the connection using 6.3 protocol? */
+#define PROTOCOL_63(conninfo_)		(strncmp((conninfo_)->protocol, PG63, strlen(PG63)) == 0)
+
 /*
  *	Macros to compare the server's version with a specified version
  *		1st parameter: pointer to a ConnectionClass object
@@ -164,15 +180,15 @@ typedef struct
 #define SERVER_VERSION_LE(conn, major, minor) (! SERVER_VERSION_GT(conn, major, minor))
 #define SERVER_VERSION_LT(conn, major, minor) (! SERVER_VERSION_GE(conn, major, minor))
 /*#if ! defined(HAVE_CONFIG_H) || defined(HAVE_STRINGIZE)*/
-#define STRING_AFTER_DOT(string)	(strchr(#string, '.') + 1)
+#define	STRING_AFTER_DOT(string)	(strchr(#string, '.') + 1)
 /*#else
-#define STRING_AFTER_DOT(str)	(strchr("str", '.') + 1)
+#define	STRING_AFTER_DOT(str)	(strchr("str", '.') + 1)
 #endif*/
 /*
  *	Simplified macros to compare the server's version with a
  *		specified version
  *	Note: Never pass a variable as the second parameter.
- *		  It must be a decimal constant of the form %d.%d .
+ *	      It must be a decimal constant of the form %d.%d . 
  */
 #define PG_VERSION_GT(conn, ver) \
  (SERVER_VERSION_GT(conn, (int) ver, atoi(STRING_AFTER_DOT(ver))))
@@ -184,10 +200,9 @@ typedef struct
 #define PG_VERSION_LT(conn, ver) (! PG_VERSION_GE(conn, ver))
 
 /*	This is used to store cached table information in the connection */
-struct col_info
-{
-	QResultClass *result;
-	char		name[MAX_TABLE_LEN + 1];
+struct col_info {
+	QResultClass	*result;
+	char			name[MAX_TABLE_LEN+1];
 };
 
  /* Translation DLL entry points */
@@ -199,95 +214,89 @@ struct col_info
 #define HINSTANCE void *
 #endif
 
-typedef BOOL (FAR WINAPI * DataSourceToDriverProc) (UDWORD,
-																SWORD,
-																PTR,
-																SDWORD,
-																PTR,
-																SDWORD,
-															SDWORD FAR *,
-															 UCHAR FAR *,
-																SWORD,
-															SWORD FAR *);
-
-typedef BOOL (FAR WINAPI * DriverToDataSourceProc) (UDWORD,
-																SWORD,
-																PTR,
-																SDWORD,
-																PTR,
-																SDWORD,
-															SDWORD FAR *,
-															 UCHAR FAR *,
-																SWORD,
-															SWORD FAR *);
+typedef BOOL (FAR WINAPI *DataSourceToDriverProc) (UDWORD,
+					SWORD,
+					PTR,
+					SDWORD,
+					PTR,
+					SDWORD,
+					SDWORD FAR *,
+					UCHAR FAR *,
+					SWORD,
+					SWORD FAR *);
+
+typedef BOOL (FAR WINAPI *DriverToDataSourceProc) (UDWORD,
+					SWORD,
+					PTR,
+					SDWORD,
+					PTR,
+					SDWORD,
+					SDWORD FAR *,
+					UCHAR FAR *,
+					SWORD,
+					SWORD FAR *);
 
 /*******	The Connection handle	************/
-struct ConnectionClass_
-{
-	HENV		henv;			/* environment this connection was created
-								 * on */
+struct ConnectionClass_ {
+	HENV			henv;					/* environment this connection was created on */
 	StatementOptions stmtOptions;
-	char	   *errormsg;
-	int			errornumber;
-	CONN_Status status;
-	ConnInfo	connInfo;
-	StatementClass **stmts;
-	int			num_stmts;
-	SocketClass *sock;
-	int			lobj_type;
-	int			ntables;
-	COL_INFO  **col_info;
-	long		translation_option;
-	HINSTANCE	translation_handle;
-	DataSourceToDriverProc DataSourceToDriver;
-	DriverToDataSourceProc DriverToDataSource;
-	char		transact_status;/* Is a transaction is currently in
-								 * progress */
-	char		errormsg_created;		/* has an informative error msg
-										 * been created?  */
-	char		pg_version[MAX_INFO_STRING];	/* Version of PostgreSQL
-												 * we're connected to -
-												 * DJP 25-1-2001 */
-	float		pg_version_number;
-	Int2		pg_version_major;
-	Int2		pg_version_minor;
+	char			*errormsg;
+	int				errornumber;
+	CONN_Status		status;
+	ConnInfo		connInfo;
+	StatementClass	**stmts;
+	int				num_stmts;
+	SocketClass		*sock;
+	int				lobj_type;
+	int				ntables;
+	COL_INFO		**col_info;
+	long            translation_option;
+	HINSTANCE       translation_handle;
+	DataSourceToDriverProc  DataSourceToDriver;
+	DriverToDataSourceProc  DriverToDataSource;
+	char			transact_status;		/* Is a transaction is currently in progress */
+	char			errormsg_created;		/* has an informative error msg been created?  */
+	char			pg_version[MAX_INFO_STRING];	/* Version of PostgreSQL we're connected to - DJP 25-1-2001 */
+	float			pg_version_number;
+	Int2			pg_version_major;
+	Int2			pg_version_minor;
 };
 
 
 /* Accessor functions */
-#define CC_get_socket(x)		(x->sock)
-#define CC_get_database(x)		(x->connInfo.database)
-#define CC_get_server(x)		(x->connInfo.server)
-#define CC_get_DSN(x)			(x->connInfo.dsn)
-#define CC_get_username(x)		(x->connInfo.username)
-#define CC_is_onlyread(x)		(x->connInfo.onlyread[0] == '1')
+#define CC_get_socket(x)	(x->sock)
+#define CC_get_database(x)	(x->connInfo.database)
+#define CC_get_server(x)	(x->connInfo.server)
+#define CC_get_DSN(x)		(x->connInfo.dsn)
+#define CC_get_username(x)	(x->connInfo.username)
+#define CC_is_onlyread(x)	(x->connInfo.onlyread[0] == '1')
 
 
-/*	for CC_DSN_info */
+/*  for CC_DSN_info */
 #define CONN_DONT_OVERWRITE		0
-#define CONN_OVERWRITE			1
+#define CONN_OVERWRITE			1 
 
 
 /*	prototypes */
 ConnectionClass *CC_Constructor(void);
-char		CC_Destructor(ConnectionClass *self);
-int			CC_cursor_count(ConnectionClass *self);
-char		CC_cleanup(ConnectionClass *self);
-char		CC_abort(ConnectionClass *self);
-int			CC_set_translation(ConnectionClass *self);
-char		CC_connect(ConnectionClass *self, char do_password);
-char		CC_add_statement(ConnectionClass *self, StatementClass *stmt);
-char		CC_remove_statement(ConnectionClass *self, StatementClass *stmt);
-char		CC_get_error(ConnectionClass *self, int *number, char **message);
+char CC_Destructor(ConnectionClass *self);
+int CC_cursor_count(ConnectionClass *self);
+char CC_cleanup(ConnectionClass *self);
+char CC_abort(ConnectionClass *self);
+int CC_set_translation (ConnectionClass *self);
+char CC_connect(ConnectionClass *self, char do_password);
+char CC_add_statement(ConnectionClass *self, StatementClass *stmt);
+char CC_remove_statement(ConnectionClass *self, StatementClass *stmt);
+char CC_get_error(ConnectionClass *self, int *number, char **message);
 QResultClass *CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi);
-void		CC_clear_error(ConnectionClass *self);
-char	   *CC_create_errormsg(ConnectionClass *self);
-int			CC_send_function(ConnectionClass *conn, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *argv, int nargs);
-char		CC_send_settings(ConnectionClass *self);
-void		CC_lookup_lo(ConnectionClass *conn);
-void		CC_lookup_pg_version(ConnectionClass *conn);
-void		CC_initialize_pg_version(ConnectionClass *conn);
-void		CC_log_error(char *func, char *desc, ConnectionClass *self);
+void CC_clear_error(ConnectionClass *self);
+char *CC_create_errormsg(ConnectionClass *self);
+int CC_send_function(ConnectionClass *conn, int fnid, void *result_buf, int *actual_result_len, int result_is_int, LO_ARG *argv, int nargs);
+char CC_send_settings(ConnectionClass *self);
+void CC_lookup_lo(ConnectionClass *conn);
+void CC_lookup_pg_version(ConnectionClass *conn);
+void CC_initialize_pg_version(ConnectionClass *conn);
+void CC_log_error(char *func, char *desc, ConnectionClass *self);
 
 
 #endif
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c
index 532f58a7c57e9fa745078c299ea6a649b060728e..95ac701247b41e7b5896cfd8d87f9f6ec9d31391 100644
--- a/src/interfaces/odbc/convert.c
+++ b/src/interfaces/odbc/convert.c
@@ -1,17 +1,18 @@
-/* Module:		   convert.c
+
+/* Module:         convert.c
  *
- * Description:    This module contains routines related to
- *				   converting parameters and columns into requested data types.
- *				   Parameters are converted from their SQL_C data types into
- *				   the appropriate postgres type.  Columns are converted from
- *				   their postgres type (SQL type) into the appropriate SQL_C
- *				   data type.
+ * Description:	   This module contains routines related to 
+ *                 converting parameters and columns into requested data types.
+ *                 Parameters are converted from their SQL_C data types into
+ *                 the appropriate postgres type.  Columns are converted from
+ *                 their postgres type (SQL type) into the appropriate SQL_C 
+ *                 data type.
  *
- * Classes:		   n/a
+ * Classes:        n/a
  *
  * API functions:  none
  *
- * Comments:	   See "notice.txt" for copyright and license information.
+ * Comments:       See "notice.txt" for copyright and license information.
  *
  */
 
@@ -52,7 +53,6 @@
 #endif
 #ifndef SCHAR
 typedef signed char SCHAR;
-
 #endif
 #endif
 
@@ -64,76 +64,76 @@ extern GLOBAL_VALUES globals;
  *	 http://www.merant.com/datadirect/download/docs/odbc16/Odbcref/rappc.htm
  * - thomas 2000-04-03
  */
-char	   *mapFuncs[][2] = {
-/*	{ "ASCII",		 "ascii"	  }, */
-	{"CHAR", "ichar"},
-	{"CONCAT", "textcat"},
+char *mapFuncs[][2] = {
+/*	{ "ASCII",       "ascii"      }, */
+	{ "CHAR",        "ichar"      },
+	{ "CONCAT",      "textcat"    },
 /*	{ "DIFFERENCE",  "difference" }, */
-/*	{ "INSERT",		 "insert"	  }, */
-	{"LCASE", "lower"},
-	{"LEFT", "ltrunc"},
-	{"LOCATE", "strpos"},
-	{"LENGTH", "char_length"},
-/*	{ "LTRIM",		 "ltrim"	  }, */
-	{"RIGHT", "rtrunc"},
-/*	{ "REPEAT",		 "repeat"	  }, */
-/*	{ "REPLACE",	 "replace"	  }, */
-/*	{ "RTRIM",		 "rtrim"	  }, */
-/*	{ "SOUNDEX",	 "soundex"	  }, */
-	{"SUBSTRING", "substr"},
-	{"UCASE", "upper"},
-
-/*	{ "ABS",		 "abs"		  }, */
-/*	{ "ACOS",		 "acos"		  }, */
-/*	{ "ASIN",		 "asin"		  }, */
-/*	{ "ATAN",		 "atan"		  }, */
-/*	{ "ATAN2",		 "atan2"	  }, */
-	{"CEILING", "ceil"},
-/*	{ "COS",		 "cos"		  }, */
-/*	{ "COT",		 "cot"		  }, */
-/*	{ "DEGREES",	 "degrees"	  }, */
-/*	{ "EXP",		 "exp"		  }, */
-/*	{ "FLOOR",		 "floor"	  }, */
-	{"LOG", "ln"},
-	{"LOG10", "log"},
-/*	{ "MOD",		 "mod"		  }, */
-/*	{ "PI",			 "pi"		  }, */
-	{"POWER", "pow"},
-/*	{ "RADIANS",	 "radians"	  }, */
-	{"RAND", "random"},
-/*	{ "ROUND",		 "round"	  }, */
-/*	{ "SIGN",		 "sign"		  }, */
-/*	{ "SIN",		 "sin"		  }, */
-/*	{ "SQRT",		 "sqrt"		  }, */
-/*	{ "TAN",		 "tan"		  }, */
-	{"TRUNCATE", "trunc"},
-
-/*	{ "CURDATE",	 "curdate"	  }, */
-/*	{ "CURTIME",	 "curtime"	  }, */
-/*	{ "DAYNAME",	 "dayname"	  }, */
+/*	{ "INSERT",      "insert"     }, */
+	{ "LCASE",       "lower"      },
+	{ "LEFT",        "ltrunc"     },
+	{ "LOCATE",      "strpos"     },
+	{ "LENGTH",      "char_length"},
+/*	{ "LTRIM",       "ltrim"      }, */
+	{ "RIGHT",       "rtrunc"     },
+/*	{ "REPEAT",      "repeat"     }, */
+/*	{ "REPLACE",     "replace"    }, */
+/*	{ "RTRIM",       "rtrim"      }, */
+/*	{ "SOUNDEX",     "soundex"    }, */
+	{ "SUBSTRING",   "substr"     },
+	{ "UCASE",       "upper"      },
+
+/*	{ "ABS",         "abs"        }, */
+/*	{ "ACOS",        "acos"       }, */
+/*	{ "ASIN",        "asin"       }, */
+/*	{ "ATAN",        "atan"       }, */
+/*	{ "ATAN2",       "atan2"      }, */
+	{ "CEILING",     "ceil"       },
+/*	{ "COS",         "cos"        }, */
+/*	{ "COT",         "cot"        }, */
+/*	{ "DEGREES",     "degrees"    }, */
+/*	{ "EXP",         "exp"        }, */
+/*	{ "FLOOR",       "floor"      }, */
+	{ "LOG",         "ln"         },
+	{ "LOG10",       "log"        },
+/*	{ "MOD",         "mod"        }, */
+/*	{ "PI",          "pi"         }, */
+	{ "POWER",       "pow"        },
+/*	{ "RADIANS",     "radians"    }, */
+	{ "RAND",        "random"     },
+/*	{ "ROUND",       "round"      }, */
+/*	{ "SIGN",        "sign"       }, */
+/*	{ "SIN",         "sin"        }, */
+/*	{ "SQRT",        "sqrt"       }, */
+/*	{ "TAN",         "tan"        }, */
+	{ "TRUNCATE",    "trunc"      },
+
+/*	{ "CURDATE",     "curdate"    }, */
+/*	{ "CURTIME",     "curtime"    }, */
+/*	{ "DAYNAME",     "dayname"    }, */
 /*	{ "DAYOFMONTH",  "dayofmonth" }, */
-/*	{ "DAYOFWEEK",	 "dayofweek"  }, */
-/*	{ "DAYOFYEAR",	 "dayofyear"  }, */
-/*	{ "HOUR",		 "hour"		  }, */
-/*	{ "MINUTE",		 "minute"	  }, */
-/*	{ "MONTH",		 "month"	  }, */
-/*	{ "MONTHNAME",	 "monthname"  }, */
-/*	{ "NOW",		 "now"		  }, */
-/*	{ "QUARTER",	 "quarter"	  }, */
-/*	{ "SECOND",		 "second"	  }, */
-/*	{ "WEEK",		 "week"		  }, */
-/*	{ "YEAR",		 "year"		  }, */
-
-/*	{ "DATABASE",	 "database"   }, */
-	{"IFNULL", "coalesce"},
-	{"USER", "odbc_user"},
-	{0, 0}
+/*	{ "DAYOFWEEK",   "dayofweek"  }, */
+/*	{ "DAYOFYEAR",   "dayofyear"  }, */
+/*	{ "HOUR",        "hour"       }, */
+/*	{ "MINUTE",      "minute"     }, */
+/*	{ "MONTH",       "month"      }, */
+/*	{ "MONTHNAME",   "monthname"  }, */
+/*	{ "NOW",         "now"        }, */
+/*	{ "QUARTER",     "quarter"    }, */
+/*	{ "SECOND",      "second"     }, */
+/*	{ "WEEK",        "week"       }, */
+/*	{ "YEAR",        "year"       }, */
+
+/*	{ "DATABASE",    "database"   }, */
+	{ "IFNULL",      "coalesce"   },
+	{ "USER",        "odbc_user"  },
+	{    0,             0         }
 };
 
-char	   *mapFunction(char *func);
+char *mapFunction(char *func);
 unsigned int conv_from_octal(unsigned char *s);
 unsigned int conv_from_hex(unsigned char *s);
-char	   *conv_to_octal(unsigned char val);
+char *conv_to_octal(unsigned char val);
 
 /********		A Guide for date/time/timestamp conversions    **************
 
@@ -145,10 +145,10 @@ char	   *conv_to_octal(unsigned char val);
 			PG_TYPE_TIME	SQL_C_DEFAULT		SQL_C_TIME
 			PG_TYPE_TIME	SQL_C_TIME			SQL_C_TIME
 			PG_TYPE_TIME	SQL_C_TIMESTAMP		SQL_C_TIMESTAMP		(date = current date)
-			PG_TYPE_ABSTIME SQL_C_DEFAULT		SQL_C_TIMESTAMP
-			PG_TYPE_ABSTIME SQL_C_DATE			SQL_C_DATE			(time is truncated)
-			PG_TYPE_ABSTIME SQL_C_TIME			SQL_C_TIME			(date is truncated)
-			PG_TYPE_ABSTIME SQL_C_TIMESTAMP		SQL_C_TIMESTAMP
+			PG_TYPE_ABSTIME	SQL_C_DEFAULT		SQL_C_TIMESTAMP
+			PG_TYPE_ABSTIME	SQL_C_DATE			SQL_C_DATE			(time is truncated)
+			PG_TYPE_ABSTIME	SQL_C_TIME			SQL_C_TIME			(date is truncated)
+			PG_TYPE_ABSTIME	SQL_C_TIMESTAMP		SQL_C_TIMESTAMP		
 ******************************************************************************/
 
 
@@ -156,71 +156,69 @@ char	   *conv_to_octal(unsigned char val);
 int
 copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col)
 {
-	BindInfoClass *bic = &(stmt->bindings[col]);
+BindInfoClass *bic = &(stmt->bindings[col]);
 
-	return copy_and_convert_field(stmt, field_type, value, (Int2) bic->returntype, (PTR) bic->buffer,
-							 (SDWORD) bic->buflen, (SDWORD *) bic->used);
+	return copy_and_convert_field(stmt, field_type, value, (Int2)bic->returntype, (PTR)bic->buffer,
+                                (SDWORD)bic->buflen, (SDWORD *)bic->used);
 }
 
 /*	This is called by SQLGetData() */
 int
-copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType,
+copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, 
 					   PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue)
 {
-	Int4		len = 0,
-				copy_len = 0;
+	Int4 len = 0, copy_len = 0;
 	SIMPLE_TIME st;
-	time_t		t = time(NULL);
-	struct tm  *tim;
-	int			pcbValueOffset,
-				rgbValueOffset;
-	char	   *rgbValueBindRow,
-			   *ptr;
-	int			bind_row = stmt->bind_row;
-	int			bind_size = stmt->options.bind_size;
-	int			result = COPY_OK;
-	char		tempBuf[TEXT_FIELD_SIZE + 5];
+	time_t t = time(NULL);
+	struct tm *tim;
+	int pcbValueOffset, rgbValueOffset;
+	char *rgbValueBindRow, *ptr;
+	int bind_row = stmt->bind_row;
+	int bind_size = stmt->options.bind_size;
+	int result = COPY_OK;
+	char tempBuf[TEXT_FIELD_SIZE+5];
 
 /*	rgbValueOffset is *ONLY* for character and binary data */
 /*	pcbValueOffset is for computing any pcbValue location */
 
-	if (bind_size > 0)
+	if (bind_size > 0) {
+
 		pcbValueOffset = rgbValueOffset = (bind_size * bind_row);
-	else
-	{
+	}
+	else {
+
 		pcbValueOffset = bind_row * sizeof(SDWORD);
 		rgbValueOffset = bind_row * cbValueMax;
+
 	}
 
 	memset(&st, 0, sizeof(SIMPLE_TIME));
 
-	/* Initialize current date */
+	/*	Initialize current date */
 	tim = localtime(&t);
 	st.m = tim->tm_mon + 1;
 	st.d = tim->tm_mday;
 	st.y = tim->tm_year + 1900;
 
-	mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType, (value == NULL) ? "<NULL>" : value, cbValueMax);
+	mylog("copy_and_convert: field_type = %d, fctype = %d, value = '%s', cbValueMax=%d\n", field_type, fCType,  (value==NULL)?"<NULL>":value, cbValueMax);
 
-	if (!value)
-	{
-		/* handle a null just by returning SQL_NULL_DATA in pcbValue, */
-		/* and doing nothing to the buffer.							  */
-		if (pcbValue)
+	if ( ! value) {
+        /* handle a null just by returning SQL_NULL_DATA in pcbValue, */
+        /* and doing nothing to the buffer.                           */
+        if(pcbValue) {
 			*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = SQL_NULL_DATA;
+        }
 		return COPY_OK;
 	}
 
 
-	if (stmt->hdbc->DataSourceToDriver != NULL)
-	{
-		int			length = strlen(value);
-
-		stmt->hdbc->DataSourceToDriver(stmt->hdbc->translation_option,
-									   SQL_CHAR,
-									   value, length,
-									   value, length, NULL,
-									   NULL, 0, NULL);
+	if (stmt->hdbc->DataSourceToDriver != NULL) {
+		int length = strlen (value);
+		stmt->hdbc->DataSourceToDriver (stmt->hdbc->translation_option,
+										SQL_CHAR,
+										value, length,
+										value, length, NULL,
+										NULL, 0, NULL);
 	}
 
 
@@ -228,125 +226,108 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
 		First convert any specific postgres types into more
 		useable data.
 
-		NOTE: Conversions from PG char/varchar of a date/time/timestamp
-		value to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
+		NOTE: Conversions from PG char/varchar of a date/time/timestamp 
+		value to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported 
 	*********************************************************************/
-	switch (field_type)
-	{
-
-			/*
-			 * $$$ need to add parsing for date/time/timestamp strings in
-			 * PG_TYPE_CHAR,VARCHAR $$$
-			 */
-		case PG_TYPE_DATE:
-			sscanf(value, "%4d-%2d-%2d", &st.y, &st.m, &st.d);
-			break;
-
-		case PG_TYPE_TIME:
-			sscanf(value, "%2d:%2d:%2d", &st.hh, &st.mm, &st.ss);
-			break;
-
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			if (strnicmp(value, "invalid", 7) != 0)
-				sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
-			else
-			{					/* The timestamp is invalid so set
-								 * something conspicuous, like the epoch */
-				t = 0;
-				tim = localtime(&t);
-				st.m = tim->tm_mon + 1;
-				st.d = tim->tm_mday;
-				st.y = tim->tm_year + 1900;
-				st.hh = tim->tm_hour;
-				st.mm = tim->tm_min;
-				st.ss = tim->tm_sec;
-			}
-			break;
-
-		case PG_TYPE_BOOL:
-			{					/* change T/F to 1/0 */
-				char	   *s = (char *) value;
+	switch(field_type) {
+	/*  $$$ need to add parsing for date/time/timestamp strings in PG_TYPE_CHAR,VARCHAR $$$ */
+	case PG_TYPE_DATE:
+		sscanf(value, "%4d-%2d-%2d", &st.y, &st.m, &st.d);
+		break;
+
+	case PG_TYPE_TIME:
+		sscanf(value, "%2d:%2d:%2d", &st.hh, &st.mm, &st.ss);
+		break;
+
+	case PG_TYPE_ABSTIME:
+	case PG_TYPE_DATETIME:
+	case PG_TYPE_TIMESTAMP:
+		if (strnicmp(value, "invalid", 7) != 0) {
+			sscanf(value, "%4d-%2d-%2d %2d:%2d:%2d", &st.y, &st.m, &st.d, &st.hh, &st.mm, &st.ss);
+
+		} else {	/* The timestamp is invalid so set something conspicuous, like the epoch */
+			t = 0;
+			tim = localtime(&t);
+			st.m = tim->tm_mon + 1;
+			st.d = tim->tm_mday;
+			st.y = tim->tm_year + 1900;
+			st.hh = tim->tm_hour;
+			st.mm = tim->tm_min;
+			st.ss = tim->tm_sec;
+		}
+		break;
+
+	case PG_TYPE_BOOL: {		/* change T/F to 1/0 */
+		char *s = (char *) value;
+		if (s[0] == 'T' || s[0] == 't') 
+			s[0] = '1';
+		else 
+			s[0] = '0';
+		}
+		break;
+
+	/* This is for internal use by SQLStatistics() */
+	case PG_TYPE_INT2VECTOR: {
+		int nval, i;
+		char *vp;
+		/* this is an array of eight integers */
+		short *short_array = (short *) ( (char *) rgbValue + rgbValueOffset);
+
+		len = 16;
+		vp = value;
+		nval = 0;
+		for (i = 0; i < 8; i++)
+		{
+			if (sscanf(vp, "%hd", &short_array[i]) != 1)
+				break;
 
-				if (s[0] == 'T' || s[0] == 't')
-					s[0] = '1';
-				else
-					s[0] = '0';
-			}
-			break;
+			nval++;
 
-			/* This is for internal use by SQLStatistics() */
-		case PG_TYPE_INT2VECTOR:
-			{
-				int			nval,
-							i;
-				char	   *vp;
-
-				/* this is an array of eight integers */
-				short	   *short_array = (short *) ((char *) rgbValue + rgbValueOffset);
-
-				len = 16;
-				vp = value;
-				nval = 0;
-				for (i = 0; i < 8; i++)
-				{
-					if (sscanf(vp, "%hd", &short_array[i]) != 1)
-						break;
-
-					nval++;
-
-					/* skip the current token */
-					while ((*vp != '\0') && (!isspace((unsigned char) *vp)))
-						vp++;
-					/* and skip the space to the next token */
-					while ((*vp != '\0') && (isspace((unsigned char) *vp)))
-						vp++;
-					if (*vp == '\0')
-						break;
-				}
+			/* skip the current token */
+			while ((*vp != '\0') && (! isspace((unsigned char) *vp))) vp++;
+			/* and skip the space to the next token */
+			while ((*vp != '\0') && (isspace((unsigned char) *vp))) vp++;
+			if (*vp == '\0')
+				break;
+		}
 
-				for (i = nval; i < 8; i++)
-					short_array[i] = 0;
+		for (i = nval; i < 8; i++)
+		{
+			short_array[i] = 0;
+		}
 
 #if 0
-				sscanf(value, "%hd %hd %hd %hd %hd %hd %hd %hd",
-					   &short_array[0],
-					   &short_array[1],
-					   &short_array[2],
-					   &short_array[3],
-					   &short_array[4],
-					   &short_array[5],
-					   &short_array[6],
-					   &short_array[7]);
+		sscanf(value, "%hd %hd %hd %hd %hd %hd %hd %hd",
+			&short_array[0],
+			&short_array[1],
+			&short_array[2],
+			&short_array[3],
+			&short_array[4],
+			&short_array[5],
+			&short_array[6],
+			&short_array[7]);
 #endif
 
-				/* There is no corresponding fCType for this. */
-				if (pcbValue)
-					*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
+		/*  There is no corresponding fCType for this. */
+		if(pcbValue)
+			*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
 
-				return COPY_OK; /* dont go any further or the data will be
-								 * trashed */
-			}
+		return COPY_OK;		/* dont go any further or the data will be trashed */
+	}
 
-			/*
-			 * This is a large object OID, which is used to store
-			 * LONGVARBINARY objects.
-			 */
-		case PG_TYPE_LO:
+	/* This is a large object OID, which is used to store LONGVARBINARY objects. */
+	case PG_TYPE_LO:
 
-			return convert_lo(stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
+		return convert_lo( stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
 
-		default:
+	default:
 
-			if (field_type == stmt->hdbc->lobj_type)	/* hack until permanent
-														 * type available */
-				return convert_lo(stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
+		if (field_type == stmt->hdbc->lobj_type)	/* hack until permanent type available */
+			return convert_lo( stmt, value, fCType, ((char *) rgbValue + rgbValueOffset), cbValueMax, (SDWORD *) ((char *) pcbValue + pcbValueOffset));
 	}
 
-	/* Change default into something useable */
-	if (fCType == SQL_C_DEFAULT)
-	{
+	/*  Change default into something useable */
+	if (fCType == SQL_C_DEFAULT) {
 		fCType = pgtype_to_ctype(stmt, field_type);
 
 		mylog("copy_and_convert, SQL_C_DEFAULT: fCType = %d\n", fCType);
@@ -355,315 +336,300 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
 
 	rgbValueBindRow = (char *) rgbValue + rgbValueOffset;
 
-	if (fCType == SQL_C_CHAR)
-	{
-		/* Special character formatting as required */
+    if(fCType == SQL_C_CHAR) {
 
-		/*
-		 * These really should return error if cbValueMax is not big
-		 * enough.
-		 */
-		switch (field_type)
-		{
-			case PG_TYPE_DATE:
-				len = 10;
-				if (cbValueMax > len)
-					sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d", st.y, st.m, st.d);
-				break;
 
-			case PG_TYPE_TIME:
-				len = 8;
-				if (cbValueMax > len)
-					sprintf(rgbValueBindRow, "%.2d:%.2d:%.2d", st.hh, st.mm, st.ss);
-				break;
+		/*	Special character formatting as required */
+		/*	These really should return error if cbValueMax is not big enough. */
+		switch(field_type) {
+		case PG_TYPE_DATE:
+		    len = 10;
+			if (cbValueMax > len)
+				sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d", st.y, st.m, st.d);
+			break;
 
-			case PG_TYPE_ABSTIME:
-			case PG_TYPE_DATETIME:
-			case PG_TYPE_TIMESTAMP:
-				len = 19;
-				if (cbValueMax > len)
-					sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
-							st.y, st.m, st.d, st.hh, st.mm, st.ss);
-				break;
+		case PG_TYPE_TIME:
+			len = 8;
+			if (cbValueMax > len)
+				sprintf(rgbValueBindRow, "%.2d:%.2d:%.2d", st.hh, st.mm, st.ss);
+			break;
 
-			case PG_TYPE_BOOL:
-				len = 1;
-				if (cbValueMax > len)
-				{
-					strcpy(rgbValueBindRow, value);
-					mylog("PG_TYPE_BOOL: rgbValueBindRow = '%s'\n", rgbValueBindRow);
-				}
-				break;
+		case PG_TYPE_ABSTIME:
+		case PG_TYPE_DATETIME:
+		case PG_TYPE_TIMESTAMP:
+			len = 19;
+			if (cbValueMax > len)
+				sprintf(rgbValueBindRow, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d", 
+					st.y, st.m, st.d, st.hh, st.mm, st.ss);
+			break;
 
-				/*
-				 * Currently, data is SILENTLY TRUNCATED for BYTEA and
-				 * character data types if there is not enough room in
-				 * cbValueMax because the driver can't handle multiple
-				 * calls to SQLGetData for these, yet.	Most likely, the
-				 * buffer passed in will be big enough to handle the
-				 * maximum limit of postgres, anyway.
-				 *
-				 * LongVarBinary types are handled correctly above, observing
-				 * truncation and all that stuff since there is
-				 * essentially no limit on the large object used to store
-				 * those.
-				 */
-			case PG_TYPE_BYTEA:/* convert binary data to hex strings
-								 * (i.e, 255 = "FF") */
-				len = convert_pgbinary_to_char(value, rgbValueBindRow, cbValueMax);
-
-				/***** THIS IS NOT PROPERLY IMPLEMENTED *****/
-				break;
+		case PG_TYPE_BOOL:
+			len = 1;
+			if (cbValueMax > len) {
+				strcpy(rgbValueBindRow, value);
+				mylog("PG_TYPE_BOOL: rgbValueBindRow = '%s'\n", rgbValueBindRow);
+			}
+			break;
 
-			default:
-				/* convert linefeeds to carriage-return/linefeed */
-				len = convert_linefeeds(value, tempBuf, sizeof(tempBuf));
-				ptr = tempBuf;
-
-				mylog("DEFAULT: len = %d, ptr = '%s'\n", len, ptr);
-
-				if (stmt->current_col >= 0)
-				{
-					if (stmt->bindings[stmt->current_col].data_left == 0)
-						return COPY_NO_DATA_FOUND;
-					else if (stmt->bindings[stmt->current_col].data_left > 0)
-					{
-						ptr += len - stmt->bindings[stmt->current_col].data_left;
-						len = stmt->bindings[stmt->current_col].data_left;
-					}
-					else
-						stmt->bindings[stmt->current_col].data_left = strlen(ptr);
+		/*	Currently, data is SILENTLY TRUNCATED for BYTEA and character data
+			types if there is not enough room in cbValueMax because the driver 
+			can't handle multiple calls to SQLGetData for these, yet.  Most likely,
+			the buffer passed in will be big enough to handle the maximum limit of 
+			postgres, anyway.
+
+			LongVarBinary types are handled correctly above, observing truncation
+			and all that stuff since there is essentially no limit on the large
+			object used to store those.
+		*/
+		case PG_TYPE_BYTEA:		/* convert binary data to hex strings (i.e, 255 = "FF") */
+			len = convert_pgbinary_to_char(value, rgbValueBindRow, cbValueMax);
+
+			/***** THIS IS NOT PROPERLY IMPLEMENTED *****/
+			break;
+
+		default:
+			/*	convert linefeeds to carriage-return/linefeed */
+			len = convert_linefeeds(value, tempBuf, sizeof(tempBuf));
+			ptr = tempBuf;
+
+			mylog("DEFAULT: len = %d, ptr = '%s'\n", len, ptr);
+
+			if (stmt->current_col >= 0) {
+				if (stmt->bindings[stmt->current_col].data_left == 0)
+					return COPY_NO_DATA_FOUND;
+				else if (stmt->bindings[stmt->current_col].data_left > 0) {
+					ptr += len - stmt->bindings[stmt->current_col].data_left;
+					len = stmt->bindings[stmt->current_col].data_left;
 				}
+				else
+					stmt->bindings[stmt->current_col].data_left = strlen(ptr);
+			}
 
-				if (cbValueMax > 0)
-				{
-					copy_len = (len >= cbValueMax) ? cbValueMax - 1 : len;
+			if (cbValueMax > 0) {
+				
+				copy_len = (len >= cbValueMax) ? cbValueMax -1 : len;
 
-					/* Copy the data */
-					strncpy_null(rgbValueBindRow, ptr, copy_len + 1);
+				/*	Copy the data */
+				strncpy_null(rgbValueBindRow, ptr, copy_len + 1);
 
-					/* Adjust data_left for next time */
-					if (stmt->current_col >= 0)
-						stmt->bindings[stmt->current_col].data_left -= copy_len;
+				/*	Adjust data_left for next time */
+				if (stmt->current_col >= 0) {
+					stmt->bindings[stmt->current_col].data_left -= copy_len;
 				}
+			}
 
-				/*
-				 * Finally, check for truncation so that proper status can
-				 * be returned
-				 */
-				if (len >= cbValueMax)
-					result = COPY_RESULT_TRUNCATED;
+			/*	Finally, check for truncation so that proper status can be returned */
+			if ( len >= cbValueMax)
+				result = COPY_RESULT_TRUNCATED;
 
 
-				mylog("    SQL_C_CHAR, default: len = %d, cbValueMax = %d, rgbValueBindRow = '%s'\n", len, cbValueMax, rgbValueBindRow);
-				break;
+			mylog("    SQL_C_CHAR, default: len = %d, cbValueMax = %d, rgbValueBindRow = '%s'\n", len, cbValueMax, rgbValueBindRow);
+			break;
 		}
 
 
-	}
-	else
-	{
+    } else {
 
-		/*
-		 * for SQL_C_CHAR, it's probably ok to leave currency symbols in.
-		 * But to convert to numeric types, it is necessary to get rid of
-		 * those.
-		 */
+		/*	for SQL_C_CHAR, it's probably ok to leave currency symbols in.  But
+			to convert to numeric types, it is necessary to get rid of those.
+		*/
 		if (field_type == PG_TYPE_MONEY)
 			convert_money(value);
 
-		switch (fCType)
-		{
-			case SQL_C_DATE:
-				len = 6;
-				{
-					DATE_STRUCT *ds;
-
-					if (bind_size > 0)
-						ds = (DATE_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
-					else
-						ds = (DATE_STRUCT *) rgbValue + bind_row;
-					ds->year = st.y;
-					ds->month = st.m;
-					ds->day = st.d;
-				}
-				break;
-
-			case SQL_C_TIME:
-				len = 6;
-				{
-					TIME_STRUCT *ts;
-
-					if (bind_size > 0)
-						ts = (TIME_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
-					else
-						ts = (TIME_STRUCT *) rgbValue + bind_row;
-					ts->hour = st.hh;
-					ts->minute = st.mm;
-					ts->second = st.ss;
-				}
-				break;
+		switch(fCType) {
+		case SQL_C_DATE:
+			len = 6;
+			{
+			DATE_STRUCT *ds;
+			
+			if (bind_size > 0) {
+				ds = (DATE_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
+			} else {
+				ds = (DATE_STRUCT *) rgbValue + bind_row;
+			}
+			ds->year = st.y;
+			ds->month = st.m;
+			ds->day = st.d;
+			}
+			break;
 
-			case SQL_C_TIMESTAMP:
-				len = 16;
-				{
-					TIMESTAMP_STRUCT *ts;
-
-					if (bind_size > 0)
-						ts = (TIMESTAMP_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
-					else
-						ts = (TIMESTAMP_STRUCT *) rgbValue + bind_row;
-					ts->year = st.y;
-					ts->month = st.m;
-					ts->day = st.d;
-					ts->hour = st.hh;
-					ts->minute = st.mm;
-					ts->second = st.ss;
-					ts->fraction = 0;
-				}
-				break;
+		case SQL_C_TIME:
+			len = 6;
+			{
+			TIME_STRUCT *ts;
+			
+			if (bind_size > 0) {
+				ts = (TIME_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
+			} else {
+				ts = (TIME_STRUCT *) rgbValue + bind_row;
+			}
+			ts->hour = st.hh;
+			ts->minute = st.mm;
+			ts->second = st.ss;
+			}
+			break;
 
-			case SQL_C_BIT:
-				len = 1;
-				if (bind_size > 0)
-					*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-				else
-					*((UCHAR *) rgbValue + bind_row) = atoi(value);
+		case SQL_C_TIMESTAMP:					
+			len = 16;
+			{
+			TIMESTAMP_STRUCT *ts;
+			if (bind_size > 0) {
+				ts = (TIMESTAMP_STRUCT *) ((char *) rgbValue + (bind_row * bind_size));
+			} else {
+				ts = (TIMESTAMP_STRUCT *) rgbValue + bind_row;
+			}
+			ts->year = st.y;
+			ts->month = st.m;
+			ts->day = st.d;
+			ts->hour = st.hh;
+			ts->minute = st.mm;
+			ts->second = st.ss;
+			ts->fraction = 0;
+			}
+			break;
 
-				/*
-				 * mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n",
-				 * atoi(value), cbValueMax, *((UCHAR *)rgbValue));
-				 */
-				break;
+		case SQL_C_BIT:
+			len = 1;
+			if (bind_size > 0) {
+				*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+			} else {
+				*((UCHAR *)rgbValue + bind_row) = atoi(value);
+			}
+			/* mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n", atoi(value), cbValueMax, *((UCHAR *)rgbValue)); */
+			break;
 
-			case SQL_C_STINYINT:
-			case SQL_C_TINYINT:
-				len = 1;
-				if (bind_size > 0)
-					*(SCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-				else
-					*((SCHAR *) rgbValue + bind_row) = atoi(value);
-				break;
+		case SQL_C_STINYINT:
+		case SQL_C_TINYINT:
+			len = 1;
+			if (bind_size > 0) {
+				*(SCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+			} else {
+				*((SCHAR *) rgbValue + bind_row) = atoi(value);
+			}
+			break;
 
-			case SQL_C_UTINYINT:
-				len = 1;
-				if (bind_size > 0)
-					*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-				else
-					*((UCHAR *) rgbValue + bind_row) = atoi(value);
-				break;
+		case SQL_C_UTINYINT:
+			len = 1;
+			if (bind_size > 0) {
+				*(UCHAR *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+			} else {
+				*((UCHAR *) rgbValue + bind_row) = atoi(value);
+			}
+			break;
 
-			case SQL_C_FLOAT:
-				len = 4;
-				if (bind_size > 0)
-					*(SFLOAT *) ((char *) rgbValue + (bind_row * bind_size)) = (float) atof(value);
-				else
-					*((SFLOAT *) rgbValue + bind_row) = (float) atof(value);
-				break;
+		case SQL_C_FLOAT:
+			len = 4;
+			if (bind_size > 0) {
+				*(SFLOAT *) ((char *) rgbValue + (bind_row * bind_size)) = (float) atof(value);
+			} else {
+				*((SFLOAT *)rgbValue + bind_row) = (float) atof(value);
+			}
+			break;
 
-			case SQL_C_DOUBLE:
-				len = 8;
-				if (bind_size > 0)
-					*(SDOUBLE *) ((char *) rgbValue + (bind_row * bind_size)) = atof(value);
-				else
-					*((SDOUBLE *) rgbValue + bind_row) = atof(value);
-				break;
+		case SQL_C_DOUBLE:
+			len = 8;
+			if (bind_size > 0) {
+				*(SDOUBLE *) ((char *) rgbValue + (bind_row * bind_size)) = atof(value);
+			} else {
+				*((SDOUBLE *)rgbValue + bind_row) = atof(value);
+			}
+			break;
 
-			case SQL_C_SSHORT:
-			case SQL_C_SHORT:
-				len = 2;
-				if (bind_size > 0)
-					*(SWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-				else
-					*((SWORD *) rgbValue + bind_row) = atoi(value);
-				break;
+		case SQL_C_SSHORT:
+		case SQL_C_SHORT:
+			len = 2;
+			if (bind_size > 0) {
+				*(SWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+			} else {
+				*((SWORD *)rgbValue + bind_row) = atoi(value);
+			}
+			break;
 
-			case SQL_C_USHORT:
-				len = 2;
-				if (bind_size > 0)
-					*(UWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
-				else
-					*((UWORD *) rgbValue + bind_row) = atoi(value);
-				break;
+		case SQL_C_USHORT:
+			len = 2;
+			if (bind_size > 0) {
+				*(UWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atoi(value);
+			} else {
+				*((UWORD *)rgbValue + bind_row) = atoi(value);
+			}
+			break;
 
-			case SQL_C_SLONG:
-			case SQL_C_LONG:
-				len = 4;
-				if (bind_size > 0)
-					*(SDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
-				else
-					*((SDWORD *) rgbValue + bind_row) = atol(value);
-				break;
+		case SQL_C_SLONG:
+		case SQL_C_LONG:
+			len = 4;
+			if (bind_size > 0) {
+				*(SDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
+			} else {
+				*((SDWORD *)rgbValue + bind_row) = atol(value);
+			}
+			break;
 
-			case SQL_C_ULONG:
-				len = 4;
-				if (bind_size > 0)
-					*(UDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
-				else
-					*((UDWORD *) rgbValue + bind_row) = atol(value);
-				break;
+		case SQL_C_ULONG:
+			len = 4;
+			if (bind_size > 0) {
+				*(UDWORD *) ((char *) rgbValue + (bind_row * bind_size)) = atol(value);
+			} else {
+				*((UDWORD *)rgbValue + bind_row) = atol(value);
+			}
+			break;
 
-			case SQL_C_BINARY:
+		case SQL_C_BINARY:	
 
-				/* truncate if necessary */
-				/* convert octal escapes to bytes */
+			/*	truncate if necessary */
+			/*	convert octal escapes to bytes */
 
-				len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf));
-				ptr = tempBuf;
+			len = convert_from_pgbinary(value, tempBuf, sizeof(tempBuf));
+			ptr = tempBuf;
 
-				if (stmt->current_col >= 0)
-				{
-					/* No more data left for this column */
-					if (stmt->bindings[stmt->current_col].data_left == 0)
-						return COPY_NO_DATA_FOUND;
+			if (stmt->current_col >= 0) {
 
-					/*
-					 * Second (or more) call to SQLGetData so move the
-					 * pointer
-					 */
-					else if (stmt->bindings[stmt->current_col].data_left > 0)
-					{
-						ptr += len - stmt->bindings[stmt->current_col].data_left;
-						len = stmt->bindings[stmt->current_col].data_left;
-					}
+				/*	No more data left for this column */
+				if (stmt->bindings[stmt->current_col].data_left == 0)
+					return COPY_NO_DATA_FOUND;
 
-					/* First call to SQLGetData so initialize data_left */
-					else
-						stmt->bindings[stmt->current_col].data_left = len;
+				/*	Second (or more) call to SQLGetData so move the pointer */
+				else if (stmt->bindings[stmt->current_col].data_left > 0) {
+					ptr += len - stmt->bindings[stmt->current_col].data_left;
+					len = stmt->bindings[stmt->current_col].data_left;
 				}
 
-				if (cbValueMax > 0)
-				{
-					copy_len = (len > cbValueMax) ? cbValueMax : len;
+				/*	First call to SQLGetData so initialize data_left */
+				else	
+					stmt->bindings[stmt->current_col].data_left = len;
 
-					/* Copy the data */
-					memcpy(rgbValueBindRow, ptr, copy_len);
+			}
 
-					/* Adjust data_left for next time */
-					if (stmt->current_col >= 0)
-						stmt->bindings[stmt->current_col].data_left -= copy_len;
-				}
+			if (cbValueMax > 0) {
+				copy_len = (len > cbValueMax) ? cbValueMax : len;
 
-				/*
-				 * Finally, check for truncation so that proper status can
-				 * be returned
-				 */
-				if (len > cbValueMax)
-					result = COPY_RESULT_TRUNCATED;
+				/*	Copy the data */
+				memcpy(rgbValueBindRow, ptr, copy_len);
 
-				mylog("SQL_C_BINARY: len = %d, copy_len = %d\n", len, copy_len);
-				break;
+				/*	Adjust data_left for next time */
+				if (stmt->current_col >= 0) {
+					stmt->bindings[stmt->current_col].data_left -= copy_len;
+				}
+			}
 
-			default:
-				return COPY_UNSUPPORTED_TYPE;
+			/*	Finally, check for truncation so that proper status can be returned */
+			if ( len > cbValueMax)
+				result = COPY_RESULT_TRUNCATED;
+
+			mylog("SQL_C_BINARY: len = %d, copy_len = %d\n", len, copy_len);
+			break;
+			
+		default:
+			return COPY_UNSUPPORTED_TYPE;
 		}
 	}
 
-	/* store the length of what was copied, if there's a place for it */
-	if (pcbValue)
-		*(SDWORD *) ((char *) pcbValue + pcbValueOffset) = len;
+    /* store the length of what was copied, if there's a place for it */
+    if(pcbValue) {
+        *(SDWORD *) ((char *)pcbValue + pcbValueOffset) = len;
+	}
 
 	return result;
+
 }
 
 
@@ -674,95 +640,80 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
 int
 copy_statement_with_parameters(StatementClass *stmt)
 {
-	static char *func = "copy_statement_with_parameters";
-	unsigned int opos,
-				npos,
-				oldstmtlen;
-	char		param_string[128],
-				tmp[256],
-				cbuf[TEXT_FIELD_SIZE + 5];
-	int			param_number;
-	Int2		param_ctype,
-				param_sqltype;
-	char	   *old_statement = stmt->statement;
-	char	   *new_statement = stmt->stmt_with_params;
-	SIMPLE_TIME st;
-	time_t		t = time(NULL);
-	struct tm  *tim;
-	SDWORD		used;
-	char	   *buffer,
-			   *buf;
-	char		in_quote = FALSE;
-	Oid			lobj_oid;
-	int			lobj_fd,
-				retval;
-
-
-	if (!old_statement)
-	{
+static char *func="copy_statement_with_parameters";
+unsigned int opos, npos, oldstmtlen;
+char param_string[128], tmp[256], cbuf[TEXT_FIELD_SIZE+5];
+int param_number;
+Int2 param_ctype, param_sqltype;
+char *old_statement = stmt->statement;
+char *new_statement = stmt->stmt_with_params;
+SIMPLE_TIME st;
+time_t t = time(NULL);
+struct tm *tim;
+SDWORD used;
+char *buffer, *buf;
+char in_quote = FALSE;
+Oid  lobj_oid;
+int lobj_fd, retval;
+
+
+	if ( ! old_statement) {
 		SC_log_error(func, "No statement string", stmt);
 		return SQL_ERROR;
 	}
 
 	memset(&st, 0, sizeof(SIMPLE_TIME));
 
-	/* Initialize current date */
+	/*	Initialize current date */
 	tim = localtime(&t);
 	st.m = tim->tm_mon + 1;
 	st.d = tim->tm_mday;
 	st.y = tim->tm_year + 1900;
 
-	/* If the application hasn't set a cursor name, then generate one */
-	if (stmt->cursor_name[0] == '\0')
+	/*	If the application hasn't set a cursor name, then generate one */
+	if ( stmt->cursor_name[0] == '\0')
 		sprintf(stmt->cursor_name, "SQL_CUR%p", stmt);
 
-	/* For selects, prepend a declare cursor to the statement */
-	if (stmt->statement_type == STMT_TYPE_SELECT && globals.use_declarefetch)
-	{
+	/*	For selects, prepend a declare cursor to the statement */
+	if (stmt->statement_type == STMT_TYPE_SELECT && globals.use_declarefetch) {
 		sprintf(new_statement, "declare %s cursor for ", stmt->cursor_name);
 		npos = strlen(new_statement);
 	}
-	else
-	{
+	else {
 		new_statement[0] = '0';
 		npos = 0;
 	}
 
-	param_number = -1;
+    param_number = -1;
 
 	oldstmtlen = strlen(old_statement);
 
-	for (opos = 0; opos < oldstmtlen; opos++)
-	{
-		/* Squeeze carriage-return/linefeed pairs to linefeed only */
-		if (old_statement[opos] == '\r' && opos + 1 < oldstmtlen &&
-			old_statement[opos + 1] == '\n')
+    for (opos = 0; opos < oldstmtlen; opos++) {
+
+		/*	Squeeze carriage-return/linefeed pairs to linefeed only */
+		if (old_statement[opos] == '\r' && opos+1 < oldstmtlen &&
+			old_statement[opos+1] == '\n') {
 			continue;
+		}
 
-		/*
-		 * Handle literals (date, time, timestamp) and ODBC scalar
-		 * functions
-		 */
-		else if (old_statement[opos] == '{')
-		{
-			char	   *esc;
-			char	   *begin = &old_statement[opos + 1];
-			char	   *end = strchr(begin, '}');
+		/*	Handle literals (date, time, timestamp) and ODBC scalar functions */
+		else if (old_statement[opos] == '{') {
+			char *esc;
+			char *begin = &old_statement[opos + 1];
+			char *end = strchr(begin, '}');
 
-			if (!end)
+			if ( ! end)
 				continue;
 
 			*end = '\0';
 
 			esc = convert_escape(begin);
-			if (esc)
-			{
+			if (esc) {
 				memcpy(&new_statement[npos], esc, strlen(esc));
 				npos += strlen(esc);
 			}
-			else
-			{					/* it's not a valid literal so just copy */
-				*end = '}';
+			else {		/* it's not a valid literal so just copy */
+				*end = '}';	
 				new_statement[npos++] = old_statement[opos];
 				continue;
 			}
@@ -774,15 +725,12 @@ copy_statement_with_parameters(StatementClass *stmt)
 			continue;
 		}
 
-		/*
-		 * Can you have parameter markers inside of quotes?  I dont think
-		 * so. All the queries I've seen expect the driver to put quotes
-		 * if needed.
-		 */
+		/*	Can you have parameter markers inside of quotes?  I dont think so.
+			All the queries I've seen expect the driver to put quotes if needed.
+		*/
 		else if (old_statement[opos] == '?' && !in_quote)
-			;					/* ok */
-		else
-		{
+			;	/* ok */
+		else {
 			if (old_statement[opos] == '\'')
 				in_quote = (in_quote ? FALSE : TRUE);
 
@@ -793,396 +741,363 @@ copy_statement_with_parameters(StatementClass *stmt)
 
 
 		/****************************************************/
-		/* Its a '?' parameter alright				  */
+		/*       Its a '?' parameter alright                */
 		/****************************************************/
 
 		param_number++;
 
-		if (param_number >= stmt->parameters_allocated)
+	    if (param_number >= stmt->parameters_allocated)
 			break;
 
-		/* Assign correct buffers based on data at exec param or not */
-		if (stmt->parameters[param_number].data_at_exec)
-		{
+		/*	Assign correct buffers based on data at exec param or not */
+		if ( stmt->parameters[param_number].data_at_exec) {
 			used = stmt->parameters[param_number].EXEC_used ? *stmt->parameters[param_number].EXEC_used : SQL_NTS;
 			buffer = stmt->parameters[param_number].EXEC_buffer;
 		}
-		else
-		{
+		else {
 			used = stmt->parameters[param_number].used ? *stmt->parameters[param_number].used : SQL_NTS;
 			buffer = stmt->parameters[param_number].buffer;
 		}
 
-		/* Handle NULL parameter data */
-		if (used == SQL_NULL_DATA)
-		{
+		/*	Handle NULL parameter data */
+		if (used == SQL_NULL_DATA) {
 			strcpy(&new_statement[npos], "NULL");
 			npos += 4;
 			continue;
 		}
 
-		/*
-		 * If no buffer, and it's not null, then what the hell is it? Just
-		 * leave it alone then.
-		 */
-		if (!buffer)
-		{
+		/*	If no buffer, and it's not null, then what the hell is it? 
+			Just leave it alone then.
+		*/
+		if ( ! buffer) {
 			new_statement[npos++] = '?';
 			continue;
 		}
 
 		param_ctype = stmt->parameters[param_number].CType;
 		param_sqltype = stmt->parameters[param_number].SQLType;
-
+		
 		mylog("copy_statement_with_params: from(fcType)=%d, to(fSqlType)=%d\n", param_ctype, param_sqltype);
-
+		
 		/* replace DEFAULT with something we can use */
-		if (param_ctype == SQL_C_DEFAULT)
+		if(param_ctype == SQL_C_DEFAULT)
 			param_ctype = sqltype_to_default_ctype(param_sqltype);
 
 		buf = NULL;
 		param_string[0] = '\0';
 		cbuf[0] = '\0';
 
+		
+		/*	Convert input C type to a neutral format */
+		switch(param_ctype) {
+		case SQL_C_BINARY:
+		case SQL_C_CHAR:
+			buf = buffer;
+			break;
 
-		/* Convert input C type to a neutral format */
-		switch (param_ctype)
-		{
-			case SQL_C_BINARY:
-			case SQL_C_CHAR:
-				buf = buffer;
-				break;
+		case SQL_C_DOUBLE:
+			sprintf(param_string, "%f", 
+				 *((SDOUBLE *) buffer));
+			break;
 
-			case SQL_C_DOUBLE:
-				sprintf(param_string, "%f",
-						*((SDOUBLE *) buffer));
-				break;
+		case SQL_C_FLOAT:
+			sprintf(param_string, "%f", 
+				 *((SFLOAT *) buffer));
+			break;
 
-			case SQL_C_FLOAT:
-				sprintf(param_string, "%f",
-						*((SFLOAT *) buffer));
-				break;
+		case SQL_C_SLONG:
+		case SQL_C_LONG:
+			sprintf(param_string, "%ld",
+				*((SDWORD *) buffer));
+			break;
 
-			case SQL_C_SLONG:
-			case SQL_C_LONG:
-				sprintf(param_string, "%ld",
-						*((SDWORD *) buffer));
-				break;
+		case SQL_C_SSHORT:
+		case SQL_C_SHORT:
+			sprintf(param_string, "%d",
+				*((SWORD *) buffer));
+			break;
 
-			case SQL_C_SSHORT:
-			case SQL_C_SHORT:
-				sprintf(param_string, "%d",
-						*((SWORD *) buffer));
-				break;
+		case SQL_C_STINYINT:
+		case SQL_C_TINYINT:
+			sprintf(param_string, "%d",
+				*((SCHAR *) buffer));
+			break;
 
-			case SQL_C_STINYINT:
-			case SQL_C_TINYINT:
-				sprintf(param_string, "%d",
-						*((SCHAR *) buffer));
-				break;
+		case SQL_C_ULONG:
+			sprintf(param_string, "%lu",
+				*((UDWORD *) buffer));
+			break;
 
-			case SQL_C_ULONG:
-				sprintf(param_string, "%lu",
-						*((UDWORD *) buffer));
-				break;
+		case SQL_C_USHORT:
+			sprintf(param_string, "%u",
+				*((UWORD *) buffer));
+			break;
 
-			case SQL_C_USHORT:
-				sprintf(param_string, "%u",
-						*((UWORD *) buffer));
-				break;
+		case SQL_C_UTINYINT:
+			sprintf(param_string, "%u",
+				*((UCHAR *) buffer));
+			break;
 
-			case SQL_C_UTINYINT:
-				sprintf(param_string, "%u",
-						*((UCHAR *) buffer));
-				break;
+		case SQL_C_BIT: {
+			int i = *((UCHAR *) buffer);
+			
+			sprintf(param_string, "%d", i ? 1 : 0);
+			break;
+						}
 
-			case SQL_C_BIT:
-				{
-					int			i = *((UCHAR *) buffer);
+		case SQL_C_DATE: {
+			DATE_STRUCT *ds = (DATE_STRUCT *) buffer;
+			st.m = ds->month;
+			st.d = ds->day;
+			st.y = ds->year;
 
-					sprintf(param_string, "%d", i ? 1 : 0);
-					break;
-				}
+			break;
+						 }
 
-			case SQL_C_DATE:
-				{
-					DATE_STRUCT *ds = (DATE_STRUCT *) buffer;
+		case SQL_C_TIME: {
+			TIME_STRUCT *ts = (TIME_STRUCT *) buffer;
+			st.hh = ts->hour;
+			st.mm = ts->minute;
+			st.ss = ts->second;
 
-					st.m = ds->month;
-					st.d = ds->day;
-					st.y = ds->year;
+			break;
+						 }
 
-					break;
-				}
+		case SQL_C_TIMESTAMP: {
+			TIMESTAMP_STRUCT *tss = (TIMESTAMP_STRUCT *) buffer;
+			st.m = tss->month;
+			st.d = tss->day;
+			st.y = tss->year;
+			st.hh = tss->hour;
+			st.mm = tss->minute;
+			st.ss = tss->second;
 
-			case SQL_C_TIME:
-				{
-					TIME_STRUCT *ts = (TIME_STRUCT *) buffer;
+			mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss);
 
-					st.hh = ts->hour;
-					st.mm = ts->minute;
-					st.ss = ts->second;
+			break;
 
-					break;
-				}
+							  }
+		default:
+			/* error */
+			stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters";
+			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			new_statement[npos] = '\0';   /* just in case */
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
+		}
 
-			case SQL_C_TIMESTAMP:
-				{
-					TIMESTAMP_STRUCT *tss = (TIMESTAMP_STRUCT *) buffer;
+		/*	Now that the input data is in a neutral format, convert it to
+			the desired output format (sqltype)
+		*/
 
-					st.m = tss->month;
-					st.d = tss->day;
-					st.y = tss->year;
-					st.hh = tss->hour;
-					st.mm = tss->minute;
-					st.ss = tss->second;
+		switch(param_sqltype) {
+		case SQL_CHAR:
+		case SQL_VARCHAR:
+		case SQL_LONGVARCHAR:
 
-					mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss);
+			new_statement[npos++] = '\'';	/*    Open Quote */
 
-					break;
-				}
-			default:
-				/* error */
-				stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters";
-				stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-				new_statement[npos] = '\0';		/* just in case */
-				SC_log_error(func, "", stmt);
-				return SQL_ERROR;
-		}
+			/* it was a SQL_C_CHAR */
+			if (buf) {
+				convert_special_chars(buf, &new_statement[npos], used);
+				npos += strlen(&new_statement[npos]);
+			}
 
-		/*
-		 * Now that the input data is in a neutral format, convert it to
-		 * the desired output format (sqltype)
-		 */
+			/* it was a numeric type */
+			else if (param_string[0] != '\0') {	
+				strcpy(&new_statement[npos], param_string);
+				npos += strlen(param_string);
+			}
 
-		switch (param_sqltype)
-		{
-			case SQL_CHAR:
-			case SQL_VARCHAR:
-			case SQL_LONGVARCHAR:
+			/* it was date,time,timestamp -- use m,d,y,hh,mm,ss */
+			else {
+				sprintf(tmp, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
+					st.y, st.m, st.d, st.hh, st.mm, st.ss);
 
-				new_statement[npos++] = '\'';	/* Open Quote */
+				strcpy(&new_statement[npos], tmp);
+				npos += strlen(tmp);
+			}
 
-				/* it was a SQL_C_CHAR */
-				if (buf)
-				{
-					convert_special_chars(buf, &new_statement[npos], used);
-					npos += strlen(&new_statement[npos]);
-				}
+			new_statement[npos++] = '\'';	/*    Close Quote */
 
-				/* it was a numeric type */
-				else if (param_string[0] != '\0')
-				{
-					strcpy(&new_statement[npos], param_string);
-					npos += strlen(param_string);
-				}
+			break;
 
-				/* it was date,time,timestamp -- use m,d,y,hh,mm,ss */
-				else
-				{
-					sprintf(tmp, "%.4d-%.2d-%.2d %.2d:%.2d:%.2d",
-							st.y, st.m, st.d, st.hh, st.mm, st.ss);
+		case SQL_DATE:
+			if (buf) {  /* copy char data to time */
+				my_strcpy(cbuf, sizeof(cbuf), buf, used);
+				parse_datetime(cbuf, &st);
+			}
 
-					strcpy(&new_statement[npos], tmp);
-					npos += strlen(tmp);
-				}
+			sprintf(tmp, "'%.4d-%.2d-%.2d'", st.y, st.m, st.d);
 
-				new_statement[npos++] = '\'';	/* Close Quote */
+			strcpy(&new_statement[npos], tmp);
+			npos += strlen(tmp);
+			break;
 
-				break;
+		case SQL_TIME:
+			if (buf) {  /* copy char data to time */
+				my_strcpy(cbuf, sizeof(cbuf), buf, used);
+				parse_datetime(cbuf, &st);
+			}
 
-			case SQL_DATE:
-				if (buf)
-				{				/* copy char data to time */
-					my_strcpy(cbuf, sizeof(cbuf), buf, used);
-					parse_datetime(cbuf, &st);
-				}
+			sprintf(tmp, "'%.2d:%.2d:%.2d'", st.hh, st.mm, st.ss);
 
-				sprintf(tmp, "'%.4d-%.2d-%.2d'", st.y, st.m, st.d);
+			strcpy(&new_statement[npos], tmp);
+			npos += strlen(tmp);
+			break;
 
-				strcpy(&new_statement[npos], tmp);
-				npos += strlen(tmp);
-				break;
+		case SQL_TIMESTAMP:
 
-			case SQL_TIME:
-				if (buf)
-				{				/* copy char data to time */
-					my_strcpy(cbuf, sizeof(cbuf), buf, used);
-					parse_datetime(cbuf, &st);
-				}
+			if (buf) {
+				my_strcpy(cbuf, sizeof(cbuf), buf, used);
+				parse_datetime(cbuf, &st);
+			}
 
-				sprintf(tmp, "'%.2d:%.2d:%.2d'", st.hh, st.mm, st.ss);
+			sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'",
+				st.y, st.m, st.d, st.hh, st.mm, st.ss);
 
-				strcpy(&new_statement[npos], tmp);
-				npos += strlen(tmp);
-				break;
+			strcpy(&new_statement[npos], tmp);
+			npos += strlen(tmp);
 
-			case SQL_TIMESTAMP:
+			break;
 
-				if (buf)
-				{
-					my_strcpy(cbuf, sizeof(cbuf), buf, used);
-					parse_datetime(cbuf, &st);
-				}
+		case SQL_BINARY:
+		case SQL_VARBINARY:			/* non-ascii characters should be converted to octal */
+			new_statement[npos++] = '\'';	/*    Open Quote */
 
-				sprintf(tmp, "'%.4d-%.2d-%.2d %.2d:%.2d:%.2d'",
-						st.y, st.m, st.d, st.hh, st.mm, st.ss);
+			mylog("SQL_VARBINARY: about to call convert_to_pgbinary, used = %d\n", used);
 
-				strcpy(&new_statement[npos], tmp);
-				npos += strlen(tmp);
+			npos += convert_to_pgbinary(buf, &new_statement[npos], used);
 
-				break;
+			new_statement[npos++] = '\'';	/*    Close Quote */
+			
+			break;
+
+		case SQL_LONGVARBINARY:		
+
+			if ( stmt->parameters[param_number].data_at_exec) {
 
-			case SQL_BINARY:
-			case SQL_VARBINARY:/* non-ascii characters should be
-								 * converted to octal */
-				new_statement[npos++] = '\'';	/* Open Quote */
+				lobj_oid = stmt->parameters[param_number].lobj_oid;
 
-				mylog("SQL_VARBINARY: about to call convert_to_pgbinary, used = %d\n", used);
+			}
+			else {
+  
+				/* begin transaction if needed */
+				if(!CC_is_in_trans(stmt->hdbc)) {
+					QResultClass *res;
+					char ok;
+
+					res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
+					if (!res) {
+						stmt->errormsg = "Could not begin (in-line) a transaction";
+						stmt->errornumber = STMT_EXEC_ERROR;
+						SC_log_error(func, "", stmt);
+						return SQL_ERROR;
+					}
+					ok = QR_command_successful(res);
+					QR_Destructor(res);
+					if (!ok) {
+						stmt->errormsg = "Could not begin (in-line) a transaction";
+						stmt->errornumber = STMT_EXEC_ERROR;
+						SC_log_error(func, "", stmt);
+						return SQL_ERROR;
+					}
 
-				npos += convert_to_pgbinary(buf, &new_statement[npos], used);
+					CC_set_in_trans(stmt->hdbc);
+				}
 
-				new_statement[npos++] = '\'';	/* Close Quote */
+				/*	store the oid */
+				lobj_oid = lo_creat(stmt->hdbc, INV_READ | INV_WRITE);
+				if (lobj_oid == 0) {
+					stmt->errornumber = STMT_EXEC_ERROR;
+					stmt->errormsg = "Couldnt create (in-line) large object.";
+					SC_log_error(func, "", stmt);
+					return SQL_ERROR;
+				}
 
-				break;
+				/*	store the fd */
+				lobj_fd = lo_open(stmt->hdbc, lobj_oid, INV_WRITE);
+				if ( lobj_fd < 0) {
+					stmt->errornumber = STMT_EXEC_ERROR;
+					stmt->errormsg = "Couldnt open (in-line) large object for writing.";
+					SC_log_error(func, "", stmt);
+					return SQL_ERROR;
+				}
 
-			case SQL_LONGVARBINARY:
+				retval = lo_write(stmt->hdbc, lobj_fd, buffer, used);
 
-				if (stmt->parameters[param_number].data_at_exec)
-					lobj_oid = stmt->parameters[param_number].lobj_oid;
-				else
-				{
-					/* begin transaction if needed */
-					if (!CC_is_in_trans(stmt->hdbc))
-					{
-						QResultClass *res;
-						char		ok;
-
-						res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
-						if (!res)
-						{
-							stmt->errormsg = "Could not begin (in-line) a transaction";
-							stmt->errornumber = STMT_EXEC_ERROR;
-							SC_log_error(func, "", stmt);
-							return SQL_ERROR;
-						}
-						ok = QR_command_successful(res);
-						QR_Destructor(res);
-						if (!ok)
-						{
-							stmt->errormsg = "Could not begin (in-line) a transaction";
-							stmt->errornumber = STMT_EXEC_ERROR;
-							SC_log_error(func, "", stmt);
-							return SQL_ERROR;
-						}
+				lo_close(stmt->hdbc, lobj_fd);
 
-						CC_set_in_trans(stmt->hdbc);
-					}
+				/* commit transaction if needed */
+				if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
+					QResultClass *res;
+					char ok;
 
-					/* store the oid */
-					lobj_oid = lo_creat(stmt->hdbc, INV_READ | INV_WRITE);
-					if (lobj_oid == 0)
-					{
+					res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
+					if (!res) {
+						stmt->errormsg = "Could not commit (in-line) a transaction";
 						stmt->errornumber = STMT_EXEC_ERROR;
-						stmt->errormsg = "Couldnt create (in-line) large object.";
 						SC_log_error(func, "", stmt);
 						return SQL_ERROR;
 					}
-
-					/* store the fd */
-					lobj_fd = lo_open(stmt->hdbc, lobj_oid, INV_WRITE);
-					if (lobj_fd < 0)
-					{
+					ok = QR_command_successful(res);
+					QR_Destructor(res);
+					if (!ok) {
+						stmt->errormsg = "Could not commit (in-line) a transaction";
 						stmt->errornumber = STMT_EXEC_ERROR;
-						stmt->errormsg = "Couldnt open (in-line) large object for writing.";
 						SC_log_error(func, "", stmt);
 						return SQL_ERROR;
 					}
 
-					retval = lo_write(stmt->hdbc, lobj_fd, buffer, used);
+					CC_set_no_trans(stmt->hdbc);
+				}
+			}
 
-					lo_close(stmt->hdbc, lobj_fd);
+			/*	the oid of the large object -- just put that in for the
+				parameter marker -- the data has already been sent to the large object
+			*/
+			sprintf(param_string, "'%d'", lobj_oid);
+			strcpy(&new_statement[npos], param_string);
+			npos += strlen(param_string);
 
-					/* commit transaction if needed */
-					if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
-					{
-						QResultClass *res;
-						char		ok;
+			break;
 
-						res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-						if (!res)
-						{
-							stmt->errormsg = "Could not commit (in-line) a transaction";
-							stmt->errornumber = STMT_EXEC_ERROR;
-							SC_log_error(func, "", stmt);
-							return SQL_ERROR;
-						}
-						ok = QR_command_successful(res);
-						QR_Destructor(res);
-						if (!ok)
-						{
-							stmt->errormsg = "Could not commit (in-line) a transaction";
-							stmt->errornumber = STMT_EXEC_ERROR;
-							SC_log_error(func, "", stmt);
-							return SQL_ERROR;
-						}
+			/*	because of no conversion operator for bool and int4, SQL_BIT */
+			/*	must be quoted (0 or 1 is ok to use inside the quotes) */
 
-						CC_set_no_trans(stmt->hdbc);
-					}
-				}
+		default:		/* a numeric type or SQL_BIT */
+			if (param_sqltype == SQL_BIT)
+				new_statement[npos++] = '\'';	/*    Open Quote */
 
-				/*
-				 * the oid of the large object -- just put that in for the
-				 * parameter marker -- the data has already been sent to
-				 * the large object
-				 */
-				sprintf(param_string, "'%d'", lobj_oid);
+			if (buf) {
+				my_strcpy(&new_statement[npos], sizeof(stmt->stmt_with_params) - npos, buf, used);
+				npos += strlen(&new_statement[npos]);
+			}
+			else {
 				strcpy(&new_statement[npos], param_string);
 				npos += strlen(param_string);
+			}
 
-				break;
-
-				/*
-				 * because of no conversion operator for bool and int4,
-				 * SQL_BIT
-				 */
-				/* must be quoted (0 or 1 is ok to use inside the quotes) */
-
-			default:			/* a numeric type or SQL_BIT */
-				if (param_sqltype == SQL_BIT)
-					new_statement[npos++] = '\'';		/* Open Quote */
+			if (param_sqltype == SQL_BIT)
+				new_statement[npos++] = '\'';	/*    Close Quote */
 
-				if (buf)
-				{
-					my_strcpy(&new_statement[npos], sizeof(stmt->stmt_with_params) - npos, buf, used);
-					npos += strlen(&new_statement[npos]);
-				}
-				else
-				{
-					strcpy(&new_statement[npos], param_string);
-					npos += strlen(param_string);
-				}
-
-				if (param_sqltype == SQL_BIT)
-					new_statement[npos++] = '\'';		/* Close Quote */
+			break;
 
-				break;
 		}
-	}							/* end, for */
+
+	}	/* end, for */
 
 	/* make sure new_statement is always null-terminated */
 	new_statement[npos] = '\0';
 
 
-	if (stmt->hdbc->DriverToDataSource != NULL)
-	{
-		int			length = strlen(new_statement);
-
-		stmt->hdbc->DriverToDataSource(stmt->hdbc->translation_option,
-									   SQL_CHAR,
-									   new_statement, length,
-									   new_statement, length, NULL,
-									   NULL, 0, NULL);
+	if(stmt->hdbc->DriverToDataSource != NULL) {
+		int length = strlen (new_statement);
+		stmt->hdbc->DriverToDataSource (stmt->hdbc->translation_option,
+										SQL_CHAR,
+										new_statement, length,
+										new_statement, length, NULL,
+										NULL, 0, NULL);
 	}
 
 
@@ -1192,10 +1107,10 @@ copy_statement_with_parameters(StatementClass *stmt)
 char *
 mapFunction(char *func)
 {
-	int			i;
+int i;
 
 	for (i = 0; mapFuncs[i][0]; i++)
-		if (!stricmp(mapFuncs[i][0], func))
+		if ( ! stricmp(mapFuncs[i][0], func))
 			return mapFuncs[i][1];
 
 	return NULL;
@@ -1207,40 +1122,34 @@ mapFunction(char *func)
 char *
 convert_escape(char *value)
 {
-	static char escape[1024];
-	char		key[33];
+static char escape[1024];
+char key[33];
 
 	/* Separate off the key, skipping leading and trailing whitespace */
-	while ((*value != '\0') && isspace((unsigned char) *value))
-		value++;
+	while ((*value != '\0') && isspace((unsigned char) *value)) value++;
 	sscanf(value, "%32s", key);
-	while ((*value != '\0') && (!isspace((unsigned char) *value)))
-		value++;
-	while ((*value != '\0') && isspace((unsigned char) *value))
-		value++;
+	while ((*value != '\0') && (! isspace((unsigned char) *value))) value++;
+	while ((*value != '\0') && isspace((unsigned char) *value)) value++;
 
 	mylog("convert_escape: key='%s', val='%s'\n", key, value);
 
-	if ((strcmp(key, "d") == 0) ||
-		(strcmp(key, "t") == 0) ||
-		(strcmp(key, "ts") == 0))
-	{
+	if ( (strcmp(key, "d") == 0) ||
+		 (strcmp(key, "t") == 0) ||
+		 (strcmp(key, "ts") == 0)) {
 		/* Literal; return the escape part as-is */
-		strncpy(escape, value, sizeof(escape) - 1);
+		strncpy(escape, value, sizeof(escape)-1);
 	}
-	else if (strcmp(key, "fn") == 0)
-	{
-
-		/*
-		 * Function invocation Separate off the func name, skipping
-		 * trailing whitespace.
+	else if (strcmp(key, "fn") == 0) {
+		/* Function invocation
+		 * Separate off the func name,
+		 * skipping trailing whitespace.
 		 */
-		char	   *funcEnd = value;
-		char		svchar;
-		char	   *mapFunc;
+		char *funcEnd = value;
+		char svchar;
+		char *mapFunc;
 
 		while ((*funcEnd != '\0') && (*funcEnd != '(') &&
-			   (!isspace((unsigned char) *funcEnd)))
+			   (! isspace((unsigned char) *funcEnd)))
 			funcEnd++;
 		svchar = *funcEnd;
 		*funcEnd = '\0';
@@ -1249,51 +1158,45 @@ convert_escape(char *value)
 		while ((*funcEnd != '\0') && isspace((unsigned char) *funcEnd))
 			funcEnd++;
 
-		/*
-		 * We expect left parenthesis here, else return fn body as-is
-		 * since it is one of those "function constants".
+		/* We expect left parenthesis here,
+		 * else return fn body as-is since it is
+		 * one of those "function constants".
 		 */
-		if (*funcEnd != '(')
-		{
-			strncpy(escape, value, sizeof(escape) - 1);
+		if (*funcEnd != '(') {
+			strncpy(escape, value, sizeof(escape)-1);
 			return escape;
 		}
 		mapFunc = mapFunction(key);
-
-		/*
-		 * We could have mapFunction() return key if not in table... -
-		 * thomas 2000-04-03
+		/* We could have mapFunction() return key if not in table...
+		 * - thomas 2000-04-03
 		 */
-		if (mapFunc == NULL)
-		{
+		if (mapFunc == NULL) {
 			/* If unrecognized function name, return fn body as-is */
-			strncpy(escape, value, sizeof(escape) - 1);
+			strncpy(escape, value, sizeof(escape)-1);
 			return escape;
 		}
 		/* copy mapped name and remaining input string */
 		strcpy(escape, mapFunc);
-		strncat(escape, funcEnd, sizeof(escape) - 1 - strlen(mapFunc));
+		strncat(escape, funcEnd, sizeof(escape)-1-strlen(mapFunc));
 	}
-	else
-	{
+	else {
 		/* Bogus key, leave untranslated */
 		return NULL;
 	}
 
 	return escape;
+
 }
 
 
 char *
 convert_money(char *s)
 {
-	size_t		i = 0,
-				out = 0;
+size_t i = 0, out = 0;
 
-	for (i = 0; i < strlen(s); i++)
-	{
+	for (i = 0; i < strlen(s); i++) {
 		if (s[i] == '$' || s[i] == ',' || s[i] == ')')
-			;					/* skip these characters */
+			; /* skip these characters */
 		else if (s[i] == '(')
 			s[out++] = '-';
 		else
@@ -1310,23 +1213,17 @@ convert_money(char *s)
 char
 parse_datetime(char *buf, SIMPLE_TIME *st)
 {
-	int			y,
-				m,
-				d,
-				hh,
-				mm,
-				ss;
-	int			nf;
-
+int y,m,d,hh,mm,ss;
+int nf;
+	
 	y = m = d = hh = mm = ss = 0;
 
-	if (buf[4] == '-')			/* year first */
-		nf = sscanf(buf, "%4d-%2d-%2d %2d:%2d:%2d", &y, &m, &d, &hh, &mm, &ss);
+	if (buf[4] == '-')	/* year first */
+		nf = sscanf(buf, "%4d-%2d-%2d %2d:%2d:%2d", &y,&m,&d,&hh,&mm,&ss);
 	else
-		nf = sscanf(buf, "%2d-%2d-%4d %2d:%2d:%2d", &m, &d, &y, &hh, &mm, &ss);
+		nf = sscanf(buf, "%2d-%2d-%4d %2d:%2d:%2d", &m,&d,&y,&hh,&mm,&ss);
 
-	if (nf == 5 || nf == 6)
-	{
+	if (nf == 5 || nf == 6) {
 		st->y = y;
 		st->m = m;
 		st->d = d;
@@ -1337,13 +1234,12 @@ parse_datetime(char *buf, SIMPLE_TIME *st)
 		return TRUE;
 	}
 
-	if (buf[4] == '-')			/* year first */
+	if (buf[4] == '-')	/* year first */
 		nf = sscanf(buf, "%4d-%2d-%2d", &y, &m, &d);
 	else
 		nf = sscanf(buf, "%2d-%2d-%4d", &m, &d, &y);
 
-	if (nf == 3)
-	{
+	if (nf == 3) {
 		st->y = y;
 		st->m = m;
 		st->d = d;
@@ -1352,8 +1248,7 @@ parse_datetime(char *buf, SIMPLE_TIME *st)
 	}
 
 	nf = sscanf(buf, "%2d:%2d:%2d", &hh, &mm, &ss);
-	if (nf == 2 || nf == 3)
-	{
+	if (nf == 2 || nf == 3) {
 		st->hh = hh;
 		st->mm = mm;
 		st->ss = ss;
@@ -1368,16 +1263,12 @@ parse_datetime(char *buf, SIMPLE_TIME *st)
 int
 convert_linefeeds(char *si, char *dst, size_t max)
 {
-	size_t		i = 0,
-				out = 0;
+size_t i = 0, out = 0;
 
-	for (i = 0; i < strlen(si) && out < max - 1; i++)
-	{
-		if (si[i] == '\n')
-		{
-			/* Only add the carriage-return if needed */
-			if (i > 0 && si[i - 1] == '\r')
-			{
+	for (i = 0; i < strlen(si) && out < max - 1; i++) {
+		if (si[i] == '\n') {
+			/*	Only add the carriage-return if needed */
+			if (i > 0 && si[i-1] == '\r') {
 				dst[out++] = si[i];
 				continue;
 			}
@@ -1392,17 +1283,15 @@ convert_linefeeds(char *si, char *dst, size_t max)
 	return out;
 }
 
-/*	Change carriage-return/linefeed to just linefeed
+/*	Change carriage-return/linefeed to just linefeed 
 	Plus, escape any special characters.
 */
 char *
 convert_special_chars(char *si, char *dst, int used)
 {
-	size_t		i = 0,
-				out = 0,
-				max;
-	static char sout[TEXT_FIELD_SIZE + 5];
-	char	   *p;
+size_t i = 0, out = 0, max;
+static char sout[TEXT_FIELD_SIZE+5];
+char *p;
 
 	if (dst)
 		p = dst;
@@ -1416,9 +1305,8 @@ convert_special_chars(char *si, char *dst, int used)
 	else
 		max = used;
 
-	for (i = 0; i < max; i++)
-	{
-		if (si[i] == '\r' && i + 1 < strlen(si) && si[i + 1] == '\n')
+	for (i = 0; i < max; i++) {
+		if (si[i] == '\r' && i+1 < strlen(si) && si[i+1] == '\n') 
 			continue;
 		else if (si[i] == '\'' || si[i] == '\\')
 			p[out++] = '\\';
@@ -1442,32 +1330,31 @@ convert_pgbinary_to_char(char *value, char *rgbValue, int cbValueMax)
 unsigned int
 conv_from_octal(unsigned char *s)
 {
-	int			i,
-				y = 0;
+int i, y=0;
 
-	for (i = 1; i <= 3; i++)
-		y += (s[i] - 48) * (int) pow(8, 3 - i);
+	for (i = 1; i <= 3; i++) {
+		y += (s[i] - 48) * (int) pow(8, 3-i);
+	}
 
 	return y;
+
 }
 
 unsigned int
 conv_from_hex(unsigned char *s)
 {
-	int			i,
-				y = 0,
-				val;
-
-	for (i = 1; i <= 2; i++)
-	{
-		if (s[i] >= 'a' && s[i] <= 'f')
-			val = s[i] - 'a' + 10;
-		else if (s[i] >= 'A' && s[i] <= 'F')
-			val = s[i] - 'A' + 10;
-		else
-			val = s[i] - '0';
+int i, y=0, val;
+
+	for (i = 1; i <= 2; i++) {
+
+        if (s[i] >= 'a' && s[i] <= 'f')
+            val = s[i] - 'a' + 10;
+        else if (s[i] >= 'A' && s[i] <= 'F')
+            val = s[i] - 'A' + 10;
+        else
+            val = s[i] - '0';
 
-		y += val * (int) pow(16, 2 - i);
+		y += val * (int) pow(16, 2-i);
 	}
 
 	return y;
@@ -1477,24 +1364,23 @@ conv_from_hex(unsigned char *s)
 int
 convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax)
 {
-	size_t		i;
-	int			o = 0;
+size_t i;
+int o=0;
 
-
-	for (i = 0; i < strlen(value);)
-	{
-		if (value[i] == '\\')
-		{
+	
+	for (i = 0; i < strlen(value); ) {
+		if (value[i] == '\\') {
 			rgbValue[o] = conv_from_octal(&value[i]);
 			i += 4;
 		}
-		else
+		else {
 			rgbValue[o] = value[i++];
+		}
 		mylog("convert_from_pgbinary: i=%d, rgbValue[%d] = %d, %c\n", i, o, rgbValue[o], rgbValue[o]);
 		o++;
 	}
 
-	rgbValue[o] = '\0';			/* extra protection */
+	rgbValue[o] = '\0';	/* extra protection */
 
 	return o;
 }
@@ -1503,15 +1389,14 @@ convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValue
 char *
 conv_to_octal(unsigned char val)
 {
-	int			i;
-	static char x[6];
+int i;
+static char x[6];
 
 	x[0] = '\\';
 	x[1] = '\\';
 	x[5] = '\0';
 
-	for (i = 4; i > 1; i--)
-	{
+	for (i = 4; i > 1; i--) {
 		x[i] = (val & 7) + 48;
 		val >>= 3;
 	}
@@ -1523,20 +1408,19 @@ conv_to_octal(unsigned char val)
 int
 convert_to_pgbinary(unsigned char *in, char *out, int len)
 {
-	int			i,
-				o = 0;
+int i, o=0;
 
 
-	for (i = 0; i < len; i++)
-	{
+	for (i = 0; i < len; i++) {
 		mylog("convert_to_pgbinary: in[%d] = %d, %c\n", i, in[i], in[i]);
-		if (isalnum(in[i]) || in[i] == ' ')
+		if ( isalnum(in[i]) || in[i] == ' ') {
 			out[o++] = in[i];
-		else
-		{
-			strcpy(&out[o], conv_to_octal(in[i]));
+		}
+		else {
+			strcpy(&out[o], conv_to_octal(in[i])); 
 			o += 5;
 		}
+
 	}
 
 	mylog("convert_to_pgbinary: returning %d, out='%.*s'\n", o, o, out);
@@ -1548,20 +1432,17 @@ convert_to_pgbinary(unsigned char *in, char *out, int len)
 void
 encode(char *in, char *out)
 {
-	unsigned int i,
-				o = 0;
+	unsigned int i, o = 0;
 
-	for (i = 0; i < strlen(in); i++)
-	{
-		if (in[i] == '+')
-		{
+	for (i = 0; i < strlen(in); i++) {
+		if ( in[i] == '+') {
 			sprintf(&out[o], "%%2B");
 			o += 3;
 		}
-		else if (isspace((unsigned char) in[i]))
+		else if ( isspace((unsigned char) in[i])) {
 			out[o++] = '+';
-		else if (!isalnum((unsigned char) in[i]))
-		{
+		}
+		else if ( ! isalnum((unsigned char) in[i])) {
 			sprintf(&out[o], "%%%02x", (unsigned char) in[i]);
 			o += 3;
 		}
@@ -1575,17 +1456,14 @@ encode(char *in, char *out)
 void
 decode(char *in, char *out)
 {
-	unsigned int i,
-				o = 0;
+unsigned int i, o = 0;
 
-	for (i = 0; i < strlen(in); i++)
-	{
+	for (i = 0; i < strlen(in); i++) { 
 		if (in[i] == '+')
 			out[o++] = ' ';
-		else if (in[i] == '%')
-		{
+		else if (in[i] == '%') {
 			sprintf(&out[o++], "%c", conv_from_hex(&in[i]));
-			i += 2;
+			i+=2;
 		}
 		else
 			out[o++] = in[i];
@@ -1605,52 +1483,45 @@ decode(char *in, char *out)
 
 	CURRENTLY, ONLY LONGVARBINARY is handled, since that is the only
 	data type currently mapped to a PG_TYPE_LO.  But, if any other types
-	are desired to map to a large object (PG_TYPE_LO), then that would
+	are desired to map to a large object (PG_TYPE_LO), then that would 
 	need to be handled here.  For example, LONGVARCHAR could possibly be
 	mapped to PG_TYPE_LO someday, instead of PG_TYPE_TEXT as it is now.
 */
 int
-convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
+convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue, 
 		   SDWORD cbValueMax, SDWORD *pcbValue)
 {
-	Oid			oid;
-	int			retval,
-				result,
-				left = -1;
+	Oid oid;
+	int retval, result, left = -1;
 	BindInfoClass *bindInfo = NULL;
 
 
 /*	If using SQLGetData, then current_col will be set */
-	if (stmt->current_col >= 0)
-	{
+	if (stmt->current_col >= 0) {
 		bindInfo = &stmt->bindings[stmt->current_col];
 		left = bindInfo->data_left;
 	}
 
-	/*
-	 * if this is the first call for this column, open the large object
-	 * for reading
-	 */
+	/*	if this is the first call for this column,
+		open the large object for reading 
+	*/
+
+	if ( ! bindInfo || bindInfo->data_left == -1) {
 
-	if (!bindInfo || bindInfo->data_left == -1)
-	{
 		/* begin transaction if needed */
-		if (!CC_is_in_trans(stmt->hdbc))
-		{
+		if(!CC_is_in_trans(stmt->hdbc)) {
 			QResultClass *res;
-			char		ok;
+			char ok;
 
 			res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
-			if (!res)
-			{
+			if (!res) {
 				stmt->errormsg = "Could not begin (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok)
-			{
+			if (!ok) {
 				stmt->errormsg = "Could not begin (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
@@ -1661,58 +1532,53 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 
 		oid = atoi(value);
 		stmt->lobj_fd = lo_open(stmt->hdbc, oid, INV_READ);
-		if (stmt->lobj_fd < 0)
-		{
+		if (stmt->lobj_fd < 0) {
 			stmt->errornumber = STMT_EXEC_ERROR;
 			stmt->errormsg = "Couldnt open large object for reading.";
 			return COPY_GENERAL_ERROR;
 		}
 
-		/* Get the size */
+		/*	Get the size */
 		retval = lo_lseek(stmt->hdbc, stmt->lobj_fd, 0L, SEEK_END);
-		if (retval >= 0)
-		{
+		if (retval >= 0) {
+
 			left = lo_tell(stmt->hdbc, stmt->lobj_fd);
 			if (bindInfo)
 				bindInfo->data_left = left;
 
-			/* return to beginning */
+			/*	return to beginning */
 			lo_lseek(stmt->hdbc, stmt->lobj_fd, 0L, SEEK_SET);
 		}
 	}
 
-	if (left == 0)
+	if (left == 0) {
 		return COPY_NO_DATA_FOUND;
+	}
 
-	if (stmt->lobj_fd < 0)
-	{
+	if (stmt->lobj_fd < 0) {
 		stmt->errornumber = STMT_EXEC_ERROR;
 		stmt->errormsg = "Large object FD undefined for multiple read.";
 		return COPY_GENERAL_ERROR;
 	}
 
 	retval = lo_read(stmt->hdbc, stmt->lobj_fd, (char *) rgbValue, cbValueMax);
-	if (retval < 0)
-	{
+	if (retval < 0) {
 		lo_close(stmt->hdbc, stmt->lobj_fd);
 
 		/* commit transaction if needed */
-		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
-		{
+		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
 			QResultClass *res;
-			char		ok;
+			char ok;
 
 			res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-			if (!res)
-			{
+			if (!res) {
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok)
-			{
+			if (!ok) {
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
@@ -1737,31 +1603,27 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 		*pcbValue = left < 0 ? SQL_NO_TOTAL : left;
 
 
-	if (bindInfo && bindInfo->data_left > 0)
+	if (bindInfo && bindInfo->data_left > 0) 
 		bindInfo->data_left -= retval;
 
 
-	if (!bindInfo || bindInfo->data_left == 0)
-	{
+	if (! bindInfo || bindInfo->data_left == 0) {
 		lo_close(stmt->hdbc, stmt->lobj_fd);
 
 		/* commit transaction if needed */
-		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
-		{
+		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
 			QResultClass *res;
-			char		ok;
+			char ok;
 
 			res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-			if (!res)
-			{
+			if (!res) {
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok)
-			{
+			if (!ok) {
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				return COPY_GENERAL_ERROR;
@@ -1770,9 +1632,10 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
 			CC_set_no_trans(stmt->hdbc);
 		}
 
-		stmt->lobj_fd = -1;		/* prevent further reading */
+		stmt->lobj_fd = -1;	/* prevent further reading */
 	}
 
 
 	return result;
+
 }
diff --git a/src/interfaces/odbc/convert.h b/src/interfaces/odbc/convert.h
index ae903bbafb6bbea95e090299ba82bf7b18bf095d..7fd8254779075d9b2e4caa6fdc65e0d08024f51d 100644
--- a/src/interfaces/odbc/convert.h
+++ b/src/interfaces/odbc/convert.h
@@ -1,9 +1,9 @@
 
-/* File:			convert.h
+/* File:            convert.h
  *
- * Description:		See "convert.c"
+ * Description:     See "convert.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -13,40 +13,39 @@
 #include "psqlodbc.h"
 
 /* copy_and_convert results */
-#define COPY_OK						 0
-#define COPY_UNSUPPORTED_TYPE		 1
+#define COPY_OK                      0
+#define COPY_UNSUPPORTED_TYPE        1
 #define COPY_UNSUPPORTED_CONVERSION  2
-#define COPY_RESULT_TRUNCATED		 3
-#define COPY_GENERAL_ERROR			 4
-#define COPY_NO_DATA_FOUND			 5
-
-typedef struct
-{
-	int			m;
-	int			d;
-	int			y;
-	int			hh;
-	int			mm;
-	int			ss;
+#define COPY_RESULT_TRUNCATED        3
+#define COPY_GENERAL_ERROR           4
+#define COPY_NO_DATA_FOUND           5
+
+typedef struct {
+	int m;
+	int d;
+	int y;
+	int hh;
+	int mm;
+	int ss;
 } SIMPLE_TIME;
 
-int			copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col);
-int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType,
-					   PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue);
-
-int			copy_statement_with_parameters(StatementClass *stmt);
-char	   *convert_escape(char *value);
-char	   *convert_money(char *s);
-char		parse_datetime(char *buf, SIMPLE_TIME *st);
-int			convert_linefeeds(char *s, char *dst, size_t max);
-char	   *convert_special_chars(char *si, char *dst, int used);
-
-int			convert_pgbinary_to_char(char *value, char *rgbValue, int cbValueMax);
-int			convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax);
-int			convert_to_pgbinary(unsigned char *in, char *out, int len);
-void		encode(char *in, char *out);
-void		decode(char *in, char *out);
-int convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
+int copy_and_convert_field_bindinfo(StatementClass *stmt, Int4 field_type, void *value, int col);
+int copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType, 
+						   PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue);
+
+int copy_statement_with_parameters(StatementClass *stmt);
+char *convert_escape(char *value);
+char *convert_money(char *s);
+char parse_datetime(char *buf, SIMPLE_TIME *st);
+int convert_linefeeds(char *s, char *dst, size_t max);
+char *convert_special_chars(char *si, char *dst, int used);
+
+int convert_pgbinary_to_char(char *value, char *rgbValue, int cbValueMax);
+int convert_from_pgbinary(unsigned char *value, unsigned char *rgbValue, int cbValueMax);
+int convert_to_pgbinary(unsigned char *in, char *out, int len);
+void encode(char *in, char *out);
+void decode(char *in, char *out);
+int convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue, 
 		   SDWORD cbValueMax, SDWORD *pcbValue);
 
 #endif
diff --git a/src/interfaces/odbc/dlg_specific.c b/src/interfaces/odbc/dlg_specific.c
index 1f5c7dba5eaecaf67215d38690644d7ecc12e02b..13e8b44e6189deb4382b000efb3a9a1f1226d409 100644
--- a/src/interfaces/odbc/dlg_specific.c
+++ b/src/interfaces/odbc/dlg_specific.c
@@ -1,17 +1,18 @@
-/* Module:			dlg_specific.c
+
+/* Module:          dlg_specific.c
  *
- * Description:		This module contains any specific code for handling
- *					dialog boxes such as driver/datasource options.  Both the
- *					ConfigDSN() and the SQLDriverConnect() functions use
- *					functions in this module.  If you were to add a new option
- *					to any dialog box, you would most likely only have to change
- *					things in here rather than in 2 separate places as before.
+ * Description:     This module contains any specific code for handling
+ *                  dialog boxes such as driver/datasource options.  Both the
+ *                  ConfigDSN() and the SQLDriverConnect() functions use 
+ *                  functions in this module.  If you were to add a new option
+ *                  to any dialog box, you would most likely only have to change
+ *                  things in here rather than in 2 separate places as before.
  *
- * Classes:			none
+ * Classes:         none
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -20,14 +21,14 @@
 #endif
 
 #ifndef WIN32
-#include <string.h>
-#include "gpps.h"
-#define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
-#define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
-#ifndef HAVE_STRICMP
-#define stricmp(s1,s2)		strcasecmp(s1,s2)
-#define strnicmp(s1,s2,n)	strncasecmp(s1,s2,n)
-#endif
+# include <string.h>
+# include "gpps.h"
+# define SQLGetPrivateProfileString(a,b,c,d,e,f) GetPrivateProfileString(a,b,c,d,e,f)
+# define SQLWritePrivateProfileString(a,b,c,d) WritePrivateProfileString(a,b,c,d)
+# ifndef HAVE_STRICMP
+#  define stricmp(s1,s2)      strcasecmp(s1,s2)
+#  define strnicmp(s1,s2,n)   strncasecmp(s1,s2,n)
+# endif
 #endif
 
 #include "dlg_specific.h"
@@ -49,13 +50,8 @@ extern GLOBAL_VALUES globals;
 void
 SetDlgStuff(HWND hdlg, ConnInfo *ci)
 {
-
-	/*
-	 * If driver attribute NOT present, then set the datasource name and
-	 * description
-	 */
-	if (ci->driver[0] == '\0')
-	{
+	/*	If driver attribute NOT present, then set the datasource name and description */
+	if (ci->driver[0] == '\0') {
 		SetDlgItemText(hdlg, IDC_DSNAME, ci->dsn);
 		SetDlgItemText(hdlg, IDC_DESC, ci->desc);
 	}
@@ -67,7 +63,7 @@ SetDlgStuff(HWND hdlg, ConnInfo *ci)
 	SetDlgItemText(hdlg, IDC_PORT, ci->port);
 }
 
-void
+void 
 GetDlgStuff(HWND hdlg, ConnInfo *ci)
 {
 	GetDlgItemText(hdlg, IDC_DESC, ci->desc, sizeof(ci->desc));
@@ -81,294 +77,296 @@ GetDlgStuff(HWND hdlg, ConnInfo *ci)
 
 
 
-int			CALLBACK
-driver_optionsProc(HWND hdlg,
-				   WORD wMsg,
-				   WPARAM wParam,
-				   LPARAM lParam)
+int CALLBACK driver_optionsProc(HWND   hdlg,
+                           WORD   wMsg,
+                           WPARAM wParam,
+                           LPARAM lParam)
 {
-	switch (wMsg)
-	{
-			case WM_INITDIALOG:
-
-			CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog);
-			CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
-			CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
-			CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
-			CheckDlgButton(hdlg, DRV_READONLY, globals.onlyread);
-			CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
-
-			/* Unknown (Default) Data Type sizes */
-			switch (globals.unknown_sizes)
-			{
-				case UNKNOWNS_AS_DONTKNOW:
-					CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
-					break;
-				case UNKNOWNS_AS_LONGEST:
-					CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
-					break;
-				case UNKNOWNS_AS_MAX:
-				default:
-					CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
-					break;
-			}
+	switch (wMsg) {
+	case WM_INITDIALOG:
+
+		CheckDlgButton(hdlg, DRV_COMMLOG, globals.commlog);
+		CheckDlgButton(hdlg, DRV_OPTIMIZER, globals.disable_optimizer);
+		CheckDlgButton(hdlg, DRV_KSQO, globals.ksqo);
+		CheckDlgButton(hdlg, DRV_UNIQUEINDEX, globals.unique_index);
+		CheckDlgButton(hdlg, DRV_READONLY, globals.onlyread);
+		CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, globals.use_declarefetch);
+
+		/*	Unknown (Default) Data Type sizes */
+		switch(globals.unknown_sizes) {
+		case UNKNOWNS_AS_DONTKNOW:
+			CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
+			break;
+		case UNKNOWNS_AS_LONGEST:
+			CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
+			break;
+		case UNKNOWNS_AS_MAX:
+		default:
+			CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
+			break;
+		}
 
-			CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, globals.text_as_longvarchar);
-			CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, globals.unknowns_as_longvarchar);
-			CheckDlgButton(hdlg, DRV_BOOLS_CHAR, globals.bools_as_char);
+		CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, globals.text_as_longvarchar);
+		CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, globals.unknowns_as_longvarchar);
+		CheckDlgButton(hdlg, DRV_BOOLS_CHAR, globals.bools_as_char);
 
-			CheckDlgButton(hdlg, DRV_PARSE, globals.parse);
+		CheckDlgButton(hdlg, DRV_PARSE, globals.parse);
 
-			CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, globals.cancel_as_freestmt);
+		CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, globals.cancel_as_freestmt);
 
-			SetDlgItemInt(hdlg, DRV_CACHE_SIZE, globals.fetch_max, FALSE);
-			SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, globals.max_varchar_size, FALSE);
-			SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, globals.max_longvarchar_size, TRUE);
+		SetDlgItemInt(hdlg, DRV_CACHE_SIZE, globals.fetch_max, FALSE);
+		SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, globals.max_varchar_size, FALSE);
+		SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, globals.max_longvarchar_size, TRUE);
 
-			SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes);
+		SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes);
 
-			/* Driver Connection Settings */
-			SetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings);
+		/*	Driver Connection Settings */
+		SetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings);
 
-			break;
+		break; 
+
+	case WM_COMMAND:
+		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
+		case IDOK:
 
-		case WM_COMMAND:
-			switch (GET_WM_COMMAND_ID(wParam, lParam))
-			{
-				case IDOK:
-
-					globals.commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
-					globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
-					globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
-					globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
-					globals.onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
-					globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
-
-					/* Unknown (Default) Data Type sizes */
-					if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_MAX))
-						globals.unknown_sizes = UNKNOWNS_AS_MAX;
-					else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_DONTKNOW))
-						globals.unknown_sizes = UNKNOWNS_AS_DONTKNOW;
-					else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_LONGEST))
-						globals.unknown_sizes = UNKNOWNS_AS_LONGEST;
-					else
-						globals.unknown_sizes = UNKNOWNS_AS_MAX;
-
-					globals.text_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_TEXT_LONGVARCHAR);
-					globals.unknowns_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_UNKNOWNS_LONGVARCHAR);
-					globals.bools_as_char = IsDlgButtonChecked(hdlg, DRV_BOOLS_CHAR);
-
-					globals.parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
-
-					globals.cancel_as_freestmt = IsDlgButtonChecked(hdlg, DRV_CANCELASFREESTMT);
-
-					globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
-					globals.max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
-					globals.max_longvarchar_size = GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE);		/* allows for
-																												 * SQL_NO_TOTAL */
-
-					GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, sizeof(globals.extra_systable_prefixes));
-
-					/* Driver Connection Settings */
-					GetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings, sizeof(globals.conn_settings));
-
-					updateGlobals();
-
-					/* fall through */
-
-				case IDCANCEL:
-					EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
-					return TRUE;
-
-				case IDDEFAULTS:
-					CheckDlgButton(hdlg, DRV_COMMLOG, DEFAULT_COMMLOG);
-					CheckDlgButton(hdlg, DRV_OPTIMIZER, DEFAULT_OPTIMIZER);
-					CheckDlgButton(hdlg, DRV_KSQO, DEFAULT_KSQO);
-					CheckDlgButton(hdlg, DRV_UNIQUEINDEX, DEFAULT_UNIQUEINDEX);
-					CheckDlgButton(hdlg, DRV_READONLY, DEFAULT_READONLY);
-					CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, DEFAULT_USEDECLAREFETCH);
-
-					CheckDlgButton(hdlg, DRV_PARSE, DEFAULT_PARSE);
-					CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, DEFAULT_CANCELASFREESTMT);
-
-					/* Unknown Sizes */
-					CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 0);
-					CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 0);
-					CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 0);
-					switch (DEFAULT_UNKNOWNSIZES)
-					{
-						case UNKNOWNS_AS_DONTKNOW:
-							CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
-							break;
-						case UNKNOWNS_AS_LONGEST:
-							CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
-							break;
-						case UNKNOWNS_AS_MAX:
-							CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
-							break;
-					}
-
-					CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, DEFAULT_TEXTASLONGVARCHAR);
-					CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, DEFAULT_UNKNOWNSASLONGVARCHAR);
-					CheckDlgButton(hdlg, DRV_BOOLS_CHAR, DEFAULT_BOOLSASCHAR);
-
-					SetDlgItemInt(hdlg, DRV_CACHE_SIZE, FETCH_MAX, FALSE);
-					SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, MAX_VARCHAR_SIZE, FALSE);
-					SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, TEXT_FIELD_SIZE, TRUE);
-
-					SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, DEFAULT_EXTRASYSTABLEPREFIXES);
-
-					/* Driver Connection Settings */
-					SetDlgItemText(hdlg, DRV_CONNSETTINGS, "");
-
-					break;
+			globals.commlog = IsDlgButtonChecked(hdlg, DRV_COMMLOG);
+			globals.disable_optimizer = IsDlgButtonChecked(hdlg, DRV_OPTIMIZER);
+			globals.ksqo = IsDlgButtonChecked(hdlg, DRV_KSQO);
+			globals.unique_index = IsDlgButtonChecked(hdlg, DRV_UNIQUEINDEX);
+			globals.onlyread = IsDlgButtonChecked(hdlg, DRV_READONLY);
+			globals.use_declarefetch = IsDlgButtonChecked(hdlg, DRV_USEDECLAREFETCH);
+
+			/*	Unknown (Default) Data Type sizes */
+			if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_MAX))
+				globals.unknown_sizes = UNKNOWNS_AS_MAX;
+			else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_DONTKNOW))
+				globals.unknown_sizes = UNKNOWNS_AS_DONTKNOW;
+			else if (IsDlgButtonChecked(hdlg, DRV_UNKNOWN_LONGEST))
+				globals.unknown_sizes = UNKNOWNS_AS_LONGEST;
+			else
+				globals.unknown_sizes = UNKNOWNS_AS_MAX;
+
+			globals.text_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_TEXT_LONGVARCHAR);
+			globals.unknowns_as_longvarchar = IsDlgButtonChecked(hdlg, DRV_UNKNOWNS_LONGVARCHAR);
+			globals.bools_as_char = IsDlgButtonChecked(hdlg, DRV_BOOLS_CHAR);
+
+			globals.parse = IsDlgButtonChecked(hdlg, DRV_PARSE);
+
+			globals.cancel_as_freestmt = IsDlgButtonChecked(hdlg, DRV_CANCELASFREESTMT);
+
+			globals.fetch_max = GetDlgItemInt(hdlg, DRV_CACHE_SIZE, NULL, FALSE);
+			globals.max_varchar_size = GetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, NULL, FALSE);
+			globals.max_longvarchar_size= GetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, NULL, TRUE);	/* allows for SQL_NO_TOTAL */
+
+			GetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, sizeof(globals.extra_systable_prefixes));
+
+			/*	Driver Connection Settings */
+			GetDlgItemText(hdlg, DRV_CONNSETTINGS, globals.conn_settings, sizeof(globals.conn_settings));
+
+			updateGlobals();
+
+			/*	fall through */
+
+		case IDCANCEL:
+			EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+			return TRUE;
+
+		case IDDEFAULTS:
+			CheckDlgButton(hdlg, DRV_COMMLOG, DEFAULT_COMMLOG);
+			CheckDlgButton(hdlg, DRV_OPTIMIZER, DEFAULT_OPTIMIZER);
+			CheckDlgButton(hdlg, DRV_KSQO, DEFAULT_KSQO);
+			CheckDlgButton(hdlg, DRV_UNIQUEINDEX, DEFAULT_UNIQUEINDEX);
+			CheckDlgButton(hdlg, DRV_READONLY, DEFAULT_READONLY);
+			CheckDlgButton(hdlg, DRV_USEDECLAREFETCH, DEFAULT_USEDECLAREFETCH);
+	
+			CheckDlgButton(hdlg, DRV_PARSE, DEFAULT_PARSE);
+			CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, DEFAULT_CANCELASFREESTMT);
+
+			/*	Unknown Sizes */
+			CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 0);
+			CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 0);
+			CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 0);
+			switch(DEFAULT_UNKNOWNSIZES) {
+			case UNKNOWNS_AS_DONTKNOW:
+				CheckDlgButton(hdlg, DRV_UNKNOWN_DONTKNOW, 1);
+				break;
+			case UNKNOWNS_AS_LONGEST:
+				CheckDlgButton(hdlg, DRV_UNKNOWN_LONGEST, 1);
+				break;
+			case UNKNOWNS_AS_MAX:
+				CheckDlgButton(hdlg, DRV_UNKNOWN_MAX, 1);
+				break;
 			}
+
+			CheckDlgButton(hdlg, DRV_TEXT_LONGVARCHAR, DEFAULT_TEXTASLONGVARCHAR);
+			CheckDlgButton(hdlg, DRV_UNKNOWNS_LONGVARCHAR, DEFAULT_UNKNOWNSASLONGVARCHAR);
+			CheckDlgButton(hdlg, DRV_BOOLS_CHAR, DEFAULT_BOOLSASCHAR);
+
+			SetDlgItemInt(hdlg, DRV_CACHE_SIZE, FETCH_MAX, FALSE);
+			SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, MAX_VARCHAR_SIZE, FALSE);
+			SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, TEXT_FIELD_SIZE, TRUE);
+
+			SetDlgItemText(hdlg, DRV_EXTRASYSTABLEPREFIXES, DEFAULT_EXTRASYSTABLEPREFIXES);
+
+			/*	Driver Connection Settings */
+			SetDlgItemText(hdlg, DRV_CONNSETTINGS, "");
+
+			break;
+		}
+
 	}
 
 	return FALSE;
 }
 
-int			CALLBACK
-ds_optionsProc(HWND hdlg,
-			   WORD wMsg,
-			   WPARAM wParam,
-			   LPARAM lParam)
+int CALLBACK ds_optionsProc(HWND   hdlg,
+                           WORD   wMsg,
+                           WPARAM wParam,
+                           LPARAM lParam)
 {
-	ConnInfo   *ci;
-	char		buf[128];
-
-	switch (wMsg)
-	{
-		case WM_INITDIALOG:
-			ci = (ConnInfo *) lParam;
-			SetWindowLong(hdlg, DWL_USER, lParam);		/* save for OK */
-
-			/* Change window caption */
-			if (ci->driver[0])
-				SetWindowText(hdlg, "Advanced Options (Connection)");
-			else
-			{
-				sprintf(buf, "Advanced Options (%s)", ci->dsn);
-				SetWindowText(hdlg, buf);
-			}
-
-			/* Readonly */
-			CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
-
-			/* Protocol */
+ConnInfo *ci;
+char buf[128];
+
+	switch (wMsg) {
+	case WM_INITDIALOG:
+		ci = (ConnInfo *) lParam;		
+		SetWindowLong(hdlg, DWL_USER, lParam);	/* save for OK */
+
+		/*	Change window caption */
+		if (ci->driver[0])
+			SetWindowText(hdlg, "Advanced Options (Connection)");
+		else {
+			sprintf(buf, "Advanced Options (%s)", ci->dsn);
+			SetWindowText(hdlg, buf);
+		}
+
+		/*	Readonly */
+		CheckDlgButton(hdlg, DS_READONLY, atoi(ci->onlyread));
+
+		/*	Protocol */
+		if (strncmp(ci->protocol, PG62, strlen(PG62)) == 0)
+			CheckDlgButton(hdlg, DS_PG62, 1);
+		else if (strncmp(ci->protocol, PG63, strlen(PG63)) == 0)
+			CheckDlgButton(hdlg, DS_PG63, 1);
+		else /* latest */
 			CheckDlgButton(hdlg, DS_PG64, 1);
 
 
 
-			CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
-			CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
-			CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
-			CheckDlgButton(hdlg, DS_SHOWSYSTEMTABLES, atoi(ci->show_system_tables));
+		CheckDlgButton(hdlg, DS_SHOWOIDCOLUMN, atoi(ci->show_oid_column));
+		CheckDlgButton(hdlg, DS_FAKEOIDINDEX, atoi(ci->fake_oid_index));
+		CheckDlgButton(hdlg, DS_ROWVERSIONING, atoi(ci->row_versioning));
+		CheckDlgButton(hdlg, DS_SHOWSYSTEMTABLES, atoi(ci->show_system_tables));
 
-			EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
+		EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
 
-			/* Datasource Connection Settings */
-			SetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings);
-			break;
+		/*	Datasource Connection Settings */
+		SetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings);
+		break; 
 
 
-		case WM_COMMAND:
-			switch (GET_WM_COMMAND_ID(wParam, lParam))
-			{
-				case DS_SHOWOIDCOLUMN:
-					mylog("WM_COMMAND: DS_SHOWOIDCOLUMN\n");
-					EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
-					return TRUE;
+	case WM_COMMAND:
+		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
+		case DS_SHOWOIDCOLUMN:
+			mylog("WM_COMMAND: DS_SHOWOIDCOLUMN\n");
+			EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
+			return TRUE;
 
 
-				case IDOK:
+		case IDOK: 
 
-					ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
-					mylog("IDOK: got ci = %u\n", ci);
+			ci = (ConnInfo *)GetWindowLong(hdlg, DWL_USER);
+			mylog("IDOK: got ci = %u\n", ci);
 
-					/* Readonly */
-					sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
+			/*	Readonly */
+			sprintf(ci->onlyread, "%d", IsDlgButtonChecked(hdlg, DS_READONLY));
 
-					/* Protocol */
-					strcpy(ci->protocol, PG64);
+			/*	Protocol */
+			if ( IsDlgButtonChecked(hdlg, DS_PG62))
+				strcpy(ci->protocol, PG62);
+			else if ( IsDlgButtonChecked(hdlg, DS_PG63))
+				strcpy(ci->protocol, PG63);
+			else	/* latest */
+				strcpy(ci->protocol, PG64);
 
-					sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
+			sprintf(ci->show_system_tables, "%d", IsDlgButtonChecked(hdlg, DS_SHOWSYSTEMTABLES));
 
-					sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
+			sprintf(ci->row_versioning, "%d", IsDlgButtonChecked(hdlg, DS_ROWVERSIONING));
 
-					/* OID Options */
-					sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
-					sprintf(ci->show_oid_column, "%d", IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
+			/*	OID Options*/
+			sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
+			sprintf(ci->show_oid_column, "%d", IsDlgButtonChecked(hdlg, DS_SHOWOIDCOLUMN));
 
-					/* Datasource Connection Settings */
-					GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
+			/*	Datasource Connection Settings */
+			GetDlgItemText(hdlg, DS_CONNSETTINGS, ci->conn_settings, sizeof(ci->conn_settings));
 
 
-					/* fall through */
+			/*	fall through */
 
-				case IDCANCEL:
-					EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
-					return TRUE;
-			}
+		case IDCANCEL:
+			EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+			return TRUE;
+		}
 	}
 
 	return FALSE;
 }
 
-#endif	 /* WIN32 */
+#endif	/* WIN32 */
 
 void
 makeConnectString(char *connect_string, ConnInfo *ci)
 {
-	char		got_dsn = (ci->dsn[0] != '\0');
-	char		encoded_conn_settings[LARGE_REGISTRY_LEN];
+char got_dsn = (ci->dsn[0] != '\0');
+char encoded_conn_settings[LARGE_REGISTRY_LEN];
 
-	/* fundamental info */
+	/*	fundamental info */
 	sprintf(connect_string, "%s=%s;DATABASE=%s;SERVER=%s;PORT=%s;UID=%s;PWD=%s",
-			got_dsn ? "DSN" : "DRIVER",
-			got_dsn ? ci->dsn : ci->driver,
-			ci->database,
-			ci->server,
-			ci->port,
-			ci->username,
-			ci->password);
+		got_dsn ? "DSN" : "DRIVER", 
+		got_dsn ? ci->dsn : ci->driver,
+		ci->database,
+		ci->server,
+		ci->port,
+		ci->username,
+		ci->password);
 
 	encode(ci->conn_settings, encoded_conn_settings);
 
-	/* extra info */
-	sprintf(&connect_string[strlen(connect_string)],
-			";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s",
-			ci->onlyread,
-			ci->protocol,
-			ci->fake_oid_index,
-			ci->show_oid_column,
-			ci->row_versioning,
-			ci->show_system_tables,
-			encoded_conn_settings);
+	/*	extra info */
+	sprintf(&connect_string[strlen(connect_string)], 
+		";READONLY=%s;PROTOCOL=%s;FAKEOIDINDEX=%s;SHOWOIDCOLUMN=%s;ROWVERSIONING=%s;SHOWSYSTEMTABLES=%s;CONNSETTINGS=%s", 
+		ci->onlyread,
+		ci->protocol,
+		ci->fake_oid_index,
+		ci->show_oid_column,
+		ci->row_versioning,
+		ci->show_system_tables,
+		encoded_conn_settings);
 }
 
 void
 copyAttributes(ConnInfo *ci, char *attribute, char *value)
 {
-	if (stricmp(attribute, "DSN") == 0)
+
+	if(stricmp(attribute, "DSN") == 0)
 		strcpy(ci->dsn, value);
 
-	else if (stricmp(attribute, "driver") == 0)
+	else if(stricmp(attribute, "driver") == 0)
 		strcpy(ci->driver, value);
 
-	else if (stricmp(attribute, INI_DATABASE) == 0)
+	else if(stricmp(attribute, INI_DATABASE) == 0)
 		strcpy(ci->database, value);
 
-	else if (stricmp(attribute, INI_SERVER) == 0 || stricmp(attribute, "server") == 0)
+	else if(stricmp(attribute, INI_SERVER) == 0 || stricmp(attribute, "server") == 0)
 		strcpy(ci->server, value);
 
-	else if (stricmp(attribute, INI_USER) == 0 || stricmp(attribute, "uid") == 0)
+	else if(stricmp(attribute, INI_USER) == 0 || stricmp(attribute, "uid") == 0)
 		strcpy(ci->username, value);
 
-	else if (stricmp(attribute, INI_PASSWORD) == 0 || stricmp(attribute, "pwd") == 0)
+	else if(stricmp(attribute, INI_PASSWORD) == 0 || stricmp(attribute, "pwd") == 0)
 		strcpy(ci->password, value);
 
-	else if (stricmp(attribute, INI_PORT) == 0)
+	else if(stricmp(attribute, INI_PORT) == 0)
 		strcpy(ci->port, value);
 
 	else if (stricmp(attribute, INI_READONLY) == 0)
@@ -389,13 +387,13 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
 	else if (stricmp(attribute, INI_SHOWSYSTEMTABLES) == 0)
 		strcpy(ci->show_system_tables, value);
 
-	else if (stricmp(attribute, INI_CONNSETTINGS) == 0)
-	{
+	else if (stricmp(attribute, INI_CONNSETTINGS) == 0) {
 		decode(value, ci->conn_settings);
 		/* strcpy(ci->conn_settings, value); */
 	}
 
-	mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server, ci->database, ci->username, ci->password, ci->port, ci->onlyread, ci->protocol, ci->conn_settings);
+	mylog("copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')\n", ci->dsn, ci->server,ci->database,ci->username,ci->password,ci->port,ci->onlyread,ci->protocol,ci->conn_settings);
+
 }
 
 void
@@ -424,99 +422,97 @@ getDSNdefaults(ConnInfo *ci)
 }
 
 
-void
+void 
 getDSNinfo(ConnInfo *ci, char overwrite)
 {
-	char	   *DSN = ci->dsn;
-	char		encoded_conn_settings[LARGE_REGISTRY_LEN];
+char *DSN = ci->dsn;
+char encoded_conn_settings[LARGE_REGISTRY_LEN];
 
 /*	If a driver keyword was present, then dont use a DSN and return. */
 /*	If DSN is null and no driver, then use the default datasource. */
-	if (DSN[0] == '\0')
-	{
-		if (ci->driver[0] != '\0')
+	if ( DSN[0] == '\0') {
+		if ( ci->driver[0] != '\0')
 			return;
 		else
 			strcpy(DSN, INI_DSN);
 	}
 
 	/* brute-force chop off trailing blanks... */
-	while (*(DSN + strlen(DSN) - 1) == ' ')
-		*(DSN + strlen(DSN) - 1) = '\0';
+	while (*(DSN+strlen(DSN)-1) == ' ') *(DSN+strlen(DSN)-1) = '\0';
 
-	/* Proceed with getting info for the given DSN. */
+	/*	Proceed with getting info for the given DSN. */
 
-	if (ci->desc[0] == '\0' || overwrite)
+	if ( ci->desc[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_KDESC, "", ci->desc, sizeof(ci->desc), ODBC_INI);
 
-	if (ci->server[0] == '\0' || overwrite)
+	if ( ci->server[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_SERVER, "", ci->server, sizeof(ci->server), ODBC_INI);
 
-	if (ci->database[0] == '\0' || overwrite)
-		SQLGetPrivateProfileString(DSN, INI_DATABASE, "", ci->database, sizeof(ci->database), ODBC_INI);
+	if ( ci->database[0] == '\0' || overwrite)
+	    SQLGetPrivateProfileString(DSN, INI_DATABASE, "", ci->database, sizeof(ci->database), ODBC_INI);
 
-	if (ci->username[0] == '\0' || overwrite)
+	if ( ci->username[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_USER, "", ci->username, sizeof(ci->username), ODBC_INI);
 
-	if (ci->password[0] == '\0' || overwrite)
+	if ( ci->password[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_PASSWORD, "", ci->password, sizeof(ci->password), ODBC_INI);
 
-	if (ci->port[0] == '\0' || overwrite)
+	if ( ci->port[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_PORT, "", ci->port, sizeof(ci->port), ODBC_INI);
 
-	if (ci->onlyread[0] == '\0' || overwrite)
+	if ( ci->onlyread[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_READONLY, "", ci->onlyread, sizeof(ci->onlyread), ODBC_INI);
 
-	if (ci->show_oid_column[0] == '\0' || overwrite)
+	if ( ci->show_oid_column[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_SHOWOIDCOLUMN, "", ci->show_oid_column, sizeof(ci->show_oid_column), ODBC_INI);
 
-	if (ci->fake_oid_index[0] == '\0' || overwrite)
+	if ( ci->fake_oid_index[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_FAKEOIDINDEX, "", ci->fake_oid_index, sizeof(ci->fake_oid_index), ODBC_INI);
 
-	if (ci->row_versioning[0] == '\0' || overwrite)
+	if ( ci->row_versioning[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_ROWVERSIONING, "", ci->row_versioning, sizeof(ci->row_versioning), ODBC_INI);
 
-	if (ci->show_system_tables[0] == '\0' || overwrite)
+	if ( ci->show_system_tables[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_SHOWSYSTEMTABLES, "", ci->show_system_tables, sizeof(ci->show_system_tables), ODBC_INI);
 
-	if (ci->protocol[0] == '\0' || overwrite)
+	if ( ci->protocol[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_PROTOCOL, "", ci->protocol, sizeof(ci->protocol), ODBC_INI);
 
-	if (ci->conn_settings[0] == '\0' || overwrite)
-	{
+	if ( ci->conn_settings[0] == '\0' || overwrite) {
 		SQLGetPrivateProfileString(DSN, INI_CONNSETTINGS, "", encoded_conn_settings, sizeof(encoded_conn_settings), ODBC_INI);
 		decode(encoded_conn_settings, ci->conn_settings);
 	}
 
-	if (ci->translation_dll[0] == '\0' || overwrite)
+	if ( ci->translation_dll[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_TRANSLATIONDLL, "", ci->translation_dll, sizeof(ci->translation_dll), ODBC_INI);
 
-	if (ci->translation_option[0] == '\0' || overwrite)
+	if ( ci->translation_option[0] == '\0' || overwrite)
 		SQLGetPrivateProfileString(DSN, INI_TRANSLATIONOPTION, "", ci->translation_option, sizeof(ci->translation_option), ODBC_INI);
 
 
-	/* Allow override of odbcinst.ini parameters here */
+	/*	Allow override of odbcinst.ini parameters here */
 	getGlobalDefaults(DSN, ODBC_INI, TRUE);
 
 
-	qlog("DSN info: DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n",
-		 DSN,
-		 ci->server,
-		 ci->port,
-		 ci->database,
-		 ci->username,
-		 ci->password);
+	qlog("DSN info: DSN='%s',server='%s',port='%s',dbase='%s',user='%s',passwd='%s'\n", 
+		DSN, 
+		ci->server,
+		ci->port,
+		ci->database,
+		ci->username,
+		ci->password);
 	qlog("          onlyread='%s',protocol='%s',showoid='%s',fakeoidindex='%s',showsystable='%s'\n",
-		 ci->onlyread,
-		 ci->protocol,
-		 ci->show_oid_column,
-		 ci->fake_oid_index,
-		 ci->show_system_tables);
+		ci->onlyread,
+		ci->protocol,
+		ci->show_oid_column,
+		ci->fake_oid_index,
+		ci->show_system_tables);
 	qlog("          conn_settings='%s'\n",
-		 ci->conn_settings);
+		ci->conn_settings);
 	qlog("          translation_dll='%s',translation_option='%s'\n",
-		 ci->translation_dll,
-		 ci->translation_option);
+		ci->translation_dll,
+		ci->translation_option);
+
 }
 
 
@@ -524,358 +520,347 @@ getDSNinfo(ConnInfo *ci, char overwrite)
 void
 writeDSNinfo(ConnInfo *ci)
 {
-	char	   *DSN = ci->dsn;
-	char		encoded_conn_settings[LARGE_REGISTRY_LEN];
+char *DSN = ci->dsn;
+char encoded_conn_settings[LARGE_REGISTRY_LEN];
+
+		encode(ci->conn_settings, encoded_conn_settings);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_KDESC,
+			ci->desc,
+			ODBC_INI);
+                        
+		SQLWritePrivateProfileString(DSN,
+			INI_DATABASE,
+			ci->database,
+			ODBC_INI);
+                        
+		SQLWritePrivateProfileString(DSN,
+			INI_SERVER,
+			ci->server,
+			ODBC_INI);
 
-	encode(ci->conn_settings, encoded_conn_settings);
+		SQLWritePrivateProfileString(DSN,
+			INI_PORT,
+			ci->port,
+			ODBC_INI);
 
-	SQLWritePrivateProfileString(DSN,
-								 INI_KDESC,
-								 ci->desc,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_DATABASE,
-								 ci->database,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_SERVER,
-								 ci->server,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_PORT,
-								 ci->port,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_USER,
-								 ci->username,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_PASSWORD,
-								 ci->password,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_READONLY,
-								 ci->onlyread,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_SHOWOIDCOLUMN,
-								 ci->show_oid_column,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_FAKEOIDINDEX,
-								 ci->fake_oid_index,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_ROWVERSIONING,
-								 ci->row_versioning,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_SHOWSYSTEMTABLES,
-								 ci->show_system_tables,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_PROTOCOL,
-								 ci->protocol,
-								 ODBC_INI);
-
-	SQLWritePrivateProfileString(DSN,
-								 INI_CONNSETTINGS,
-								 encoded_conn_settings,
-								 ODBC_INI);
+		SQLWritePrivateProfileString(DSN,
+			INI_USER,
+			ci->username,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_PASSWORD,
+			ci->password,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_READONLY,
+			ci->onlyread,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_SHOWOIDCOLUMN,
+			ci->show_oid_column,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_FAKEOIDINDEX,
+			ci->fake_oid_index,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_ROWVERSIONING,
+			ci->row_versioning,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_SHOWSYSTEMTABLES,
+			ci->show_system_tables,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_PROTOCOL,
+			ci->protocol,
+			ODBC_INI);
+
+		SQLWritePrivateProfileString(DSN,
+			INI_CONNSETTINGS,
+			encoded_conn_settings,
+			ODBC_INI);
 }
 
 
 /*	This function reads the ODBCINST.INI portion of
 	the registry and gets any driver defaults.
 */
-void
-getGlobalDefaults(char *section, char *filename, char override)
+void getGlobalDefaults(char *section, char *filename, char override)
 {
-	char		temp[256];
+char temp[256];
 
 
-	/* Fetch Count is stored in driver section */
-	SQLGetPrivateProfileString(section, INI_FETCH, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
-	{
+    /*	Fetch Count is stored in driver section */
+    SQLGetPrivateProfileString(section, INI_FETCH, "",
+                            temp, sizeof(temp), filename);
+	if ( temp[0] ) {
 		globals.fetch_max = atoi(temp);
-		/* sanity check if using cursors */
+		/*	sanity check if using cursors */
 		if (globals.fetch_max <= 0)
 			globals.fetch_max = FETCH_MAX;
 	}
-	else if (!override)
+	else if ( ! override)
 		globals.fetch_max = FETCH_MAX;
 
 
-	/* Socket Buffersize is stored in driver section */
-	SQLGetPrivateProfileString(section, INI_SOCKET, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Socket Buffersize is stored in driver section */
+    SQLGetPrivateProfileString(section, INI_SOCKET, "",
+                            temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.socket_buffersize = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.socket_buffersize = SOCK_BUFFER_SIZE;
 
 
-	/* Debug is stored in the driver section */
-	SQLGetPrivateProfileString(section, INI_DEBUG, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Debug is stored in the driver section */
+	SQLGetPrivateProfileString(section, INI_DEBUG, "", 
+							temp, sizeof(temp), filename);
+	if ( temp[0] )
 		globals.debug = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.debug = DEFAULT_DEBUG;
 
 
-	/* CommLog is stored in the driver section */
-	SQLGetPrivateProfileString(section, INI_COMMLOG, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	CommLog is stored in the driver section */
+	SQLGetPrivateProfileString(section, INI_COMMLOG, "", 
+							temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.commlog = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.commlog = DEFAULT_COMMLOG;
 
 
-	/* Optimizer is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_OPTIMIZER, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Optimizer is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_OPTIMIZER, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.disable_optimizer = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.disable_optimizer = DEFAULT_OPTIMIZER;
 
-	/* KSQO is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_KSQO, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	KSQO is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_KSQO, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.ksqo = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.ksqo = DEFAULT_KSQO;
 
-	/* Recognize Unique Index is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Recognize Unique Index is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_UNIQUEINDEX, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.unique_index = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.unique_index = DEFAULT_UNIQUEINDEX;
 
 
-	/* Unknown Sizes is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Unknown Sizes is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_UNKNOWNSIZES, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] )
 		globals.unknown_sizes = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.unknown_sizes = DEFAULT_UNKNOWNSIZES;
 
 
-	/* Lie about supported functions? */
-	SQLGetPrivateProfileString(section, INI_LIE, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Lie about supported functions? */
+	SQLGetPrivateProfileString(section, INI_LIE, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.lie = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.lie = DEFAULT_LIE;
 
-	/* Parse statements */
-	SQLGetPrivateProfileString(section, INI_PARSE, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Parse statements */
+	SQLGetPrivateProfileString(section, INI_PARSE, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.parse = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.parse = DEFAULT_PARSE;
 
-	/* SQLCancel calls SQLFreeStmt in Driver Manager */
-	SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	SQLCancel calls SQLFreeStmt in Driver Manager */
+	SQLGetPrivateProfileString(section, INI_CANCELASFREESTMT, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.cancel_as_freestmt = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.cancel_as_freestmt = DEFAULT_CANCELASFREESTMT;
 
 
 
-	/* UseDeclareFetch is stored in the driver section only */
-	SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	UseDeclareFetch is stored in the driver section only */
+	SQLGetPrivateProfileString(section, INI_USEDECLAREFETCH, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.use_declarefetch = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.use_declarefetch = DEFAULT_USEDECLAREFETCH;
 
 
-	/* Max Varchar Size */
-	SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Max Varchar Size */
+	SQLGetPrivateProfileString(section, INI_MAXVARCHARSIZE, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.max_varchar_size = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.max_varchar_size = MAX_VARCHAR_SIZE;
 
-	/* Max TextField Size */
-	SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Max TextField Size */
+	SQLGetPrivateProfileString(section, INI_MAXLONGVARCHARSIZE, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.max_longvarchar_size = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.max_longvarchar_size = TEXT_FIELD_SIZE;
 
-	/* Text As LongVarchar	*/
-	SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Text As LongVarchar  */
+	SQLGetPrivateProfileString(section, INI_TEXTASLONGVARCHAR, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.text_as_longvarchar = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.text_as_longvarchar = DEFAULT_TEXTASLONGVARCHAR;
 
-	/* Unknowns As LongVarchar	*/
-	SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Unknowns As LongVarchar  */
+	SQLGetPrivateProfileString(section, INI_UNKNOWNSASLONGVARCHAR, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.unknowns_as_longvarchar = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.unknowns_as_longvarchar = DEFAULT_UNKNOWNSASLONGVARCHAR;
 
-	/* Bools As Char */
-	SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "",
-							   temp, sizeof(temp), filename);
-	if (temp[0])
+	/*	Bools As Char */
+	SQLGetPrivateProfileString(section, INI_BOOLSASCHAR, "", 
+				temp, sizeof(temp), filename);
+	if ( temp[0] ) 
 		globals.bools_as_char = atoi(temp);
-	else if (!override)
+	else if ( ! override)
 		globals.bools_as_char = DEFAULT_BOOLSASCHAR;
 
-	/* Extra Systable prefixes */
-
-	/*
-	 * Use @@@ to distinguish between blank extra prefixes and no key
-	 * entry
-	 */
-	SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@",
-							   temp, sizeof(temp), filename);
-	if (strcmp(temp, "@@@"))
+	/*	Extra Systable prefixes */
+	/*	Use @@@ to distinguish between blank extra prefixes and no key entry */
+	SQLGetPrivateProfileString(section, INI_EXTRASYSTABLEPREFIXES, "@@@", 
+			temp, sizeof(temp), filename);
+	if ( strcmp(temp, "@@@" ))	
 		strcpy(globals.extra_systable_prefixes, temp);
-	else if (!override)
+	else if ( ! override)
 		strcpy(globals.extra_systable_prefixes, DEFAULT_EXTRASYSTABLEPREFIXES);
 
 	mylog("globals.extra_systable_prefixes = '%s'\n", globals.extra_systable_prefixes);
 
 
-	/* Dont allow override of an override! */
-	if (!override)
-	{
+	/*	Dont allow override of an override! */
+	if ( ! override) {
 
-		/*
-		 * ConnSettings is stored in the driver section and per datasource
-		 * for override
-		 */
-		SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "",
-		 globals.conn_settings, sizeof(globals.conn_settings), filename);
+		/*	ConnSettings is stored in the driver section and per datasource for override */
+		SQLGetPrivateProfileString(section, INI_CONNSETTINGS, "", 
+					globals.conn_settings, sizeof(globals.conn_settings), filename);
 
-		/* Default state for future DSN's Readonly attribute */
-		SQLGetPrivateProfileString(section, INI_READONLY, "",
-								   temp, sizeof(temp), filename);
-		if (temp[0])
+		/*	Default state for future DSN's Readonly attribute */
+		SQLGetPrivateProfileString(section, INI_READONLY, "", 
+					temp, sizeof(temp), filename);
+		if ( temp[0] ) 
 			globals.onlyread = atoi(temp);
 		else
 			globals.onlyread = DEFAULT_READONLY;
 
-		/*
-		 * Default state for future DSN's protocol attribute This isn't a
-		 * real driver option YET.	This is more intended for
-		 * customization from the install.
-		 */
-		SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@",
-								   temp, sizeof(temp), filename);
-		if (strcmp(temp, "@@@"))
+		/*	Default state for future DSN's protocol attribute
+			This isn't a real driver option YET.  This is more
+			intended for customization from the install.
+		*/
+		SQLGetPrivateProfileString(section, INI_PROTOCOL, "@@@", 
+				temp, sizeof(temp), filename);
+		if ( strcmp(temp, "@@@" ))	
 			strcpy(globals.protocol, temp);
-		else
+		else 
 			strcpy(globals.protocol, DEFAULT_PROTOCOL);
+	
 	}
 }
 
 
 /*	This function writes any global parameters (that can be manipulated)
-	to the ODBCINST.INI portion of the registry
+	to the ODBCINST.INI portion of the registry 
 */
-void
-updateGlobals(void)
+void updateGlobals(void)
 {
-	char		tmp[128];
+char tmp[128];
 
 	sprintf(tmp, "%d", globals.fetch_max);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_FETCH, tmp, ODBCINST_INI);
+		INI_FETCH, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.commlog);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_COMMLOG, tmp, ODBCINST_INI);
+		INI_COMMLOG, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.disable_optimizer);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_OPTIMIZER, tmp, ODBCINST_INI);
+		INI_OPTIMIZER, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.ksqo);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_KSQO, tmp, ODBCINST_INI);
+		INI_KSQO, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.unique_index);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_UNIQUEINDEX, tmp, ODBCINST_INI);
+		INI_UNIQUEINDEX, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.onlyread);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_READONLY, tmp, ODBCINST_INI);
+		INI_READONLY, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.use_declarefetch);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_USEDECLAREFETCH, tmp, ODBCINST_INI);
+		INI_USEDECLAREFETCH, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.unknown_sizes);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_UNKNOWNSIZES, tmp, ODBCINST_INI);
+		INI_UNKNOWNSIZES, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.text_as_longvarchar);
 	SQLWritePrivateProfileString(DBMS_NAME,
-							   INI_TEXTASLONGVARCHAR, tmp, ODBCINST_INI);
+		INI_TEXTASLONGVARCHAR, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.unknowns_as_longvarchar);
 	SQLWritePrivateProfileString(DBMS_NAME,
-						   INI_UNKNOWNSASLONGVARCHAR, tmp, ODBCINST_INI);
+		INI_UNKNOWNSASLONGVARCHAR, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.bools_as_char);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_BOOLSASCHAR, tmp, ODBCINST_INI);
+		INI_BOOLSASCHAR, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.parse);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_PARSE, tmp, ODBCINST_INI);
+		INI_PARSE, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.cancel_as_freestmt);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_CANCELASFREESTMT, tmp, ODBCINST_INI);
+		INI_CANCELASFREESTMT, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.max_varchar_size);
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_MAXVARCHARSIZE, tmp, ODBCINST_INI);
+		INI_MAXVARCHARSIZE, tmp, ODBCINST_INI);
 
 	sprintf(tmp, "%d", globals.max_longvarchar_size);
 	SQLWritePrivateProfileString(DBMS_NAME,
-							  INI_MAXLONGVARCHARSIZE, tmp, ODBCINST_INI);
+		INI_MAXLONGVARCHARSIZE, tmp, ODBCINST_INI);
 
 	SQLWritePrivateProfileString(DBMS_NAME,
-								 INI_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, ODBCINST_INI);
+		INI_EXTRASYSTABLEPREFIXES, globals.extra_systable_prefixes, ODBCINST_INI);
 
 	SQLWritePrivateProfileString(DBMS_NAME,
-				  INI_CONNSETTINGS, globals.conn_settings, ODBCINST_INI);
+		INI_CONNSETTINGS, globals.conn_settings, ODBCINST_INI);
 }
diff --git a/src/interfaces/odbc/dlg_specific.h b/src/interfaces/odbc/dlg_specific.h
index 3d493089540728883b4d0fb4479436c81cab6285..5be8b4fa50801acec880dc19f0ac0feb59e79b61 100644
--- a/src/interfaces/odbc/dlg_specific.h
+++ b/src/interfaces/odbc/dlg_specific.h
@@ -1,9 +1,9 @@
 
-/* File:			dlg_specific.h
+/* File:            dlg_specific.h
  *
- * Description:		See "dlg_specific.c"
+ * Description:     See "dlg_specific.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -31,50 +31,41 @@
 
 /* INI File Stuff */
 #ifndef WIN32
-#define ODBC_INI			".odbc.ini"
-#ifdef ODBCINSTDIR
-#define ODBCINST_INI		ODBCINSTDIR "/odbcinst.ini"
-#else
-#define ODBCINST_INI		"/etc/odbcinst.ini"
-#warning "location of odbcinst.ini file defaulted to /etc"
-#endif
-#else							/* WIN32 */
-#define ODBC_INI			"ODBC.INI"	/* ODBC initialization file */
-#define ODBCINST_INI		"ODBCINST.INI"		/* ODBC Installation file */
-#endif	 /* WIN32 */
-
-
-#define INI_DSN				DBMS_NAME	/* Name of default Datasource in
-										 * ini file (not used?) */
-#define INI_KDESC			"Description"		/* Data source description */
-#define INI_SERVER			"Servername"		/* Name of Server running
-												 * the Postgres service */
-#define INI_PORT			"Port"		/* Port on which the Postmaster is
-										 * listening */
-#define INI_DATABASE		"Database"	/* Database Name */
-#define INI_USER			"Username"	/* Default User Name */
-#define INI_PASSWORD		"Password"	/* Default Password */
-#define INI_DEBUG			"Debug"		/* Debug flag */
-#define INI_FETCH			"Fetch"		/* Fetch Max Count */
-#define INI_SOCKET			"Socket"	/* Socket buffer size */
-#define INI_READONLY		"ReadOnly"	/* Database is read only */
-#define INI_COMMLOG			"CommLog"	/* Communication to backend
-										 * logging */
-#define INI_PROTOCOL		"Protocol"	/* What protocol (6.2) */
-#define INI_OPTIMIZER		"Optimizer" /* Use backend genetic optimizer */
-#define INI_KSQO			"Ksqo"		/* Keyset query optimization */
-#define INI_CONNSETTINGS	"ConnSettings"		/* Anything to send to
-												 * backend on successful
-												 * connection */
-#define INI_UNIQUEINDEX		"UniqueIndex"		/* Recognize unique
-												 * indexes */
-#define INI_UNKNOWNSIZES	"UnknownSizes"		/* How to handle unknown
-												 * result set sizes */
-
-#define INI_CANCELASFREESTMT	"CancelAsFreeStmt"
-
-#define INI_USEDECLAREFETCH "UseDeclareFetch"	/* Use Declare/Fetch
-												 * cursors */
+# define ODBC_INI        ".odbc.ini"
+# ifdef ODBCINSTDIR
+#  define ODBCINST_INI    ODBCINSTDIR "/odbcinst.ini"
+# else
+#  define ODBCINST_INI    "/etc/odbcinst.ini"
+#  warning "location of odbcinst.ini file defaulted to /etc"
+# endif
+#else /* WIN32 */
+# define ODBC_INI        "ODBC.INI"         /* ODBC initialization file */
+# define ODBCINST_INI    "ODBCINST.INI"     /* ODBC Installation file */
+#endif /* WIN32 */
+
+
+#define INI_DSN           DBMS_NAME         /* Name of default Datasource in ini file (not used?) */
+#define INI_KDESC         "Description"     /* Data source description */
+#define INI_SERVER        "Servername"      /* Name of Server running the Postgres service */
+#define INI_PORT          "Port"            /* Port on which the Postmaster is listening */ 
+#define INI_DATABASE      "Database"        /* Database Name */
+#define INI_USER          "Username"        /* Default User Name */
+#define INI_PASSWORD      "Password"		/* Default Password */
+#define INI_DEBUG         "Debug"			/* Debug flag */
+#define INI_FETCH         "Fetch"			/* Fetch Max Count */
+#define INI_SOCKET        "Socket"			/* Socket buffer size */
+#define INI_READONLY      "ReadOnly"		/* Database is read only */
+#define INI_COMMLOG       "CommLog"			/* Communication to backend logging */
+#define INI_PROTOCOL      "Protocol"		/* What protocol (6.2) */
+#define INI_OPTIMIZER     "Optimizer"		/* Use backend genetic optimizer */
+#define INI_KSQO          "Ksqo"            /* Keyset query optimization */
+#define INI_CONNSETTINGS  "ConnSettings"	/* Anything to send to backend on successful connection */
+#define INI_UNIQUEINDEX   "UniqueIndex"		/* Recognize unique indexes */
+#define INI_UNKNOWNSIZES  "UnknownSizes"	/* How to handle unknown result set sizes */
+
+#define INI_CANCELASFREESTMT  "CancelAsFreeStmt"
+
+#define INI_USEDECLAREFETCH "UseDeclareFetch"		/* Use Declare/Fetch cursors */
 
 /*	More ini stuff */
 #define INI_TEXTASLONGVARCHAR		"TextAsLongVarchar"
@@ -91,16 +82,15 @@
 #define INI_PARSE					"Parse"
 #define INI_EXTRASYSTABLEPREFIXES	"ExtraSysTablePrefixes"
 
-#define INI_TRANSLATIONNAME			"TranslationName"
-#define INI_TRANSLATIONDLL			"TranslationDLL"
-#define INI_TRANSLATIONOPTION		"TranslationOption"
+#define INI_TRANSLATIONNAME       "TranslationName"
+#define INI_TRANSLATIONDLL        "TranslationDLL"
+#define INI_TRANSLATIONOPTION     "TranslationOption"
 
 
 /*	Connection Defaults */
 #define DEFAULT_PORT					"5432"
 #define DEFAULT_READONLY				1
-#define DEFAULT_PROTOCOL				"6.4"	/* the latest protocol is
-												 * the default */
+#define DEFAULT_PROTOCOL				"6.4"		/* the latest protocol is the default */
 #define DEFAULT_USEDECLAREFETCH			0
 #define DEFAULT_TEXTASLONGVARCHAR		1
 #define DEFAULT_UNKNOWNSASLONGVARCHAR	0
@@ -124,30 +114,29 @@
 
 #define DEFAULT_EXTRASYSTABLEPREFIXES	"dd_;"
 
-/*	prototypes */
-void		getGlobalDefaults(char *section, char *filename, char override);
+/*  prototypes */
+void getGlobalDefaults(char *section, char *filename, char override);
 
 #ifdef WIN32
-void		SetDlgStuff(HWND hdlg, ConnInfo *ci);
-void		GetDlgStuff(HWND hdlg, ConnInfo *ci);
-
-int CALLBACK driver_optionsProc(HWND hdlg,
-				   WORD wMsg,
-				   WPARAM wParam,
-				   LPARAM lParam);
-int CALLBACK ds_optionsProc(HWND hdlg,
-			   WORD wMsg,
-			   WPARAM wParam,
-			   LPARAM lParam);
-
-#endif	 /* WIN32 */
-
-void		updateGlobals(void);
-void		writeDSNinfo(ConnInfo *ci);
-void		getDSNdefaults(ConnInfo *ci);
-void		getDSNinfo(ConnInfo *ci, char overwrite);
-void		makeConnectString(char *connect_string, ConnInfo *ci);
-void		copyAttributes(ConnInfo *ci, char *attribute, char *value);
+void SetDlgStuff(HWND hdlg, ConnInfo *ci);
+void GetDlgStuff(HWND hdlg, ConnInfo *ci);
+
+int CALLBACK driver_optionsProc(HWND   hdlg,
+                           WORD   wMsg,
+                           WPARAM wParam,
+                           LPARAM lParam);
+int CALLBACK ds_optionsProc(HWND   hdlg,
+                           WORD   wMsg,
+                           WPARAM wParam,
+                           LPARAM lParam);
+#endif /* WIN32 */
+
+void updateGlobals(void);
+void writeDSNinfo(ConnInfo *ci);
+void getDSNdefaults(ConnInfo *ci);
+void getDSNinfo(ConnInfo *ci, char overwrite);
+void makeConnectString(char *connect_string, ConnInfo *ci);
+void copyAttributes(ConnInfo *ci, char *attribute, char *value);
 
 
 #endif
diff --git a/src/interfaces/odbc/drvconn.c b/src/interfaces/odbc/drvconn.c
index 4204913e0b319beb56739faf5184045795387ad0..2cbe6e6a87a639be1148f75d0bcc32d2fec222b6 100644
--- a/src/interfaces/odbc/drvconn.c
+++ b/src/interfaces/odbc/drvconn.c
@@ -1,13 +1,14 @@
-/* Module:			drvconn.c
+
+/* Module:          drvconn.c
  *
- * Description:		This module contains only routines related to
- *					implementing SQLDriverConnect.
+ * Description:     This module contains only routines related to 
+ *                  implementing SQLDriverConnect.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	SQLDriverConnect
+ * API functions:   SQLDriverConnect
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -52,50 +53,45 @@
 #include "dlg_specific.h"
 
 /* prototypes */
-void		dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci);
+void dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci);
 
 #ifdef WIN32
 BOOL FAR PASCAL dconn_FDriverConnectProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
-RETCODE		dconn_DoDialog(HWND hwnd, ConnInfo *ci);
-
-extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
+RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci);
 
+extern HINSTANCE NEAR s_hModule;               /* Saved module handle. */
 #endif
 
 extern GLOBAL_VALUES globals;
 
 
-RETCODE SQL_API
-SQLDriverConnect(
-				 HDBC hdbc,
-				 HWND hwnd,
-				 UCHAR FAR *szConnStrIn,
-				 SWORD cbConnStrIn,
-				 UCHAR FAR *szConnStrOut,
-				 SWORD cbConnStrOutMax,
-				 SWORD FAR *pcbConnStrOut,
-				 UWORD fDriverCompletion)
+RETCODE SQL_API SQLDriverConnect(
+                                 HDBC      hdbc,
+                                 HWND      hwnd,
+                                 UCHAR FAR *szConnStrIn,
+                                 SWORD     cbConnStrIn,
+                                 UCHAR FAR *szConnStrOut,
+                                 SWORD     cbConnStrOutMax,
+                                 SWORD FAR *pcbConnStrOut,
+                                 UWORD     fDriverCompletion)
 {
-	static char *func = "SQLDriverConnect";
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	ConnInfo   *ci;
-
+static char *func = "SQLDriverConnect";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+ConnInfo *ci;
 #ifdef WIN32
-	RETCODE		dialog_result;
-
+RETCODE dialog_result;
 #endif
-	RETCODE		result;
-	char		connStrIn[MAX_CONNECT_STRING];
-	char		connStrOut[MAX_CONNECT_STRING];
-	int			retval;
-	char		password_required = FALSE;
-	int			len = 0;
+RETCODE result;
+char connStrIn[MAX_CONNECT_STRING];
+char connStrOut[MAX_CONNECT_STRING];
+int retval;
+char password_required = FALSE;
+int len = 0;
 
 
 	mylog("%s: entering...\n", func);
 
-	if (!conn)
-	{
+	if ( ! conn) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -107,17 +103,17 @@ SQLDriverConnect(
 
 	ci = &(conn->connInfo);
 
-	/* Parse the connect string and fill in conninfo for this hdbc. */
+	/*	Parse the connect string and fill in conninfo for this hdbc. */
 	dconn_get_connect_attributes(connStrIn, ci);
 
-	/* If the ConnInfo in the hdbc is missing anything, */
-	/* this function will fill them in from the registry (assuming */
-	/* of course there is a DSN given -- if not, it does nothing!) */
+	/*	If the ConnInfo in the hdbc is missing anything, */
+	/*	this function will fill them in from the registry (assuming */
+	/*	of course there is a DSN given -- if not, it does nothing!) */
 	getDSNinfo(ci, CONN_DONT_OVERWRITE);
 
-	/* Fill in any default parameters if they are not there. */
+	/*	Fill in any default parameters if they are not there. */
 	getDSNdefaults(ci);
-	/* initialize pg_version */
+	/*	initialize pg_version */
 	CC_initialize_pg_version(conn);
 
 #ifdef WIN32
@@ -125,53 +121,51 @@ dialog:
 #endif
 	ci->focus_password = password_required;
 
-	switch (fDriverCompletion)
-	{
+	switch(fDriverCompletion) {
 #ifdef WIN32
-		case SQL_DRIVER_PROMPT:
-			dialog_result = dconn_DoDialog(hwnd, ci);
-			if (dialog_result != SQL_SUCCESS)
-				return dialog_result;
-			break;
+	case SQL_DRIVER_PROMPT:
+		dialog_result = dconn_DoDialog(hwnd, ci);
+		if(dialog_result != SQL_SUCCESS) {
+			return dialog_result;
+		}
+		break;
+
+	case SQL_DRIVER_COMPLETE_REQUIRED:
 
-		case SQL_DRIVER_COMPLETE_REQUIRED:
+		/*	Fall through */
 
-			/* Fall through */
+	case SQL_DRIVER_COMPLETE:
 
-		case SQL_DRIVER_COMPLETE:
+		/* Password is not a required parameter. */
+		if( ci->username[0] == '\0' ||
+			ci->server[0] == '\0' ||
+			ci->database[0] == '\0' ||
+			ci->port[0] == '\0' ||
+			password_required) { 
 
-			/* Password is not a required parameter. */
-			if (ci->username[0] == '\0' ||
-				ci->server[0] == '\0' ||
-				ci->database[0] == '\0' ||
-				ci->port[0] == '\0' ||
-				password_required)
-			{
-				dialog_result = dconn_DoDialog(hwnd, ci);
-				if (dialog_result != SQL_SUCCESS)
-					return dialog_result;
+			dialog_result = dconn_DoDialog(hwnd, ci);
+			if(dialog_result != SQL_SUCCESS) {
+				return dialog_result;
 			}
-			break;
+		}
+		break;
 #else
-		case SQL_DRIVER_PROMPT:
-		case SQL_DRIVER_COMPLETE:
-		case SQL_DRIVER_COMPLETE_REQUIRED:
+	case SQL_DRIVER_PROMPT:
+	case SQL_DRIVER_COMPLETE:
+	case SQL_DRIVER_COMPLETE_REQUIRED:
 #endif
-		case SQL_DRIVER_NOPROMPT:
-			break;
+	case SQL_DRIVER_NOPROMPT:
+		break;
 	}
 
-	/*
-	 * Password is not a required parameter unless authentication asks for
-	 * it. For now, I think it's better to just let the application ask
-	 * over and over until a password is entered (the user can always hit
-	 * Cancel to get out)
-	 */
-	if (ci->username[0] == '\0' ||
+	/*	Password is not a required parameter unless authentication asks for it.
+		For now, I think it's better to just let the application ask over and over until
+		a password is entered (the user can always hit Cancel to get out)
+	*/
+	if( ci->username[0] == '\0' ||
 		ci->server[0] == '\0' ||
-		ci->database[0] == '\0' ||
-		ci->port[0] == '\0')
-	{
+		ci->database[0] == '\0' || 
+		ci->port[0] == '\0') {
 /*		(password_required && ci->password[0] == '\0')) */
 
 		return SQL_NO_DATA_FOUND;
@@ -180,16 +174,12 @@ dialog:
 
 	/* do the actual connect */
 	retval = CC_connect(conn, password_required);
-	if (retval < 0)
-	{							/* need a password */
-		if (fDriverCompletion == SQL_DRIVER_NOPROMPT)
-		{
+	if (retval < 0) {		/* need a password */
+		if (fDriverCompletion == SQL_DRIVER_NOPROMPT) {
 			CC_log_error(func, "Need password but Driver_NoPrompt", conn);
-			return SQL_ERROR;	/* need a password but not allowed to
-								 * prompt so error */
+			return SQL_ERROR;	/* need a password but not allowed to prompt so error */
 		}
-		else
-		{
+		else {
 #ifdef WIN32
 			password_required = TRUE;
 			goto dialog;
@@ -198,44 +188,39 @@ dialog:
 #endif
 		}
 	}
-	else if (retval == 0)
-	{
-		/* error msg filled in above */
+	else if (retval == 0) {
+		/*	error msg filled in above */
 		CC_log_error(func, "Error from CC_Connect", conn);
 		return SQL_ERROR;
 	}
 
 	/*********************************************/
-	/* Create the Output Connection String	 */
+	/*     Create the Output Connection String   */
 	/*********************************************/
 	result = SQL_SUCCESS;
 
 	makeConnectString(connStrOut, ci);
 	len = strlen(connStrOut);
 
-	if (szConnStrOut)
-	{
-
-		/*
-		 * Return the completed string to the caller. The correct method
-		 * is to only construct the connect string if a dialog was put up,
-		 * otherwise, it should just copy the connection input string to
-		 * the output. However, it seems ok to just always construct an
-		 * output string.  There are possible bad side effects on working
-		 * applications (Access) by implementing the correct behavior,
-		 * anyway.
-		 */
+	if(szConnStrOut) {
+
+		/*	Return the completed string to the caller. The correct method is to 
+			only construct the connect string if a dialog was put up, otherwise, 
+			it should just copy the connection input string to the output.  
+			However, it seems ok to just always	construct an output string.  There
+			are possible bad side effects on working applications (Access) by 
+			implementing the correct behavior, anyway. 
+		*/
 		strncpy_null(szConnStrOut, connStrOut, cbConnStrOutMax);
 
-		if (len >= cbConnStrOutMax)
-		{
+		if (len >= cbConnStrOutMax) {
 			result = SQL_SUCCESS_WITH_INFO;
 			conn->errornumber = CONN_TRUNCATED;
 			conn->errormsg = "The buffer was too small for the result.";
 		}
 	}
 
-	if (pcbConnStrOut)
+	if(pcbConnStrOut)
 		*pcbConnStrOut = len;
 
 	mylog("szConnStrOut = '%s'\n", szConnStrOut);
@@ -247,117 +232,108 @@ dialog:
 }
 
 #ifdef WIN32
-RETCODE
-dconn_DoDialog(HWND hwnd, ConnInfo *ci)
+RETCODE dconn_DoDialog(HWND hwnd, ConnInfo *ci)
 {
-	int			dialog_result;
+int dialog_result;
 
-	mylog("dconn_DoDialog: ci = %u\n", ci);
+mylog("dconn_DoDialog: ci = %u\n", ci);
 
-	if (hwnd)
-	{
+	if(hwnd) {
 		dialog_result = DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_CONFIG),
-							hwnd, dconn_FDriverConnectProc, (LPARAM) ci);
-		if (!dialog_result || (dialog_result == -1))
+									hwnd, dconn_FDriverConnectProc, (LPARAM) ci);
+		if(!dialog_result || (dialog_result == -1)) {
 			return SQL_NO_DATA_FOUND;
-		else
+		} else {
 			return SQL_SUCCESS;
+		}
 	}
 
 	return SQL_ERROR;
 }
 
 
-BOOL FAR	PASCAL
-dconn_FDriverConnectProc(
-						 HWND hdlg,
-						 UINT wMsg,
-						 WPARAM wParam,
-						 LPARAM lParam)
+BOOL FAR PASCAL dconn_FDriverConnectProc(
+                                         HWND    hdlg,
+                                         UINT    wMsg,
+                                         WPARAM  wParam,
+                                         LPARAM  lParam)
 {
-	ConnInfo   *ci;
+ConnInfo *ci;
 
-	switch (wMsg)
-	{
-		case WM_INITDIALOG:
-			ci = (ConnInfo *) lParam;
+	switch (wMsg) {
+	case WM_INITDIALOG:
+		ci = (ConnInfo *) lParam;		
 
-			/* Change the caption for the setup dialog */
-			SetWindowText(hdlg, "PostgreSQL Connection");
+		/*	Change the caption for the setup dialog */
+		SetWindowText(hdlg, "PostgreSQL Connection");
 
-			SetWindowText(GetDlgItem(hdlg, IDC_DATASOURCE), "Connection");
+		SetWindowText(GetDlgItem(hdlg, IDC_DATASOURCE), "Connection");
 
-			/* Hide the DSN and description fields */
-			ShowWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), SW_HIDE);
-			ShowWindow(GetDlgItem(hdlg, IDC_DSNAME), SW_HIDE);
-			ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
-			ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
+		/*	Hide the DSN and description fields */
+		ShowWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), SW_HIDE);
+		ShowWindow(GetDlgItem(hdlg, IDC_DSNAME), SW_HIDE);
+		ShowWindow(GetDlgItem(hdlg, IDC_DESCTEXT), SW_HIDE);
+		ShowWindow(GetDlgItem(hdlg, IDC_DESC), SW_HIDE);
 
-			SetWindowLong(hdlg, DWL_USER, lParam);		/* Save the ConnInfo for
-														 * the "OK" */
+		SetWindowLong(hdlg, DWL_USER, lParam);/* Save the ConnInfo for the "OK" */
 
-			SetDlgStuff(hdlg, ci);
+		SetDlgStuff(hdlg, ci);
 
-			if (ci->database[0] == '\0')
-				;				/* default focus */
-			else if (ci->server[0] == '\0')
-				SetFocus(GetDlgItem(hdlg, IDC_SERVER));
-			else if (ci->port[0] == '\0')
-				SetFocus(GetDlgItem(hdlg, IDC_PORT));
-			else if (ci->username[0] == '\0')
-				SetFocus(GetDlgItem(hdlg, IDC_USER));
-			else if (ci->focus_password)
-				SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
+		if (ci->database[0] == '\0')		
+			;	/* default focus */
+		else if (ci->server[0] == '\0')
+			SetFocus(GetDlgItem(hdlg, IDC_SERVER));
+		else if (ci->port[0] == '\0')
+			SetFocus(GetDlgItem(hdlg, IDC_PORT));
+		else if (ci->username[0] == '\0')
+			SetFocus(GetDlgItem(hdlg, IDC_USER));
+		else if (ci->focus_password)
+			SetFocus(GetDlgItem(hdlg, IDC_PASSWORD));
 
 
-			break;
+		break; 
 
-		case WM_COMMAND:
-			switch (GET_WM_COMMAND_ID(wParam, lParam))
-			{
-				case IDOK:
+	case WM_COMMAND:
+		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
+		case IDOK:
 
-					ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+			ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
 
-					GetDlgStuff(hdlg, ci);
+			GetDlgStuff(hdlg, ci);
 
 
-				case IDCANCEL:
-					EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
-					return TRUE;
+		case IDCANCEL:
+			EndDialog(hdlg, GET_WM_COMMAND_ID(wParam, lParam) == IDOK);
+			return TRUE;
 
-				case IDC_DRIVER:
+		case IDC_DRIVER:
 
-					DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
-								hdlg, driver_optionsProc, (LPARAM) NULL);
+			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+									hdlg, driver_optionsProc, (LPARAM) NULL);
 
 
-					break;
+			break;
 
-				case IDC_DATASOURCE:
+		case IDC_DATASOURCE:
 
-					ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
-					DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
-								   hdlg, ds_optionsProc, (LPARAM) ci);
+			ci = (ConnInfo *) GetWindowLong(hdlg, DWL_USER);
+			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
+									hdlg, ds_optionsProc, (LPARAM) ci);
 
-					break;
-			}
+			break;
+		}
 	}
 
 	return FALSE;
 }
 
-#endif	 /* WIN32 */
+#endif	/* WIN32 */
 
-void
-dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci)
+void dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci)
 {
-	char	   *our_connect_string;
-	char	   *pair,
-			   *attribute,
-			   *value,
-			   *equals;
-	char	   *strtok_arg;
+char *our_connect_string;
+char *pair, *attribute, *value, *equals;
+char *strtok_arg;
 
 	memset(ci, 0, sizeof(ConnInfo));
 
@@ -366,31 +342,34 @@ dconn_get_connect_attributes(UCHAR FAR *connect_string, ConnInfo *ci)
 
 	mylog("our_connect_string = '%s'\n", our_connect_string);
 
-	while (1)
-	{
+	while(1) {
 		pair = strtok(strtok_arg, ";");
-		if (strtok_arg)
+		if(strtok_arg) {
 			strtok_arg = 0;
-		if (!pair)
+		}
+		if(!pair) {
 			break;
+		}
 
 		equals = strchr(pair, '=');
-		if (!equals)
+		if ( ! equals)
 			continue;
 
 		*equals = '\0';
-		attribute = pair;		/* ex. DSN */
-		value = equals + 1;		/* ex. 'CEO co1' */
+		attribute = pair;		/*	ex. DSN */
+		value = equals + 1;		/*	ex. 'CEO co1' */
 
 		mylog("attribute = '%s', value = '%s'\n", attribute, value);
 
-		if (!attribute || !value)
-			continue;
+		if( !attribute || !value)
+			continue;          
 
-		/* Copy the appropriate value to the conninfo  */
+		/*	Copy the appropriate value to the conninfo  */
 		copyAttributes(ci, attribute, value);
+
 	}
 
 
 	free(our_connect_string);
 }
+
diff --git a/src/interfaces/odbc/environ.c b/src/interfaces/odbc/environ.c
index d0353531c0dcc4784a55b0c66d10ea4e007dbe7f..080a8026d5e6947dc0c3f855766596f467951426 100644
--- a/src/interfaces/odbc/environ.c
+++ b/src/interfaces/odbc/environ.c
@@ -1,14 +1,15 @@
-/* Module:			environ.c
+
+/* Module:          environ.c
  *
- * Description:		This module contains routines related to
- *					the environment, such as storing connection handles,
- *					and returning errors.
+ * Description:     This module contains routines related to 
+ *                  the environment, such as storing connection handles,
+ *                  and returning errors.
  *
- * Classes:			EnvironmentClass (Functions prefix: "EN_")
+ * Classes:         EnvironmentClass (Functions prefix: "EN_")
  *
- * API functions:	SQLAllocEnv, SQLFreeEnv, SQLError
+ * API functions:   SQLAllocEnv, SQLFreeEnv, SQLError
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -22,35 +23,31 @@
 ConnectionClass *conns[MAX_CONNECTIONS];
 
 
-RETCODE SQL_API
-SQLAllocEnv(HENV FAR *phenv)
+RETCODE SQL_API SQLAllocEnv(HENV FAR *phenv)
 {
-	static char *func = "SQLAllocEnv";
+static char *func = "SQLAllocEnv";
 
-	mylog("**** in SQLAllocEnv ** \n");
+mylog("**** in SQLAllocEnv ** \n");
 
 	*phenv = (HENV) EN_Constructor();
-	if (!*phenv)
-	{
+	if ( ! *phenv) {
 		*phenv = SQL_NULL_HENV;
 		EN_log_error(func, "Error allocating environment", NULL);
 		return SQL_ERROR;
 	}
-
+ 
 	mylog("** exit SQLAllocEnv: phenv = %u **\n", *phenv);
 	return SQL_SUCCESS;
 }
 
-RETCODE SQL_API
-SQLFreeEnv(HENV henv)
+RETCODE SQL_API SQLFreeEnv(HENV henv)
 {
-	static char *func = "SQLFreeEnv";
-	EnvironmentClass *env = (EnvironmentClass *) henv;
+static char *func = "SQLFreeEnv";
+EnvironmentClass *env = (EnvironmentClass *) henv;
 
-	mylog("**** in SQLFreeEnv: env = %u ** \n", env);
+mylog("**** in SQLFreeEnv: env = %u ** \n", env);
 
-	if (env && EN_Destructor(env))
-	{
+	if (env && EN_Destructor(env)) {
 		mylog("   ok\n");
 		return SQL_SUCCESS;
 	}
@@ -60,345 +57,321 @@ SQLFreeEnv(HENV henv)
 	return SQL_ERROR;
 }
 
-/*		Returns the next SQL error information. */
-
-RETCODE SQL_API
-SQLError(
-		 HENV henv,
-		 HDBC hdbc,
-		 HSTMT hstmt,
-		 UCHAR FAR *szSqlState,
-		 SDWORD FAR *pfNativeError,
-		 UCHAR FAR *szErrorMsg,
-		 SWORD cbErrorMsgMax,
-		 SWORD FAR *pcbErrorMsg)
+/*      Returns the next SQL error information. */
+
+RETCODE SQL_API SQLError(
+        HENV       henv,
+        HDBC       hdbc,
+        HSTMT      hstmt,
+        UCHAR  FAR *szSqlState,
+        SDWORD FAR *pfNativeError,
+        UCHAR  FAR *szErrorMsg,
+        SWORD      cbErrorMsgMax,
+        SWORD  FAR *pcbErrorMsg)
 {
-	char	   *msg;
-	int			status;
-
+char *msg;
+int status;
+    
 	mylog("**** SQLError: henv=%u, hdbc=%u, hstmt=%u\n", henv, hdbc, hstmt);
 
-	if (SQL_NULL_HSTMT != hstmt)
-	{
-		/* CC: return an error of a hstmt  */
-		StatementClass *stmt = (StatementClass *) hstmt;
-
-		if (SC_get_error(stmt, &status, &msg))
-		{
+    if (SQL_NULL_HSTMT != hstmt) {
+	/* CC: return an error of a hstmt  */
+        StatementClass *stmt = (StatementClass *) hstmt;
+        
+        if (SC_get_error(stmt, &status, &msg)) {
 			mylog("SC_get_error: status = %d, msg = #%s#\n", status, msg);
-			if (NULL == msg)
-			{
-				if (NULL != szSqlState)
-					strcpy(szSqlState, "00000");
-				if (NULL != pcbErrorMsg)
-					*pcbErrorMsg = 0;
-				if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-					szErrorMsg[0] = '\0';
-
-				return SQL_NO_DATA_FOUND;
-			}
-			if (NULL != pcbErrorMsg)
-				*pcbErrorMsg = (SWORD) strlen(msg);
-
-			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-				strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
-
-			if (NULL != pfNativeError)
-				*pfNativeError = status;
-
-			if (NULL != szSqlState)
-
-				switch (status)
-				{
-						/* now determine the SQLSTATE to be returned */
-					case STMT_TRUNCATED:
-						strcpy(szSqlState, "01004");
-						/* data truncated */
-						break;
-					case STMT_INFO_ONLY:
-						strcpy(szSqlState, "00000");
-						/* just information that is returned, no error */
-						break;
-					case STMT_BAD_ERROR:
-						strcpy(szSqlState, "08S01");
-						/* communication link failure */
-						break;
-					case STMT_CREATE_TABLE_ERROR:
-						strcpy(szSqlState, "S0001");
-						/* table already exists */
-						break;
-					case STMT_STATUS_ERROR:
-					case STMT_SEQUENCE_ERROR:
-						strcpy(szSqlState, "S1010");
-						/* Function sequence error */
-						break;
-					case STMT_NO_MEMORY_ERROR:
-						strcpy(szSqlState, "S1001");
-						/* memory allocation failure */
-						break;
-					case STMT_COLNUM_ERROR:
-						strcpy(szSqlState, "S1002");
-						/* invalid column number */
-						break;
-					case STMT_NO_STMTSTRING:
-						strcpy(szSqlState, "S1001");
-						/* having no stmtstring is also a malloc problem */
-						break;
-					case STMT_ERROR_TAKEN_FROM_BACKEND:
-						strcpy(szSqlState, "S1000");
-						/* general error */
-						break;
-					case STMT_INTERNAL_ERROR:
-						strcpy(szSqlState, "S1000");
-						/* general error */
-						break;
-					case STMT_ROW_OUT_OF_RANGE:
-						strcpy(szSqlState, "S1107");
-						break;
-
-					case STMT_OPERATION_CANCELLED:
-						strcpy(szSqlState, "S1008");
-						break;
-
-					case STMT_NOT_IMPLEMENTED_ERROR:
-						strcpy(szSqlState, "S1C00");	/* == 'driver not
-														 * capable' */
-						break;
-					case STMT_OPTION_OUT_OF_RANGE_ERROR:
-						strcpy(szSqlState, "S1092");
-						break;
-					case STMT_BAD_PARAMETER_NUMBER_ERROR:
-						strcpy(szSqlState, "S1093");
-						break;
-					case STMT_INVALID_COLUMN_NUMBER_ERROR:
-						strcpy(szSqlState, "S1002");
-						break;
-					case STMT_RESTRICTED_DATA_TYPE_ERROR:
-						strcpy(szSqlState, "07006");
-						break;
-					case STMT_INVALID_CURSOR_STATE_ERROR:
-						strcpy(szSqlState, "24000");
-						break;
-					case STMT_OPTION_VALUE_CHANGED:
-						strcpy(szSqlState, "01S02");
-						break;
-					case STMT_INVALID_CURSOR_NAME:
-						strcpy(szSqlState, "34000");
-						break;
-					case STMT_NO_CURSOR_NAME:
-						strcpy(szSqlState, "S1015");
-						break;
-					case STMT_INVALID_ARGUMENT_NO:
-						strcpy(szSqlState, "S1009");
-						/* invalid argument value */
-						break;
-					case STMT_INVALID_CURSOR_POSITION:
-						strcpy(szSqlState, "S1109");
-						break;
-
-					case STMT_VALUE_OUT_OF_RANGE:
-						strcpy(szSqlState, "22003");
-						break;
-
-					case STMT_OPERATION_INVALID:
-						strcpy(szSqlState, "S1011");
-						break;
-
-					case STMT_EXEC_ERROR:
-					default:
-						strcpy(szSqlState, "S1000");
-						/* also a general error */
-						break;
-				}
-
-			mylog("       szSqlState = '%s', szError='%s'\n", szSqlState, szErrorMsg);
-		}
-		else
-		{
-			if (NULL != szSqlState)
-				strcpy(szSqlState, "00000");
-			if (NULL != pcbErrorMsg)
-				*pcbErrorMsg = 0;
-			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-				szErrorMsg[0] = '\0';
-
+            if (NULL == msg) {
+                if (NULL != szSqlState)
+                    strcpy(szSqlState, "00000");
+                if (NULL != pcbErrorMsg)
+                    *pcbErrorMsg = 0;
+                if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+                    szErrorMsg[0] = '\0';
+                
+                return SQL_NO_DATA_FOUND;
+            }                
+            if (NULL != pcbErrorMsg)                
+                *pcbErrorMsg = (SWORD)strlen(msg);
+            
+            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+                strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
+            
+            if (NULL != pfNativeError) 
+                *pfNativeError = status;
+            
+            if (NULL != szSqlState)    
+                
+                switch (status) {
+		/* now determine the SQLSTATE to be returned */
+                case STMT_TRUNCATED:
+                    strcpy(szSqlState, "01004");
+                    /* data truncated */
+                    break;
+                case STMT_INFO_ONLY:
+                    strcpy(szSqlState, "00000");
+                    /* just information that is returned, no error */
+                    break;
+                case STMT_BAD_ERROR:
+                    strcpy(szSqlState, "08S01");
+                    /* communication link failure */
+                    break;
+                case STMT_CREATE_TABLE_ERROR:
+                    strcpy(szSqlState, "S0001");
+                    /* table already exists */
+                    break;
+                case STMT_STATUS_ERROR:
+                case STMT_SEQUENCE_ERROR:
+                    strcpy(szSqlState, "S1010");
+                    /* Function sequence error */
+                    break;
+                case STMT_NO_MEMORY_ERROR:
+                    strcpy(szSqlState, "S1001");
+                    /* memory allocation failure */
+                    break;
+                case STMT_COLNUM_ERROR:
+                    strcpy(szSqlState, "S1002");
+                    /* invalid column number */
+                    break;
+                case STMT_NO_STMTSTRING:
+                    strcpy(szSqlState, "S1001");
+                    /* having no stmtstring is also a malloc problem */
+                    break;
+                case STMT_ERROR_TAKEN_FROM_BACKEND:
+                    strcpy(szSqlState, "S1000");
+                    /* general error */
+                    break;
+                case STMT_INTERNAL_ERROR:
+                    strcpy(szSqlState, "S1000");
+                    /* general error */
+                    break;  
+				case STMT_ROW_OUT_OF_RANGE:
+					strcpy(szSqlState, "S1107");
+					break;
+
+				case STMT_OPERATION_CANCELLED:
+					strcpy(szSqlState, "S1008");
+					break;
+
+                case STMT_NOT_IMPLEMENTED_ERROR:
+                    strcpy(szSqlState, "S1C00"); /* == 'driver not capable' */
+                    break;
+                case STMT_OPTION_OUT_OF_RANGE_ERROR:
+                    strcpy(szSqlState, "S1092");
+                    break;
+                case STMT_BAD_PARAMETER_NUMBER_ERROR:
+                    strcpy(szSqlState, "S1093");
+                    break;
+                case STMT_INVALID_COLUMN_NUMBER_ERROR:
+                    strcpy(szSqlState, "S1002");
+                    break;
+                case STMT_RESTRICTED_DATA_TYPE_ERROR:
+                    strcpy(szSqlState, "07006");
+                    break;
+                case STMT_INVALID_CURSOR_STATE_ERROR:
+                    strcpy(szSqlState, "24000");
+                    break;
+                case STMT_OPTION_VALUE_CHANGED:
+                    strcpy(szSqlState, "01S02");
+                    break;
+				case STMT_INVALID_CURSOR_NAME:
+                    strcpy(szSqlState, "34000");
+                    break;
+				case STMT_NO_CURSOR_NAME:
+                    strcpy(szSqlState, "S1015");
+                    break;
+                case STMT_INVALID_ARGUMENT_NO:
+                    strcpy(szSqlState, "S1009");
+                    /* invalid argument value */
+                    break;
+				case STMT_INVALID_CURSOR_POSITION:
+                    strcpy(szSqlState, "S1109");
+                    break;
+                
+				case STMT_VALUE_OUT_OF_RANGE:
+					strcpy(szSqlState, "22003");
+					break;
+
+				case STMT_OPERATION_INVALID:
+					strcpy(szSqlState, "S1011");
+					break;
+
+				case STMT_EXEC_ERROR:
+				default:
+                    strcpy(szSqlState, "S1000");
+                    /* also a general error */
+                    break;
+                }         
+
+				mylog("       szSqlState = '%s', szError='%s'\n", szSqlState, szErrorMsg);
+            
+        } else {
+            if (NULL != szSqlState)
+                strcpy(szSqlState, "00000");
+            if (NULL != pcbErrorMsg)
+                *pcbErrorMsg = 0;
+            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+                szErrorMsg[0] = '\0';
+            
 			mylog("       returning NO_DATA_FOUND\n");
-			return SQL_NO_DATA_FOUND;
-		}
-		return SQL_SUCCESS;
-	}
-	else if (SQL_NULL_HDBC != hdbc)
-	{
-		ConnectionClass *conn = (ConnectionClass *) hdbc;
-
+            return SQL_NO_DATA_FOUND;
+        }
+        return SQL_SUCCESS;    
+        
+    } else if (SQL_NULL_HDBC != hdbc) {
+        ConnectionClass *conn = (ConnectionClass *) hdbc;
+        
 		mylog("calling CC_get_error\n");
-		if (CC_get_error(conn, &status, &msg))
-		{
+        if (CC_get_error(conn, &status, &msg)) {
 			mylog("CC_get_error: status = %d, msg = #%s#\n", status, msg);
-			if (NULL == msg)
-			{
-				if (NULL != szSqlState)
-					strcpy(szSqlState, "00000");
-				if (NULL != pcbErrorMsg)
-					*pcbErrorMsg = 0;
-				if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-					szErrorMsg[0] = '\0';
-
-				return SQL_NO_DATA_FOUND;
-			}
-
-			if (NULL != pcbErrorMsg)
-				*pcbErrorMsg = (SWORD) strlen(msg);
-			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-				strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
-			if (NULL != pfNativeError)
-				*pfNativeError = status;
-
-			if (NULL != szSqlState)
-				switch (status)
-				{
-					case STMT_OPTION_VALUE_CHANGED:
-					case CONN_OPTION_VALUE_CHANGED:
-						strcpy(szSqlState, "01S02");
-						break;
-					case STMT_TRUNCATED:
-					case CONN_TRUNCATED:
-						strcpy(szSqlState, "01004");
-						/* data truncated */
-						break;
-					case CONN_INIREAD_ERROR:
-						strcpy(szSqlState, "IM002");
-						/* data source not found */
-						break;
-					case CONN_OPENDB_ERROR:
-						strcpy(szSqlState, "08001");
-						/* unable to connect to data source */
-						break;
-					case CONN_INVALID_AUTHENTICATION:
-					case CONN_AUTH_TYPE_UNSUPPORTED:
-						strcpy(szSqlState, "28000");
-						break;
-					case CONN_STMT_ALLOC_ERROR:
-						strcpy(szSqlState, "S1001");
-						/* memory allocation failure */
-						break;
-					case CONN_IN_USE:
-						strcpy(szSqlState, "S1000");
-						/* general error */
-						break;
-					case CONN_UNSUPPORTED_OPTION:
-						strcpy(szSqlState, "IM001");
-						/* driver does not support this function */
-					case CONN_INVALID_ARGUMENT_NO:
-						strcpy(szSqlState, "S1009");
-						/* invalid argument value */
-						break;
-					case CONN_TRANSACT_IN_PROGRES:
-						strcpy(szSqlState, "S1010");
-
-						/*
-						 * when the user tries to switch commit mode in a
-						 * transaction
-						 */
-						/* -> function sequence error */
-						break;
-					case CONN_NO_MEMORY_ERROR:
-						strcpy(szSqlState, "S1001");
-						break;
-					case CONN_NOT_IMPLEMENTED_ERROR:
-					case STMT_NOT_IMPLEMENTED_ERROR:
-						strcpy(szSqlState, "S1C00");
-						break;
-
-					case CONN_VALUE_OUT_OF_RANGE:
-					case STMT_VALUE_OUT_OF_RANGE:
-						strcpy(szSqlState, "22003");
-						break;
-
-					default:
-						strcpy(szSqlState, "S1000");
-						/* general error */
-						break;
-				}
-		}
-		else
-		{
+            if (NULL == msg) {
+                if (NULL != szSqlState)
+                    strcpy(szSqlState, "00000");
+                if (NULL != pcbErrorMsg)
+                    *pcbErrorMsg = 0;
+                if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+                    szErrorMsg[0] = '\0';
+                
+                return SQL_NO_DATA_FOUND;
+            }                
+            
+            if (NULL != pcbErrorMsg)
+                *pcbErrorMsg = (SWORD)strlen(msg);
+            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))    
+                strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
+            if (NULL != pfNativeError)    
+                *pfNativeError = status;
+            
+            if (NULL != szSqlState) 
+                switch(status) {
+				case STMT_OPTION_VALUE_CHANGED:
+				case CONN_OPTION_VALUE_CHANGED:
+                    strcpy(szSqlState, "01S02");
+					break;
+                case STMT_TRUNCATED:
+				case CONN_TRUNCATED:
+                    strcpy(szSqlState, "01004");
+                    /* data truncated */
+                    break;
+                case CONN_INIREAD_ERROR:
+                    strcpy(szSqlState, "IM002");
+                    /* data source not found */
+                    break;
+                case CONN_OPENDB_ERROR:
+                    strcpy(szSqlState, "08001");
+                    /* unable to connect to data source */
+                    break;
+				case CONN_INVALID_AUTHENTICATION:
+				case CONN_AUTH_TYPE_UNSUPPORTED:
+					strcpy(szSqlState, "28000");
+					break;
+                case CONN_STMT_ALLOC_ERROR:
+                    strcpy(szSqlState, "S1001");
+                    /* memory allocation failure */
+                    break;
+                case CONN_IN_USE:
+                    strcpy(szSqlState, "S1000");
+                    /* general error */
+                    break;
+                case CONN_UNSUPPORTED_OPTION:
+                    strcpy(szSqlState, "IM001");
+                    /* driver does not support this function */
+                case CONN_INVALID_ARGUMENT_NO:
+                    strcpy(szSqlState, "S1009");
+                    /* invalid argument value */
+                    break;
+                case CONN_TRANSACT_IN_PROGRES:
+                    strcpy(szSqlState, "S1010");
+                    /* when the user tries to switch commit mode in a transaction */
+                    /* -> function sequence error */
+                    break;
+                case CONN_NO_MEMORY_ERROR:
+                    strcpy(szSqlState, "S1001");
+                    break;
+                case CONN_NOT_IMPLEMENTED_ERROR:
+				case STMT_NOT_IMPLEMENTED_ERROR:
+                    strcpy(szSqlState, "S1C00");
+                    break;
+
+				case CONN_VALUE_OUT_OF_RANGE:
+				case STMT_VALUE_OUT_OF_RANGE:
+					strcpy(szSqlState, "22003");
+					break;
+
+                default:
+                    strcpy(szSqlState, "S1000");
+                    /* general error */
+                    break;
+                }
+       
+        } else {
 			mylog("CC_Get_error returned nothing.\n");
-			if (NULL != szSqlState)
-				strcpy(szSqlState, "00000");
-			if (NULL != pcbErrorMsg)
-				*pcbErrorMsg = 0;
-			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-				szErrorMsg[0] = '\0';
-
-			return SQL_NO_DATA_FOUND;
-		}
-		return SQL_SUCCESS;
-	}
-	else if (SQL_NULL_HENV != henv)
-	{
-		EnvironmentClass *env = (EnvironmentClass *) henv;
-
-		if (EN_get_error(env, &status, &msg))
-		{
+            if (NULL != szSqlState)
+                strcpy(szSqlState, "00000");
+            if (NULL != pcbErrorMsg)
+                *pcbErrorMsg = 0;
+            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+                szErrorMsg[0] = '\0';
+            
+            return SQL_NO_DATA_FOUND;
+        }
+        return SQL_SUCCESS;
+        
+    } else if (SQL_NULL_HENV != henv) {
+        EnvironmentClass *env = (EnvironmentClass *)henv;
+        if(EN_get_error(env, &status, &msg)) {
 			mylog("EN_get_error: status = %d, msg = #%s#\n", status, msg);
-			if (NULL == msg)
-			{
-				if (NULL != szSqlState)
-					strcpy(szSqlState, "00000");
-				if (NULL != pcbErrorMsg)
-					*pcbErrorMsg = 0;
-				if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-					szErrorMsg[0] = '\0';
-
-				return SQL_NO_DATA_FOUND;
-			}
-
-			if (NULL != pcbErrorMsg)
-				*pcbErrorMsg = (SWORD) strlen(msg);
-			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-				strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
-			if (NULL != pfNativeError)
-				*pfNativeError = status;
-
-			if (szSqlState)
-			{
-				switch (status)
-				{
-					case ENV_ALLOC_ERROR:
-						/* memory allocation failure */
-						strcpy(szSqlState, "S1001");
-						break;
-					default:
-						strcpy(szSqlState, "S1000");
-						/* general error */
-						break;
-				}
-			}
-		}
-		else
-		{
-			if (NULL != szSqlState)
-				strcpy(szSqlState, "00000");
-			if (NULL != pcbErrorMsg)
-				*pcbErrorMsg = 0;
-			if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-				szErrorMsg[0] = '\0';
-
-			return SQL_NO_DATA_FOUND;
-		}
-
-		return SQL_SUCCESS;
-	}
-
-	if (NULL != szSqlState)
-		strcpy(szSqlState, "00000");
-	if (NULL != pcbErrorMsg)
-		*pcbErrorMsg = 0;
-	if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
-		szErrorMsg[0] = '\0';
-
-	return SQL_NO_DATA_FOUND;
+            if (NULL == msg) {
+                if (NULL != szSqlState)
+                    strcpy(szSqlState, "00000");
+                if (NULL != pcbErrorMsg)
+                    *pcbErrorMsg = 0;
+                if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+                    szErrorMsg[0] = '\0';
+
+                return SQL_NO_DATA_FOUND;
+            }                
+
+            if (NULL != pcbErrorMsg)                
+                *pcbErrorMsg = (SWORD)strlen(msg);
+            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0))
+                strncpy_null(szErrorMsg, msg, cbErrorMsgMax);
+            if (NULL != pfNativeError) 
+                *pfNativeError = status;
+            
+            if(szSqlState) {
+                switch(status) {
+                case ENV_ALLOC_ERROR:
+		    /* memory allocation failure */
+                    strcpy(szSqlState, "S1001");
+                    break;
+                default:
+                    strcpy(szSqlState, "S1000");
+                    /* general error */
+                    break;
+                }
+            }
+        } else {
+            if (NULL != szSqlState)
+                strcpy(szSqlState, "00000");
+            if (NULL != pcbErrorMsg)
+                *pcbErrorMsg = 0;
+            if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+                szErrorMsg[0] = '\0';
+            
+            return SQL_NO_DATA_FOUND;
+        }
+
+        return SQL_SUCCESS;
+    }
+    
+    if (NULL != szSqlState)
+        strcpy(szSqlState, "00000");
+    if (NULL != pcbErrorMsg)
+        *pcbErrorMsg = 0;
+    if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) 
+        szErrorMsg[0] = '\0';
+    
+    return SQL_NO_DATA_FOUND;
 }
 
 
@@ -410,27 +383,25 @@ SQLError(
 
 
 EnvironmentClass
-		   *
-EN_Constructor(void)
+*EN_Constructor(void)
 {
-	EnvironmentClass *rv;
+EnvironmentClass *rv;
 
-	rv = (EnvironmentClass *) malloc(sizeof(EnvironmentClass));
-	if (rv)
-	{
+    rv = (EnvironmentClass *) malloc(sizeof(EnvironmentClass));
+    if( rv) {
 		rv->errormsg = 0;
 		rv->errornumber = 0;
 	}
 
-	return rv;
+    return rv;
 }
 
 
 char
 EN_Destructor(EnvironmentClass *self)
 {
-	int			lf;
-	char		rv = 1;
+int lf;
+char rv = 1;
 
 	mylog("in EN_Destructor, self=%u\n", self);
 
@@ -438,8 +409,7 @@ EN_Destructor(EnvironmentClass *self)
 	/* the source--they should not be freed */
 
 	/* Free any connections belonging to this environment */
-	for (lf = 0; lf < MAX_CONNECTIONS; lf++)
-	{
+	for (lf = 0; lf < MAX_CONNECTIONS; lf++) {
 		if (conns[lf] && conns[lf]->henv == self)
 			rv = rv && CC_Destructor(conns[lf]);
 	}
@@ -451,29 +421,26 @@ EN_Destructor(EnvironmentClass *self)
 char
 EN_get_error(EnvironmentClass *self, int *number, char **message)
 {
-	if (self && self->errormsg && self->errornumber)
-	{
+	if(self && self->errormsg && self->errornumber) {
 		*message = self->errormsg;
 		*number = self->errornumber;
 		self->errormsg = 0;
 		self->errornumber = 0;
 		return 1;
-	}
-	else
+	} else {
 		return 0;
+	}
 }
 
 char
 EN_add_connection(EnvironmentClass *self, ConnectionClass *conn)
 {
-	int			i;
+int i;
 
-	mylog("EN_add_connection: self = %u, conn = %u\n", self, conn);
+mylog("EN_add_connection: self = %u, conn = %u\n", self, conn);
 
-	for (i = 0; i < MAX_CONNECTIONS; i++)
-	{
-		if (!conns[i])
-		{
+	for (i = 0; i < MAX_CONNECTIONS; i++) {
+		if ( ! conns[i]) {
 			conn->henv = self;
 			conns[i] = conn;
 
@@ -489,11 +456,10 @@ EN_add_connection(EnvironmentClass *self, ConnectionClass *conn)
 char
 EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn)
 {
-	int			i;
+int i;
 
 	for (i = 0; i < MAX_CONNECTIONS; i++)
-		if (conns[i] == conn && conns[i]->status != CONN_EXECUTING)
-		{
+		if (conns[i] == conn && conns[i]->status != CONN_EXECUTING) {
 			conns[i] = NULL;
 			return TRUE;
 		}
@@ -504,8 +470,9 @@ EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn)
 void
 EN_log_error(char *func, char *desc, EnvironmentClass *self)
 {
-	if (self)
+	if (self) {
 		qlog("ENVIRON ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, self->errormsg);
+	}
 	else
 		qlog("INVALID ENVIRON HANDLE ERROR: func=%s, desc='%s'\n", func, desc);
 }
diff --git a/src/interfaces/odbc/environ.h b/src/interfaces/odbc/environ.h
index c236e575c1e933f1c2b87d37e17f20aadda97a5b..47018e7b38f2f5f108e8c1fab1431cc884541df8 100644
--- a/src/interfaces/odbc/environ.h
+++ b/src/interfaces/odbc/environ.h
@@ -1,9 +1,9 @@
 
-/* File:			environ.h
+/* File:            environ.h
  *
- * Description:		See "environ.c"
+ * Description:     See "environ.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -29,18 +29,17 @@
 #define ENV_ALLOC_ERROR 1
 
 /**********		Environment Handle	*************/
-struct EnvironmentClass_
-{
-	char	   *errormsg;
-	int			errornumber;
+struct EnvironmentClass_ {
+	char *errormsg;
+	int errornumber;
 };
 
 /*	Environment prototypes */
 EnvironmentClass *EN_Constructor(void);
-char		EN_Destructor(EnvironmentClass *self);
-char		EN_get_error(EnvironmentClass *self, int *number, char **message);
-char		EN_add_connection(EnvironmentClass *self, ConnectionClass *conn);
-char		EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn);
-void		EN_log_error(char *func, char *desc, EnvironmentClass *self);
+char EN_Destructor(EnvironmentClass *self);
+char EN_get_error(EnvironmentClass *self, int *number, char **message);
+char EN_add_connection(EnvironmentClass *self, ConnectionClass *conn);
+char EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn);
+void EN_log_error(char *func, char *desc, EnvironmentClass *self);
 
 #endif
diff --git a/src/interfaces/odbc/execute.c b/src/interfaces/odbc/execute.c
index ac7f2ee30f43b32748d2bc392bd96c105e46dd42..ac5d0b19c38dd17c7430ca69239f444e0606a4eb 100644
--- a/src/interfaces/odbc/execute.c
+++ b/src/interfaces/odbc/execute.c
@@ -1,14 +1,15 @@
-/* Module:			execute.c
+
+/* Module:          execute.c
  *
- * Description:		This module contains routines related to
- *					preparing and executing an SQL statement.
+ * Description:     This module contains routines related to 
+ *                  preparing and executing an SQL statement.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	SQLPrepare, SQLExecute, SQLExecDirect, SQLTransact,
- *					SQLCancel, SQLNativeSql, SQLParamData, SQLPutData
+ * API functions:   SQLPrepare, SQLExecute, SQLExecDirect, SQLTransact,
+ *                  SQLCancel, SQLNativeSql, SQLParamData, SQLPutData
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -38,74 +39,66 @@
 extern GLOBAL_VALUES globals;
 
 
-/*		Perform a Prepare on the SQL statement */
-RETCODE SQL_API
-SQLPrepare(HSTMT hstmt,
-		   UCHAR FAR *szSqlStr,
-		   SDWORD cbSqlStr)
+/*      Perform a Prepare on the SQL statement */
+RETCODE SQL_API SQLPrepare(HSTMT     hstmt,
+                           UCHAR FAR *szSqlStr,
+                           SDWORD    cbSqlStr)
 {
-	static char *func = "SQLPrepare";
-	StatementClass *self = (StatementClass *) hstmt;
+static char *func = "SQLPrepare";
+StatementClass *self = (StatementClass *) hstmt;
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!self)
-	{
+	if ( ! self) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
+    
+	/*	According to the ODBC specs it is valid to call SQLPrepare mulitple times.
+		In that case, the bound SQL statement is replaced by the new one 
+	*/
 
-	/*
-	 * According to the ODBC specs it is valid to call SQLPrepare mulitple
-	 * times. In that case, the bound SQL statement is replaced by the new
-	 * one
-	 */
-
-	switch (self->status)
-	{
-		case STMT_PREMATURE:
-			mylog("**** SQLPrepare: STMT_PREMATURE, recycle\n");
-			SC_recycle_statement(self); /* recycle the statement, but do
-										 * not remove parameter bindings */
-			break;
+	switch(self->status) {
+	case STMT_PREMATURE:
+		mylog("**** SQLPrepare: STMT_PREMATURE, recycle\n");
+		SC_recycle_statement(self); /* recycle the statement, but do not remove parameter bindings */
+		break;
 
-		case STMT_FINISHED:
-			mylog("**** SQLPrepare: STMT_FINISHED, recycle\n");
-			SC_recycle_statement(self); /* recycle the statement, but do
-										 * not remove parameter bindings */
-			break;
+	case STMT_FINISHED:
+		mylog("**** SQLPrepare: STMT_FINISHED, recycle\n");
+		SC_recycle_statement(self); /* recycle the statement, but do not remove parameter bindings */
+		break;
 
-		case STMT_ALLOCATED:
-			mylog("**** SQLPrepare: STMT_ALLOCATED, copy\n");
-			self->status = STMT_READY;
-			break;
+	case STMT_ALLOCATED:
+		mylog("**** SQLPrepare: STMT_ALLOCATED, copy\n");
+		self->status = STMT_READY;
+		break;
 
-		case STMT_READY:
-			mylog("**** SQLPrepare: STMT_READY, change SQL\n");
-			break;
+	case STMT_READY:
+		mylog("**** SQLPrepare: STMT_READY, change SQL\n");
+		break;
 
-		case STMT_EXECUTING:
-			mylog("**** SQLPrepare: STMT_EXECUTING, error!\n");
+	case STMT_EXECUTING:
+		mylog("**** SQLPrepare: STMT_EXECUTING, error!\n");
 
-			self->errornumber = STMT_SEQUENCE_ERROR;
-			self->errormsg = "SQLPrepare(): The handle does not point to a statement that is ready to be executed";
-			SC_log_error(func, "", self);
+		self->errornumber = STMT_SEQUENCE_ERROR;
+		self->errormsg = "SQLPrepare(): The handle does not point to a statement that is ready to be executed";
+		SC_log_error(func, "", self);
 
-			return SQL_ERROR;
+		return SQL_ERROR;
 
-		default:
-			self->errornumber = STMT_INTERNAL_ERROR;
-			self->errormsg = "An Internal Error has occured -- Unknown statement status.";
-			SC_log_error(func, "", self);
-			return SQL_ERROR;
+	default:
+		self->errornumber = STMT_INTERNAL_ERROR;
+		self->errormsg = "An Internal Error has occured -- Unknown statement status.";
+		SC_log_error(func, "", self);
+		return SQL_ERROR;
 	}
 
 	if (self->statement)
 		free(self->statement);
 
 	self->statement = make_string(szSqlStr, cbSqlStr, NULL);
-	if (!self->statement)
-	{
+	if ( ! self->statement) {
 		self->errornumber = STMT_NO_MEMORY_ERROR;
 		self->errormsg = "No memory available to store statement";
 		SC_log_error(func, "", self);
@@ -115,9 +108,8 @@ SQLPrepare(HSTMT hstmt,
 	self->prepare = TRUE;
 	self->statement_type = statement_type(self->statement);
 
-	/* Check if connection is onlyread (only selects are allowed) */
-	if (CC_is_onlyread(self->hdbc) && STMT_UPDATE(self))
-	{
+	/*	Check if connection is onlyread (only selects are allowed) */
+	if ( CC_is_onlyread(self->hdbc) && STMT_UPDATE(self)) {
 		self->errornumber = STMT_EXEC_ERROR;
 		self->errormsg = "Connection is readonly, only select statements are allowed.";
 		SC_log_error(func, "", self);
@@ -129,24 +121,22 @@ SQLPrepare(HSTMT hstmt,
 
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-/*		Performs the equivalent of SQLPrepare, followed by SQLExecute. */
+/*      Performs the equivalent of SQLPrepare, followed by SQLExecute. */
 
-RETCODE SQL_API
-SQLExecDirect(
-			  HSTMT hstmt,
-			  UCHAR FAR *szSqlStr,
-			  SDWORD cbSqlStr)
+RETCODE SQL_API SQLExecDirect(
+        HSTMT     hstmt,
+        UCHAR FAR *szSqlStr,
+        SDWORD    cbSqlStr)
 {
-	StatementClass *stmt = (StatementClass *) hstmt;
-	RETCODE		result;
-	static char *func = "SQLExecDirect";
+StatementClass *stmt = (StatementClass *) hstmt;
+RETCODE result;
+static char *func = "SQLExecDirect";
 
-	mylog("%s: entering...\n", func);
-
-	if (!stmt)
-	{
+	mylog( "%s: entering...\n", func);
+    
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -157,8 +147,7 @@ SQLExecDirect(
 	/* keep a copy of the un-parametrized statement, in case */
 	/* they try to execute this statement again */
 	stmt->statement = make_string(szSqlStr, cbSqlStr, NULL);
-	if (!stmt->statement)
-	{
+	if ( ! stmt->statement) {
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "No memory available to store statement";
 		SC_log_error(func, "", stmt);
@@ -172,20 +161,19 @@ SQLExecDirect(
 	/* If an SQLPrepare was performed prior to this, but was left in  */
 	/* the premature state because an error occurred prior to SQLExecute */
 	/* then set the statement to finished so it can be recycled. */
-	if (stmt->status == STMT_PREMATURE)
+	if ( stmt->status == STMT_PREMATURE )
 		stmt->status = STMT_FINISHED;
 
 	stmt->statement_type = statement_type(stmt->statement);
 
-	/* Check if connection is onlyread (only selects are allowed) */
-	if (CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt))
-	{
+	/*	Check if connection is onlyread (only selects are allowed) */
+	if ( CC_is_onlyread(stmt->hdbc) && STMT_UPDATE(stmt)) {
 		stmt->errornumber = STMT_EXEC_ERROR;
 		stmt->errormsg = "Connection is readonly, only select statements are allowed.";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
-
+	
 	mylog("%s: calling SQLExecute...\n", func);
 
 	result = SQLExecute(hstmt);
@@ -194,55 +182,47 @@ SQLExecDirect(
 	return result;
 }
 
-/*		Execute a prepared SQL statement */
-RETCODE SQL_API
-SQLExecute(
-		   HSTMT hstmt)
+/*      Execute a prepared SQL statement */
+RETCODE SQL_API SQLExecute(
+        HSTMT   hstmt)
 {
-	static char *func = "SQLExecute";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	ConnectionClass *conn;
-	int			i,
-				retval;
+static char *func="SQLExecute";
+StatementClass *stmt = (StatementClass *) hstmt;
+ConnectionClass *conn;
+int i, retval;
 
 
 	mylog("%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		mylog("%s: NULL statement so return SQL_INVALID_HANDLE\n", func);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/*
-	 * If the statement is premature, it means we already executed it from
-	 * an SQLPrepare/SQLDescribeCol type of scenario.  So just return
-	 * success.
-	 */
-	if (stmt->prepare && stmt->status == STMT_PREMATURE)
-	{
-		stmt->status = STMT_FINISHED;
-		if (stmt->errormsg == NULL)
-		{
+	/*  If the statement is premature, it means we already executed
+		it from an SQLPrepare/SQLDescribeCol type of scenario.  So
+		just return success.
+	*/
+	if ( stmt->prepare && stmt->status == STMT_PREMATURE) {
+		stmt->status = STMT_FINISHED;       
+		if (stmt->errormsg == NULL) {
 			mylog("%s: premature statement but return SQL_SUCCESS\n", func);
 			return SQL_SUCCESS;
 		}
-		else
-		{
+		else {
 			SC_log_error(func, "", stmt);
 			mylog("%s: premature statement so return SQL_ERROR\n", func);
 			return SQL_ERROR;
 		}
-	}
+	}  
 
 	mylog("%s: clear errors...\n", func);
 
 	SC_clear_error(stmt);
 
 	conn = SC_get_conn(stmt);
-	if (conn->status == CONN_EXECUTING)
-	{
+	if (conn->status == CONN_EXECUTING) {
 		stmt->errormsg = "Connection is already in use.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
@@ -250,8 +230,7 @@ SQLExecute(
 		return SQL_ERROR;
 	}
 
-	if (!stmt->statement)
-	{
+	if ( ! stmt->statement) {
 		stmt->errornumber = STMT_NO_STMTSTRING;
 		stmt->errormsg = "This handle does not have a SQL statement stored in it";
 		SC_log_error(func, "", stmt);
@@ -259,21 +238,19 @@ SQLExecute(
 		return SQL_ERROR;
 	}
 
-	/*
-	 * If SQLExecute is being called again, recycle the statement. Note
-	 * this should have been done by the application in a call to
-	 * SQLFreeStmt(SQL_CLOSE) or SQLCancel.
-	 */
-	if (stmt->status == STMT_FINISHED)
-	{
+	/*	If SQLExecute is being called again, recycle the statement.
+		Note this should have been done by the application in a call
+		to SQLFreeStmt(SQL_CLOSE) or SQLCancel.
+	*/
+	if (stmt->status == STMT_FINISHED) {
 		mylog("%s: recycling statement (should have been done by app)...\n", func);
 		SC_recycle_statement(stmt);
 	}
 
-	/* Check if the statement is in the correct state */
-	if ((stmt->prepare && stmt->status != STMT_READY) ||
-		(stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY))
-	{
+	/*	Check if the statement is in the correct state */
+	if ((stmt->prepare && stmt->status != STMT_READY) || 
+		(stmt->status != STMT_ALLOCATED && stmt->status != STMT_READY)) {
+		
 		stmt->errornumber = STMT_STATUS_ERROR;
 		stmt->errormsg = "The handle does not point to a statement that is ready to be executed";
 		SC_log_error(func, "", stmt);
@@ -282,37 +259,30 @@ SQLExecute(
 	}
 
 
-	/*
-	 * The bound parameters could have possibly changed since the last
-	 * execute of this statement?  Therefore check for params and re-copy.
-	 */
+	/*	The bound parameters could have possibly changed since the last execute
+		of this statement?  Therefore check for params and re-copy.
+	*/
 	stmt->data_at_exec = -1;
-	for (i = 0; i < stmt->parameters_allocated; i++)
-	{
-		/* Check for data at execution parameters */
-		if (stmt->parameters[i].data_at_exec == TRUE)
-		{
+	for (i = 0; i < stmt->parameters_allocated; i++) {
+		/*	Check for data at execution parameters */
+		if ( stmt->parameters[i].data_at_exec == TRUE) {
 			if (stmt->data_at_exec < 0)
 				stmt->data_at_exec = 1;
 			else
 				stmt->data_at_exec++;
 		}
 	}
-	/* If there are some data at execution parameters, return need data */
-
-	/*
-	 * SQLParamData and SQLPutData will be used to send params and execute
-	 * the statement.
-	 */
+	/*	If there are some data at execution parameters, return need data */
+	/*	SQLParamData and SQLPutData will be used to send params and execute the statement. */
 	if (stmt->data_at_exec > 0)
 		return SQL_NEED_DATA;
 
 
 	mylog("%s: copying statement params: trans_status=%d, len=%d, stmt='%s'\n", func, conn->transact_status, strlen(stmt->statement), stmt->statement);
 
-	/* Create the statement with parameters substituted. */
+	/*	Create the statement with parameters substituted. */
 	retval = copy_statement_with_parameters(stmt);
-	if (retval != SQL_SUCCESS)
+	if( retval != SQL_SUCCESS)
 		/* error msg passed from above */
 		return retval;
 
@@ -320,144 +290,131 @@ SQLExecute(
 
 
 	return SC_execute(stmt);
+
 }
 
 
 
 
-/*		-		-		-		-		-		-		-		-		- */
-RETCODE SQL_API
-SQLTransact(
-			HENV henv,
-			HDBC hdbc,
-			UWORD fType)
+/*      -       -       -       -       -       -       -       -       - */
+RETCODE SQL_API SQLTransact(
+        HENV    henv,
+        HDBC    hdbc,
+        UWORD   fType)
 {
-	static char *func = "SQLTransact";
-	extern ConnectionClass *conns[];
-	ConnectionClass *conn;
-	QResultClass *res;
-	char		ok,
-			   *stmt_string;
-	int			lf;
+static char *func = "SQLTransact";
+extern ConnectionClass *conns[];
+ConnectionClass *conn;
+QResultClass *res;
+char ok, *stmt_string;
+int lf;
 
 	mylog("entering %s: hdbc=%u, henv=%u\n", func, hdbc, henv);
 
-	if (hdbc == SQL_NULL_HDBC && henv == SQL_NULL_HENV)
-	{
+	if (hdbc == SQL_NULL_HDBC && henv == SQL_NULL_HENV) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/*
-	 * If hdbc is null and henv is valid, it means transact all
-	 * connections on that henv.
-	 */
-	if (hdbc == SQL_NULL_HDBC && henv != SQL_NULL_HENV)
-	{
-		for (lf = 0; lf < MAX_CONNECTIONS; lf++)
-		{
+	/* If hdbc is null and henv is valid,
+	it means transact all connections on that henv.  
+	*/
+	if (hdbc == SQL_NULL_HDBC && henv != SQL_NULL_HENV) {
+		for (lf=0; lf <MAX_CONNECTIONS; lf++) {
 			conn = conns[lf];
 
 			if (conn && conn->henv == henv)
-				if (SQLTransact(henv, (HDBC) conn, fType) != SQL_SUCCESS)
+				if ( SQLTransact(henv, (HDBC) conn, fType) != SQL_SUCCESS)
 					return SQL_ERROR;
+
 		}
-		return SQL_SUCCESS;
+		return SQL_SUCCESS;       
 	}
 
 	conn = (ConnectionClass *) hdbc;
 
-	if (fType == SQL_COMMIT)
+	if (fType == SQL_COMMIT) {
 		stmt_string = "COMMIT";
-	else if (fType == SQL_ROLLBACK)
+
+	} else if (fType == SQL_ROLLBACK) {
 		stmt_string = "ROLLBACK";
-	else
-	{
+
+	} else {
 		conn->errornumber = CONN_INVALID_ARGUMENT_NO;
-		conn->errormsg = "SQLTransact can only be called with SQL_COMMIT or SQL_ROLLBACK as parameter";
+		conn->errormsg ="SQLTransact can only be called with SQL_COMMIT or SQL_ROLLBACK as parameter";
 		CC_log_error(func, "", conn);
 		return SQL_ERROR;
-	}
+	}    
+
+	/*	If manual commit and in transaction, then proceed. */
+	if ( ! CC_is_in_autocommit(conn) &&  CC_is_in_trans(conn)) {
 
-	/* If manual commit and in transaction, then proceed. */
-	if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
-	{
 		mylog("SQLTransact: sending on conn %d '%s'\n", conn, stmt_string);
 
 		res = CC_send_query(conn, stmt_string, NULL);
 		CC_set_no_trans(conn);
 
-		if (!res)
-		{
-			/* error msg will be in the connection */
+		if ( ! res) {
+			/*	error msg will be in the connection */
 			CC_log_error(func, "", conn);
 			return SQL_ERROR;
 		}
 
-		ok = QR_command_successful(res);
+		ok = QR_command_successful(res);   
 		QR_Destructor(res);
 
-		if (!ok)
-		{
+		if (!ok) {
 			CC_log_error(func, "", conn);
 			return SQL_ERROR;
 		}
-	}
+	}    
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLCancel(
-		  HSTMT hstmt)			/* Statement to cancel. */
+RETCODE SQL_API SQLCancel(
+        HSTMT   hstmt)  /* Statement to cancel. */
 {
-	static char *func = "SQLCancel";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	RETCODE		result;
-
+static char *func="SQLCancel";
+StatementClass *stmt = (StatementClass *) hstmt;
+RETCODE result;
 #ifdef WIN32
-	HMODULE		hmodule;
-	FARPROC		addr;
-
+HMODULE hmodule;
+FARPROC addr;
 #endif
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	/* Check if this can handle canceling in the middle of a SQLPutData? */
-	if (!stmt)
-	{
+	/*	Check if this can handle canceling in the middle of a SQLPutData? */
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	/*
-	 * Not in the middle of SQLParamData/SQLPutData so cancel like a
-	 * close.
-	 */
-	if (stmt->data_at_exec < 0)
-	{
-
-		/*
-		 * MAJOR HACK for Windows to reset the driver manager's cursor
-		 * state: Because of what seems like a bug in the Odbc driver
-		 * manager, SQLCancel does not act like a SQLFreeStmt(CLOSE), as
-		 * many applications depend on this behavior.  So, this brute
-		 * force method calls the driver manager's function on behalf of
-		 * the application.
-		 */
+	/*	Not in the middle of SQLParamData/SQLPutData so cancel like a close. */
+	if (stmt->data_at_exec < 0) {
+
+
+		/*	MAJOR HACK for Windows to reset the driver manager's cursor state:
+			Because of what seems like a bug in the Odbc driver manager,
+			SQLCancel does not act like a SQLFreeStmt(CLOSE), as many
+			applications depend on this behavior.  So, this 
+			brute force method calls the driver manager's function on
+			behalf of the application.  
+		*/
 
 #ifdef WIN32
-		if (globals.cancel_as_freestmt)
-		{
+		if (globals.cancel_as_freestmt) {
 			hmodule = GetModuleHandle("ODBC32");
 			addr = GetProcAddress(hmodule, "SQLFreeStmt");
-			result = addr((char *) (stmt->phstmt) - 96, SQL_CLOSE);
+			result = addr( (char *) (stmt->phstmt) - 96, SQL_CLOSE);
+		}
+		else {
+			result = SQLFreeStmt( hstmt, SQL_CLOSE);
 		}
-		else
-			result = SQLFreeStmt(hstmt, SQL_CLOSE);
 #else
-		result = SQLFreeStmt(hstmt, SQL_CLOSE);
+		result = SQLFreeStmt( hstmt, SQL_CLOSE);
 #endif
 
 		mylog("SQLCancel:  SQLFreeStmt returned %d\n", result);
@@ -466,46 +423,41 @@ SQLCancel(
 		return SQL_SUCCESS;
 	}
 
-	/* In the middle of SQLParamData/SQLPutData, so cancel that. */
-
-	/*
-	 * Note, any previous data-at-exec buffers will be freed in the
-	 * recycle
-	 */
-	/* if they call SQLExecDirect or SQLExecute again. */
+	/*	In the middle of SQLParamData/SQLPutData, so cancel that. */
+	/*	Note, any previous data-at-exec buffers will be freed in the recycle */
+	/*	if they call SQLExecDirect or SQLExecute again. */
 
 	stmt->data_at_exec = -1;
 	stmt->current_exec_param = -1;
 	stmt->put_data = FALSE;
 
 	return SQL_SUCCESS;
+
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-/*		Returns the SQL string as modified by the driver. */
+/*      Returns the SQL string as modified by the driver. */
 /*		Currently, just copy the input string without modification */
 /*		observing buffer limits and truncation. */
-RETCODE SQL_API
-SQLNativeSql(
-			 HDBC hdbc,
-			 UCHAR FAR *szSqlStrIn,
-			 SDWORD cbSqlStrIn,
-			 UCHAR FAR *szSqlStr,
-			 SDWORD cbSqlStrMax,
-			 SDWORD FAR *pcbSqlStr)
+RETCODE SQL_API SQLNativeSql(
+        HDBC      hdbc,
+        UCHAR FAR *szSqlStrIn,
+        SDWORD     cbSqlStrIn,
+        UCHAR FAR *szSqlStr,
+        SDWORD     cbSqlStrMax,
+        SDWORD FAR *pcbSqlStr)
 {
-	static char *func = "SQLNativeSql";
-	int			len = 0;
-	char	   *ptr;
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	RETCODE		result;
+static char *func="SQLNativeSql";
+int len = 0;
+char *ptr;
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+RETCODE result;
 
-	mylog("%s: entering...cbSqlStrIn=%d\n", func, cbSqlStrIn);
+	mylog( "%s: entering...cbSqlStrIn=%d\n", func, cbSqlStrIn);
 
 	ptr = (cbSqlStrIn == 0) ? "" : make_string(szSqlStrIn, cbSqlStrIn, NULL);
-	if (!ptr)
-	{
+	if ( ! ptr) {
 		conn->errornumber = CONN_NO_MEMORY_ERROR;
 		conn->errormsg = "No memory available to store native sql string";
 		CC_log_error(func, "", conn);
@@ -515,12 +467,10 @@ SQLNativeSql(
 	result = SQL_SUCCESS;
 	len = strlen(ptr);
 
-	if (szSqlStr)
-	{
+	if (szSqlStr) {
 		strncpy_null(szSqlStr, ptr, cbSqlStrMax);
 
-		if (len >= cbSqlStrMax)
-		{
+		if (len >= cbSqlStrMax)  {
 			result = SQL_SUCCESS_WITH_INFO;
 			conn->errornumber = STMT_TRUNCATED;
 			conn->errormsg = "The buffer was too small for the result.";
@@ -532,44 +482,39 @@ SQLNativeSql(
 
 	free(ptr);
 
-	return result;
+    return result;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-/*		Supplies parameter data at execution time.		Used in conjuction with */
-/*		SQLPutData. */
+/*      Supplies parameter data at execution time.      Used in conjuction with */
+/*      SQLPutData. */
 
-RETCODE SQL_API
-SQLParamData(
-			 HSTMT hstmt,
-			 PTR FAR *prgbValue)
+RETCODE SQL_API SQLParamData(
+        HSTMT   hstmt,
+        PTR FAR *prgbValue)
 {
-	static char *func = "SQLParamData";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	int			i,
-				retval;
+static char *func = "SQLParamData";
+StatementClass *stmt = (StatementClass *) hstmt;
+int i, retval;
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	mylog("%s: data_at_exec=%d, params_alloc=%d\n", func, stmt->data_at_exec, stmt->parameters_allocated);
 
-	if (stmt->data_at_exec < 0)
-	{
+	if (stmt->data_at_exec < 0) {
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		stmt->errormsg = "No execution-time parameters for this statement";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->data_at_exec > stmt->parameters_allocated)
-	{
+	if (stmt->data_at_exec > stmt->parameters_allocated) {
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		stmt->errormsg = "Too many execution-time parameters were present";
 		SC_log_error(func, "", stmt);
@@ -577,19 +522,16 @@ SQLParamData(
 	}
 
 	/* close the large object */
-	if (stmt->lobj_fd >= 0)
-	{
+	if ( stmt->lobj_fd >= 0) {
 		lo_close(stmt->hdbc, stmt->lobj_fd);
 
 		/* commit transaction if needed */
-		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc))
-		{
+		if (!globals.use_declarefetch && CC_is_in_autocommit(stmt->hdbc)) {
 			QResultClass *res;
-			char		ok;
+			char ok;
 
 			res = CC_send_query(stmt->hdbc, "COMMIT", NULL);
-			if (!res)
-			{
+			if (!res) {
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				SC_log_error(func, "", stmt);
@@ -597,8 +539,7 @@ SQLParamData(
 			}
 			ok = QR_command_successful(res);
 			QR_Destructor(res);
-			if (!ok)
-			{
+			if (!ok) {
 				stmt->errormsg = "Could not commit (in-line) a transaction";
 				stmt->errornumber = STMT_EXEC_ERROR;
 				SC_log_error(func, "", stmt);
@@ -612,9 +553,8 @@ SQLParamData(
 	}
 
 
-	/* Done, now copy the params and then execute the statement */
-	if (stmt->data_at_exec == 0)
-	{
+	/*	Done, now copy the params and then execute the statement */
+	if (stmt->data_at_exec == 0) {
 		retval = copy_statement_with_parameters(stmt);
 		if (retval != SQL_SUCCESS)
 			return retval;
@@ -624,17 +564,14 @@ SQLParamData(
 		return SC_execute(stmt);
 	}
 
-	/*
-	 * Set beginning param;  if first time SQLParamData is called , start
-	 * at 0. Otherwise, start at the last parameter + 1.
-	 */
-	i = stmt->current_exec_param >= 0 ? stmt->current_exec_param + 1 : 0;
-
-	/* At least 1 data at execution parameter, so Fill in the token value */
-	for (; i < stmt->parameters_allocated; i++)
-	{
-		if (stmt->parameters[i].data_at_exec == TRUE)
-		{
+	/*	Set beginning param;  if first time SQLParamData is called , start at 0.
+		Otherwise, start at the last parameter + 1.
+	*/
+	i = stmt->current_exec_param >= 0 ? stmt->current_exec_param+1 : 0;
+
+	/*	At least 1 data at execution parameter, so Fill in the token value */
+	for ( ; i < stmt->parameters_allocated; i++) {
+		if (stmt->parameters[i].data_at_exec == TRUE) {
 			stmt->data_at_exec--;
 			stmt->current_exec_param = i;
 			stmt->put_data = FALSE;
@@ -646,35 +583,31 @@ SQLParamData(
 	return SQL_NEED_DATA;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-/*		Supplies parameter data at execution time.		Used in conjunction with */
-/*		SQLParamData. */
+/*      Supplies parameter data at execution time.      Used in conjunction with */
+/*      SQLParamData. */
 
-RETCODE SQL_API
-SQLPutData(
-		   HSTMT hstmt,
-		   PTR rgbValue,
-		   SDWORD cbValue)
+RETCODE SQL_API SQLPutData(
+        HSTMT   hstmt,
+        PTR     rgbValue,
+        SDWORD  cbValue)
 {
-	static char *func = "SQLPutData";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	int			old_pos,
-				retval;
-	ParameterInfoClass *current_param;
-	char	   *buffer;
+static char *func = "SQLPutData";
+StatementClass *stmt = (StatementClass *) hstmt;
+int old_pos, retval;
+ParameterInfoClass *current_param;
+char *buffer;
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-
-	if (stmt->current_exec_param < 0)
-	{
+	
+	if (stmt->current_exec_param < 0) {
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		stmt->errormsg = "Previous call was not SQLPutData or SQLParamData";
 		SC_log_error(func, "", stmt);
@@ -683,16 +616,14 @@ SQLPutData(
 
 	current_param = &(stmt->parameters[stmt->current_exec_param]);
 
-	if (!stmt->put_data)
-	{							/* first call */
+	if ( ! stmt->put_data) {	/* first call */
 
 		mylog("SQLPutData: (1) cbValue = %d\n", cbValue);
 
 		stmt->put_data = TRUE;
 
 		current_param->EXEC_used = (SDWORD *) malloc(sizeof(SDWORD));
-		if (!current_param->EXEC_used)
-		{
+		if ( ! current_param->EXEC_used) {
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Out of memory in SQLPutData (1)";
 			SC_log_error(func, "", stmt);
@@ -705,18 +636,16 @@ SQLPutData(
 			return SQL_SUCCESS;
 
 
-		/* Handle Long Var Binary with Large Objects */
-		if (current_param->SQLType == SQL_LONGVARBINARY)
-		{
+		/*	Handle Long Var Binary with Large Objects */
+		if ( current_param->SQLType == SQL_LONGVARBINARY) {
+
 			/* begin transaction if needed */
-			if (!CC_is_in_trans(stmt->hdbc))
-			{
+			if(!CC_is_in_trans(stmt->hdbc)) {
 				QResultClass *res;
-				char		ok;
+				char ok;
 
 				res = CC_send_query(stmt->hdbc, "BEGIN", NULL);
-				if (!res)
-				{
+				if (!res) {
 					stmt->errormsg = "Could not begin (in-line) a transaction";
 					stmt->errornumber = STMT_EXEC_ERROR;
 					SC_log_error(func, "", stmt);
@@ -724,8 +653,7 @@ SQLPutData(
 				}
 				ok = QR_command_successful(res);
 				QR_Destructor(res);
-				if (!ok)
-				{
+				if (!ok) {
 					stmt->errormsg = "Could not begin (in-line) a transaction";
 					stmt->errornumber = STMT_EXEC_ERROR;
 					SC_log_error(func, "", stmt);
@@ -735,24 +663,22 @@ SQLPutData(
 				CC_set_in_trans(stmt->hdbc);
 			}
 
-			/* store the oid */
+			/*	store the oid */
 			current_param->lobj_oid = lo_creat(stmt->hdbc, INV_READ | INV_WRITE);
-			if (current_param->lobj_oid == 0)
-			{
+			if (current_param->lobj_oid == 0) {
 				stmt->errornumber = STMT_EXEC_ERROR;
 				stmt->errormsg = "Couldnt create large object.";
 				SC_log_error(func, "", stmt);
 				return SQL_ERROR;
 			}
 
-			/* major hack -- to allow convert to see somethings there */
-			/* have to modify convert to handle this better */
+			/*	major hack -- to allow convert to see somethings there */
+			/*					have to modify convert to handle this better */
 			current_param->EXEC_buffer = (char *) &current_param->lobj_oid;
 
-			/* store the fd */
+			/*	store the fd */
 			stmt->lobj_fd = lo_open(stmt->hdbc, current_param->lobj_oid, INV_WRITE);
-			if (stmt->lobj_fd < 0)
-			{
+			if ( stmt->lobj_fd < 0) {
 				stmt->errornumber = STMT_EXEC_ERROR;
 				stmt->errormsg = "Couldnt open large object for writing.";
 				SC_log_error(func, "", stmt);
@@ -761,27 +687,22 @@ SQLPutData(
 
 			retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue);
 			mylog("lo_write: cbValue=%d, wrote %d bytes\n", cbValue, retval);
+
 		}
-		else
-		{						/* for handling text fields and small
-								 * binaries */
+		else {	/* for handling text fields and small binaries */
 
-			if (cbValue == SQL_NTS)
-			{
+			if (cbValue == SQL_NTS) {
 				current_param->EXEC_buffer = strdup(rgbValue);
-				if (!current_param->EXEC_buffer)
-				{
+				if ( ! current_param->EXEC_buffer) {
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (2)";
 					SC_log_error(func, "", stmt);
 					return SQL_ERROR;
 				}
 			}
-			else
-			{
+			else {
 				current_param->EXEC_buffer = malloc(cbValue + 1);
-				if (!current_param->EXEC_buffer)
-				{
+				if ( ! current_param->EXEC_buffer) {
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (2)";
 					SC_log_error(func, "", stmt);
@@ -793,28 +714,25 @@ SQLPutData(
 		}
 	}
 
-	else
-	{							/* calling SQLPutData more than once */
+	else {	/* calling SQLPutData more than once */
 
 		mylog("SQLPutData: (>1) cbValue = %d\n", cbValue);
 
-		if (current_param->SQLType == SQL_LONGVARBINARY)
-		{
+		if (current_param->SQLType == SQL_LONGVARBINARY) {
+
 			/* the large object fd is in EXEC_buffer */
 			retval = lo_write(stmt->hdbc, stmt->lobj_fd, rgbValue, cbValue);
 			mylog("lo_write(2): cbValue = %d, wrote %d bytes\n", cbValue, retval);
 
 			*current_param->EXEC_used += cbValue;
-		}
-		else
-		{
+
+		} else {
+
 			buffer = current_param->EXEC_buffer;
 
-			if (cbValue == SQL_NTS)
-			{
+			if (cbValue == SQL_NTS) {
 				buffer = realloc(buffer, strlen(buffer) + strlen(rgbValue) + 1);
-				if (!buffer)
-				{
+				if ( ! buffer) {
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (3)";
 					SC_log_error(func, "", stmt);
@@ -826,11 +744,12 @@ SQLPutData(
 
 				*current_param->EXEC_used = cbValue;
 
-				/* reassign buffer incase realloc moved it */
+				/*	reassign buffer incase realloc moved it */
 				current_param->EXEC_buffer = buffer;
+
 			}
-			else if (cbValue > 0)
-			{
+			else if (cbValue > 0) {
+
 				old_pos = *current_param->EXEC_used;
 
 				*current_param->EXEC_used += cbValue;
@@ -839,8 +758,7 @@ SQLPutData(
 
 				/* dont lose the old pointer in case out of memory */
 				buffer = realloc(current_param->EXEC_buffer, *current_param->EXEC_used + 1);
-				if (!buffer)
-				{
+				if ( ! buffer) {
 					stmt->errornumber = STMT_NO_MEMORY_ERROR;
 					stmt->errormsg = "Out of memory in SQLPutData (3)";
 					SC_log_error(func, "", stmt);
@@ -850,14 +768,15 @@ SQLPutData(
 				memcpy(&buffer[old_pos], rgbValue, cbValue);
 				buffer[*current_param->EXEC_used] = '\0';
 
-				/* reassign buffer incase realloc moved it */
+				/*	reassign buffer incase realloc moved it */
 				current_param->EXEC_buffer = buffer;
+				
 			}
-			else
-			{
+			else {
 				SC_log_error(func, "bad cbValue", stmt);
 				return SQL_ERROR;
 			}
+
 		}
 	}
 
diff --git a/src/interfaces/odbc/gpps.c b/src/interfaces/odbc/gpps.c
index 6f693009659584324e0452415301b2780fa9595c..f14e95f2ce4176da77e61dc78043eda0539eb716 100644
--- a/src/interfaces/odbc/gpps.c
+++ b/src/interfaces/odbc/gpps.c
@@ -13,7 +13,7 @@
 #ifndef WIN32
 
 #if HAVE_CONFIG_H
-#include "config.h"				/* produced by configure */
+#include "config.h"	/* produced by configure */
 #endif
 
 #include <stdio.h>
@@ -38,87 +38,83 @@
 
 
 DWORD
-GetPrivateProfileString(char *theSection,		/* section name */
-						char *theKey,	/* search key name */
-						char *theDefault,		/* default value if not
-												 * found */
-						char *theReturnBuffer,	/* return value stored
-												 * here */
-						size_t theReturnBufferLength,	/* byte length of return
-														 * buffer */
-						char *theIniFileName)	/* pathname of ini file to
-												 * search */
+GetPrivateProfileString(char *theSection,	/* section name */
+			char *theKey,		/* search key name */
+			char *theDefault,	/* default value if not found */
+			char *theReturnBuffer,	/* return value stored here */
+			size_t theReturnBufferLength,	/* byte length of return buffer */
+			char *theIniFileName)		/* pathname of ini file to search */
 {
-	char		buf[MAXPGPATH];
-	char	   *ptr = 0;
-	FILE	   *aFile = 0;
-	size_t		aLength;
-	char		aLine[2048];
-	char	   *aValue;
-	char	   *aStart;
-	char	   *aString;
-	size_t		aLineLength;
-	size_t		aReturnLength = 0;
-
-	BOOL		aSectionFound = FALSE;
-	BOOL		aKeyFound = FALSE;
-	int			j = 0;
+	char buf[MAXPGPATH];
+	char* ptr = 0;
+	FILE* aFile = 0;
+	size_t aLength;
+	char aLine[2048];
+	char *aValue;
+	char *aStart;
+	char *aString;
+	size_t aLineLength;
+	size_t aReturnLength = 0;
+
+	BOOL aSectionFound = FALSE;
+	BOOL aKeyFound = FALSE;
+	int j = 0;
 
 	j = strlen(theIniFileName) + 1;
-	ptr = (char *) getpwuid(getuid());	/* get user info */
+	ptr = (char*)getpwuid(getuid());	/* get user info */
 
-	if (ptr == NULL)
+	if( ptr == NULL)
 	{
-		if (MAXPGPATH - 1 < j)
-			theIniFileName[MAXPGPATH - 1] = '\0';
+		if( MAXPGPATH-1 < j )
+			theIniFileName[MAXPGPATH-1] = '\0';
 
-		sprintf(buf, "%s", theIniFileName);
+		sprintf(buf,"%s",theIniFileName);
 	}
-	ptr = ((struct passwd *) ptr)->pw_dir;		/* get user home dir */
-	if (ptr == NULL || *ptr == '\0')
+	ptr = ((struct passwd*)ptr)->pw_dir;	/* get user home dir */
+	if( ptr == NULL || *ptr == '\0' )
 		ptr = "/home";
 
-	/*
-	 * This doesn't make it so we find an ini file but allows normal
-	 * processing to continue further on down. The likelihood is that the
-	 * file won't be found and thus the default value will be returned.
-	 */
-	if (MAXPGPATH - 1 < strlen(ptr) + j)
+	/* This doesn't make it so we find an ini file but allows normal
+	 * processing to continue further on down. The likelihood is that
+	 * the file won't be found and thus the default value will be
+	 * returned.
+	*/
+	if( MAXPGPATH-1 < strlen(ptr) + j )
 	{
-		if (MAXPGPATH - 1 < strlen(ptr))
-			ptr[MAXPGPATH - 1] = '\0';
+		if( MAXPGPATH-1 < strlen(ptr) )
+			ptr[MAXPGPATH-1] = '\0';
 		else
-			theIniFileName[MAXPGPATH - 1 - strlen(ptr)] = '\0';
+			theIniFileName[MAXPGPATH-1-strlen(ptr)] = '\0';
 	}
 
-	sprintf(buf, "%s/%s", ptr, theIniFileName);
+	sprintf( buf, "%s/%s",ptr,theIniFileName );
 
-	/*
-	 * This code makes it so that a file in the users home dir overrides a
-	 * the "default" file as passed in
-	 */
-	aFile = (FILE *) (buf ? fopen(buf, PG_BINARY_R) : NULL);
-	if (!aFile)
-	{
-		sprintf(buf, "%s", theIniFileName);
-		aFile = (FILE *) (buf ? fopen(buf, PG_BINARY_R) : NULL);
+	  /* This code makes it so that a file in the users home dir
+	   * overrides a the "default" file as passed in
+	  */
+	aFile = (FILE*)(buf ? fopen(buf, PG_BINARY_R) : NULL);
+	if(!aFile) {
+		sprintf(buf,"%s",theIniFileName);
+		aFile = (FILE*)(buf ? fopen(buf, PG_BINARY_R) : NULL);
 	}
 
 
 	aLength = (theDefault == NULL) ? 0 : strlen(theDefault);
 
-	if (theReturnBufferLength == 0 || theReturnBuffer == NULL)
+	if(theReturnBufferLength == 0 || theReturnBuffer == NULL)
 	{
-		if (aFile)
+		if(aFile)
+		{
 			fclose(aFile);
+		}
 		return 0;
 	}
 
-	if (aFile == NULL)
+	if(aFile == NULL)
 	{
 		/* no ini file specified, return the default */
 
-		++aLength;				/* room for NULL char */
+		++aLength;	/* room for NULL char */
 		aLength = theReturnBufferLength < aLength ?
 			theReturnBufferLength : aLength;
 		strncpy(theReturnBuffer, theDefault, aLength);
@@ -127,77 +123,86 @@ GetPrivateProfileString(char *theSection,		/* section name */
 	}
 
 
-	while (fgets(aLine, sizeof(aLine), aFile) != NULL)
+	while(fgets(aLine, sizeof(aLine), aFile) != NULL)
 	{
 		aLineLength = strlen(aLine);
 		/* strip final '\n' */
-		if (aLineLength > 0 && aLine[aLineLength - 1] == '\n')
+		if(aLineLength > 0 && aLine[aLineLength - 1] == '\n')
+		{
 			aLine[aLineLength - 1] = '\0';
-		switch (*aLine)
+		}
+		switch(*aLine)
 		{
-			case ' ':			/* blank line */
-			case ';':			/* comment line */
+			case ' ': /* blank line */
+			case ';': /* comment line */
 				continue;
-				break;
+			break;
 
-			case '[':			/* section marker */
+			case '[':	/* section marker */
 
-				if ((aString = strchr(aLine, ']')))
+				if( (aString = strchr(aLine, ']')) )
 				{
 					aStart = aLine + 1;
 					aString--;
-					while (isspace((unsigned char) *aStart))
-						aStart++;
-					while (isspace((unsigned char) *aString))
-						aString--;
-					*(aString + 1) = '\0';
+					while (isspace((unsigned char) *aStart)) aStart++;
+					while (isspace((unsigned char) *aString)) aString--;
+					*(aString+1) = '\0';
 
 					/* accept as matched if NULL key or exact match */
 
-					if (!theSection || !strcmp(aStart, theSection))
+					if(!theSection || !strcmp(aStart, theSection))
+					{
 						aSectionFound = TRUE;
+					}
 				}
 
-				break;
+			break;
 
 			default:
 
 				/* try to match value keys if in proper section */
 
-				if (aSectionFound)
+				if(aSectionFound)
 				{
 					/* try to match requested key */
 
-					if ((aString = aValue = strchr(aLine, '=')))
+					if( (aString = aValue = strchr(aLine, '=')) )
 					{
 						*aValue = '\0';
 						++aValue;
 
 						/* strip leading blanks in value field */
 
-						while (*aValue == ' ' && aValue < aLine + sizeof(aLine))
+						while(*aValue == ' ' && aValue < aLine + sizeof(aLine))
+						{
 							*aValue++ = '\0';
-						if (aValue >= aLine + sizeof(aLine))
+						}
+						if(aValue >= aLine + sizeof(aLine))
+						{
 							aValue = "";
+						}
 					}
 					else
+					{
 						aValue = "";
+					}
 
 					aStart = aLine;
-					while (isspace((unsigned char) *aStart))
-						aStart++;
+					while (isspace((unsigned char) *aStart)) aStart++;
 
 					/* strip trailing blanks from key */
 
-					if (aString)
+					if(aString)
 					{
-						while (--aString >= aStart && *aString == ' ')
+						while(--aString >= aStart && *aString == ' ')
+						{
 							*aString = '\0';
+						}
 					}
 
 					/* see if key is matched */
 
-					if (theKey == NULL || !strcmp(theKey, aStart))
+					if(theKey == NULL || !strcmp(theKey, aStart))
 					{
 						/* matched -- first, terminate value part */
 
@@ -208,7 +213,7 @@ GetPrivateProfileString(char *theSection,		/* section name */
 
 						aString = aValue + aLength - 1;
 
-						while (--aString > aValue && *aString == ' ')
+						while(--aString > aValue && *aString == ' ')
 						{
 							*aString = '\0';
 							--aLength;
@@ -216,7 +221,7 @@ GetPrivateProfileString(char *theSection,		/* section name */
 
 						/* unquote value if quoted */
 
-						if (aLength >= 2 && aValue[0] == '"' &&
+						if(aLength >= 2 && aValue[0] == '"' &&
 							aValue[aLength - 1] == '"')
 						{
 							/* string quoted with double quotes */
@@ -229,7 +234,7 @@ GetPrivateProfileString(char *theSection,		/* section name */
 						{
 							/* single quotes allowed also... */
 
-							if (aLength >= 2 && aValue[0] == '\'' &&
+							if(aLength >= 2 && aValue[0] == '\'' &&
 								aValue[aLength - 1] == '\'')
 							{
 								aValue[aLength - 1] = '\0';
@@ -241,23 +246,23 @@ GetPrivateProfileString(char *theSection,		/* section name */
 						/* compute maximum length copyable */
 
 						aLineLength = (aLength <
-						theReturnBufferLength - aReturnLength) ? aLength :
+							theReturnBufferLength - aReturnLength) ? aLength :
 							theReturnBufferLength - aReturnLength;
 
 						/* do the copy to return buffer */
 
-						if (aLineLength)
+						if(aLineLength)
 						{
 							strncpy(&theReturnBuffer[aReturnLength],
-									aValue, aLineLength);
+								aValue, aLineLength);
 							aReturnLength += aLineLength;
-							if (aReturnLength < theReturnBufferLength)
+							if(aReturnLength < theReturnBufferLength)
 							{
 								theReturnBuffer[aReturnLength] = '\0';
 								++aReturnLength;
 							}
 						}
-						if (aFile)
+						if(aFile)
 						{
 							fclose(aFile);
 							aFile = NULL;
@@ -267,16 +272,17 @@ GetPrivateProfileString(char *theSection,		/* section name */
 					}
 				}
 
-				break;
+			break;
 		}
 	}
 
-	if (aFile)
+	if(aFile)
+	{
 		fclose(aFile);
+	}
 
-	if (!aKeyFound)
-	{							/* key wasn't found return default */
-		++aLength;				/* room for NULL char */
+	if(!aKeyFound) {	/* key wasn't found return default */
+		++aLength;	/* room for NULL char */
 		aLength = theReturnBufferLength < aLength ?
 			theReturnBufferLength : aLength;
 		strncpy(theReturnBuffer, theDefault, aLength);
@@ -287,11 +293,10 @@ GetPrivateProfileString(char *theSection,		/* section name */
 }
 
 DWORD
-WritePrivateProfileString(char *theSection,		/* section name */
-						  char *theKey, /* write key name */
-						  char *theBuffer,		/* input buffer */
-						  char *theIniFileName) /* pathname of ini file to
-												 * write */
+WritePrivateProfileString(char *theSection,	/* section name */
+			  char *theKey,		/* write key name */
+			  char *theBuffer,	/* input buffer */
+			  char *theIniFileName)	/* pathname of ini file to write */
 {
 	return 0;
 }
@@ -302,74 +307,69 @@ WritePrivateProfileString(char *theSection,		/* section name */
  * I find out different.
  */
 DWORD
-WritePrivateProfileString(char *theSection,		/* section name */
-						  char *theKey, /* write key name */
-						  char *theBuffer,		/* input buffer */
-						  char *theIniFileName) /* pathname of ini file to
-												 * write */
+WritePrivateProfileString(char *theSection,	/* section name */
+			  char *theKey,		/* write key name */
+			  char *theBuffer,	/* input buffer */
+			  char *theIniFileName)	/* pathname of ini file to write */
 {
-	char		buf[MAXPGPATH];
-	char	   *ptr = 0;
-	FILE	   *aFile = 0;
-	size_t		aLength;
-	char		aLine[2048];
-	char	   *aValue;
-	char	   *aString;
-	size_t		aLineLength;
-	size_t		aReturnLength = 0;
-
-	BOOL		aSectionFound = FALSE;
-	BOOL		keyFound = FALSE;
-	int			j = 0;
+	char buf[MAXPGPATH];
+	char* ptr = 0;
+	FILE* aFile = 0;
+	size_t aLength;
+	char aLine[2048];
+	char *aValue;
+	char *aString;
+	size_t aLineLength;
+	size_t aReturnLength = 0;
+
+	BOOL aSectionFound = FALSE;
+	BOOL keyFound = FALSE;
+	int j = 0;
 
 	/* If this isn't correct processing we'll change it later  */
-	if (theSection == NULL || theKey == NULL || theBuffer == NULL ||
-		theIniFileName == NULL)
-		return 0;
+	if(theSection == NULL || theKey == NULL || theBuffer == NULL ||
+		theIniFileName == NULL) return 0;
 
 	aLength = strlen(theBuffer);
-	if (aLength == 0)
-		return 0;
+	if(aLength == 0) return 0;
 
 	j = strlen(theIniFileName) + 1;
-	ptr = (char *) getpwuid(getuid());	/* get user info */
+	ptr = (char*)getpwuid(getuid());	/* get user info */
 
-	if (ptr == NULL)
+	if( ptr == NULL)
 	{
-		if (MAXPGPATH - 1 < j)
-			theIniFileName[MAXPGPATH - 1] = '\0';
+		if( MAXPGPATH-1 < j )
+			theIniFileName[MAXPGPATH-1] = '\0';
 
-		sprintf(buf, "%s", theIniFileName);
+		sprintf(buf,"%s",theIniFileName);
 	}
-	ptr = ((struct passwd *) ptr)->pw_dir;		/* get user home dir */
-	if (ptr == NULL || *ptr == '\0')
+	ptr = ((struct passwd*)ptr)->pw_dir;	/* get user home dir */
+	if( ptr == NULL || *ptr == '\0' )
 		ptr = "/home";
 
 	/* This doesn't make it so we find an ini file but allows normal */
-	/* processing to continue further on down. The likelihood is that */
+	/*  processing to continue further on down. The likelihood is that */
 	/* the file won't be found and thus the default value will be */
 	/* returned. */
 	/* */
-	if (MAXPGPATH - 1 < strlen(ptr) + j)
+	if( MAXPGPATH-1 < strlen(ptr) + j )
 	{
-		if (MAXPGPATH - 1 < strlen(ptr))
-			ptr[MAXPGPATH - 1] = '\0';
+		if( MAXPGPATH-1 < strlen(ptr) )
+			ptr[MAXPGPATH-1] = '\0';
 		else
-			theIniFileName[MAXPGPATH - 1 - strlen(ptr)] = '\0';
+			theIniFileName[MAXPGPATH-1-strlen(ptr)] = '\0';
 	}
 
-	sprintf(buf, "%s/%s", ptr, theIniFileName);
+	sprintf( buf, "%s/%s",ptr,theIniFileName );
 
 	/* This code makes it so that a file in the users home dir */
-	/* overrides a the "default" file as passed in */
+	/*  overrides a the "default" file as passed in */
 	/* */
-	aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
-	if (!aFile)
-	{
-		sprintf(buf, "%s", theIniFileName);
-		aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
-		if (!aFile)
-			return 0;
+	aFile = (FILE*)(buf ? fopen(buf, "r+") : NULL);
+	if(!aFile) {
+		sprintf(buf,"%s",theIniFileName);
+		aFile = (FILE*)(buf ? fopen(buf, "r+") : NULL);
+		if(!aFile) return 0;
 	}
 
 
@@ -379,92 +379,104 @@ WritePrivateProfileString(char *theSection,		/* section name */
 	/* exists we have to overwrite it. If it doesn't exist */
 	/* we just write a new line to the file. */
 	/* */
-	while (fgets(aLine, sizeof(aLine), aFile) != NULL)
+	while(fgets(aLine, sizeof(aLine), aFile) != NULL)
 	{
 		aLineLength = strlen(aLine);
 		/* strip final '\n' */
-		if (aLineLength > 0 && aLine[aLineLength - 1] == '\n')
+		if(aLineLength > 0 && aLine[aLineLength - 1] == '\n')
+		{
 			aLine[aLineLength - 1] = '\0';
-		switch (*aLine)
+		}
+		switch(*aLine)
 		{
-			case ' ':			/* blank line */
-			case ';':			/* comment line */
+			case ' ': /* blank line */
+			case ';': /* comment line */
 				continue;
-				break;
+			break;
 
-			case '[':			/* section marker */
+			case '[':	/* section marker */
 
-				if ((aString = strchr(aLine, ']')))
+				if( (aString = strchr(aLine, ']')) )
 				{
 					*aString = '\0';
 
 					/* accept as matched if key exact match */
 
-					if (!strcmp(aLine + 1, theSection))
+					if(!strcmp(aLine + 1, theSection))
+					{
 						aSectionFound = TRUE;
+					}
 				}
 
-				break;
+			break;
 
 			default:
 
 				/* try to match value keys if in proper section */
 
-				if (aSectionFound)
+				if(aSectionFound)
 				{
 					/* try to match requested key */
 
-					if ((aString = aValue = strchr(aLine, '=')))
+					if( (aString = aValue = strchr(aLine, '=')) )
 					{
 						*aValue = '\0';
 						++aValue;
 
 						/* strip leading blanks in value field */
 
-						while (*aValue == ' ' && aValue < aLine + sizeof(aLine))
+						while(*aValue == ' ' && aValue < aLine + sizeof(aLine))
+						{
 							*aValue++ = '\0';
-						if (aValue >= aLine + sizeof(aLine))
+						}
+						if(aValue >= aLine + sizeof(aLine))
+						{
 							aValue = "";
+						}
 					}
 					else
+					{
 						aValue = "";
+					}
 
 					/* strip trailing blanks from key */
 
-					if (aString)
+					if(aString)
 					{
-						while (--aString >= aLine && *aString == ' ')
+						while(--aString >= aLine && *aString == ' ')
+						{
 							*aString = '\0';
+						}
 					}
 
 					/* see if key is matched */
 
-					if (!strcmp(theKey, aLine))
+					if(!strcmp(theKey, aLine))
 					{
 						keyFound = TRUE;
 						/* matched -- first, terminate value part */
 
 						/* overwrite current value */
-						fseek(aFile, -aLineLength, SEEK_CUR);
+						fseek(aFile,-aLineLength,SEEK_CUR);
 						/* overwrite key and value */
-						sprintf(aLine, "%s = %s\n", theKey, theBuffer);
-						fputs(aLine, aFile);
+						sprintf(aLine,"%s = %s\n",theKey,theBuffer);
+						fputs(aLine,aFile);
+						}
 					}
 				}
-		}
 
-		break;
+			break;
+		}
 	}
-}
 
-if (!keyFound)
-{								/* theKey wasn't in file so  */
-	if (aFile)
+	if(!keyFound) {		/* theKey wasn't in file so  */
+	if(aFile)
+	{
 		fclose(aFile);
+	}
 
 	return aReturnLength > 0 ? aReturnLength - 1 : 0;
 }
-
 #endif
 
 
diff --git a/src/interfaces/odbc/gpps.h b/src/interfaces/odbc/gpps.h
index c6d1d38ec2387804ebf48cec16825bbb0f924b01..c2c81965f09c95077bd6d2092a84b4202d067bae 100644
--- a/src/interfaces/odbc/gpps.h
+++ b/src/interfaces/odbc/gpps.h
@@ -13,30 +13,25 @@
 #endif
 
 #ifdef __cplusplus
-extern		"C"
-{
+extern "C" {
 #endif
 
-	DWORD		GetPrivateProfileString(char *theSection,		/* section name */
-													char *theKey,		/* search key name */
-													char *theDefault,	/* default value if not
-																		 * found */
-													char *theReturnBuffer,		/* return valuse stored
-																				 * here */
-												  size_t theBufferLength,		/* byte length of return
-																				 * buffer */
-													char *theIniFileName);		/* pathname of ini file
-																				 * to search */
+DWORD
+GetPrivateProfileString(char *theSection,   /* section name */
+			char *theKey, /* search key name */
+			char *theDefault, /* default value if not found */
+			char *theReturnBuffer, /* return valuse stored here */
+			size_t theBufferLength,	/* byte length of return buffer */
+			char *theIniFileName); /* pathname of ini file to search */
 
-	DWORD		WritePrivateProfileString(char *theSection,		/* section name */
-													  char *theKey,		/* write key name */
-													  char *theBuffer,	/* input buffer */
-												   char *theIniFileName);		/* pathname of ini file
-																				 * to write */
+DWORD
+WritePrivateProfileString(char *theSection,	/* section name */
+			  char *theKey,		/* write key name */
+			  char *theBuffer,	/* input buffer */
+			  char *theIniFileName); /* pathname of ini file to write */
 
 #ifdef __cplusplus
 }
-
 #endif
 
 #ifndef WIN32
diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c
index 884ee4afcd3e3f4f1c777b383806a32086e0d885..bf43d6522b57b7e5b4f9558f67b9903021a59629 100644
--- a/src/interfaces/odbc/info.c
+++ b/src/interfaces/odbc/info.c
@@ -1,17 +1,18 @@
-/* Module:			info.c
+
+/* Module:          info.c
  *
- * Description:		This module contains routines related to
- *					ODBC informational functions.
+ * Description:     This module contains routines related to
+ *                  ODBC informational functions.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	SQLGetInfo, SQLGetTypeInfo, SQLGetFunctions,
- *					SQLTables, SQLColumns, SQLStatistics, SQLSpecialColumns,
- *					SQLPrimaryKeys, SQLForeignKeys,
- *					SQLProcedureColumns(NI), SQLProcedures(NI),
- *					SQLTablePrivileges(NI), SQLColumnPrivileges(NI)
+ * API functions:   SQLGetInfo, SQLGetTypeInfo, SQLGetFunctions, 
+ *                  SQLTables, SQLColumns, SQLStatistics, SQLSpecialColumns,
+ *                  SQLPrimaryKeys, SQLForeignKeys, 
+ *                  SQLProcedureColumns(NI), SQLProcedures(NI), 
+ *                  SQLTablePrivileges(NI), SQLColumnPrivileges(NI)
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -30,7 +31,7 @@
 #include <ctype.h>
 #else
 #include <windows.h>
-#include <sql.h>
+#include <sql.h> 
 #include <sqlext.h>
 #endif
 
@@ -56,635 +57,589 @@
 extern GLOBAL_VALUES globals;
 
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLGetInfo(
-		   HDBC hdbc,
-		   UWORD fInfoType,
-		   PTR rgbInfoValue,
-		   SWORD cbInfoValueMax,
-		   SWORD FAR *pcbInfoValue)
+RETCODE SQL_API SQLGetInfo(
+        HDBC      hdbc,
+        UWORD     fInfoType,
+        PTR       rgbInfoValue,
+        SWORD     cbInfoValueMax,
+        SWORD FAR *pcbInfoValue)
 {
-	static char *func = "SQLGetInfo";
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	ConnInfo   *ci;
-	char	   *p = NULL,
-				tmp[MAX_INFO_STRING];
-	int			len = 0,
-				value = 0;
-	RETCODE		result;
-
-	mylog("%s: entering...fInfoType=%d\n", func, fInfoType);
-
-	if (!conn)
-	{
+static char *func = "SQLGetInfo";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+ConnInfo *ci;
+char *p = NULL, tmp[MAX_INFO_STRING];
+int len = 0, value = 0;
+RETCODE result;
+
+	mylog( "%s: entering...fInfoType=%d\n", func, fInfoType);
+
+	if ( ! conn) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	ci = &conn->connInfo;
 
-	switch (fInfoType)
-	{
-		case SQL_ACCESSIBLE_PROCEDURES: /* ODBC 1.0 */
-			p = "N";
-			break;
-
-		case SQL_ACCESSIBLE_TABLES:		/* ODBC 1.0 */
-			p = "N";
-			break;
-
-		case SQL_ACTIVE_CONNECTIONS:	/* ODBC 1.0 */
-			len = 2;
-			value = MAX_CONNECTIONS;
-			break;
-
-		case SQL_ACTIVE_STATEMENTS:		/* ODBC 1.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_ALTER_TABLE:	/* ODBC 2.0 */
-			len = 4;
-			value = SQL_AT_ADD_COLUMN;
-			break;
-
-		case SQL_BOOKMARK_PERSISTENCE:	/* ODBC 2.0 */
-			/* very simple bookmark support */
-			len = 4;
-			value = globals.use_declarefetch ? 0 : (SQL_BP_SCROLL);
-			break;
-
-		case SQL_COLUMN_ALIAS:	/* ODBC 2.0 */
-			p = "N";
-			break;
-
-		case SQL_CONCAT_NULL_BEHAVIOR:	/* ODBC 1.0 */
-			len = 2;
-			value = SQL_CB_NON_NULL;
-			break;
-
-		case SQL_CONVERT_BIGINT:
-		case SQL_CONVERT_BINARY:
-		case SQL_CONVERT_BIT:
-		case SQL_CONVERT_CHAR:
-		case SQL_CONVERT_DATE:
-		case SQL_CONVERT_DECIMAL:
-		case SQL_CONVERT_DOUBLE:
-		case SQL_CONVERT_FLOAT:
-		case SQL_CONVERT_INTEGER:
-		case SQL_CONVERT_LONGVARBINARY:
-		case SQL_CONVERT_LONGVARCHAR:
-		case SQL_CONVERT_NUMERIC:
-		case SQL_CONVERT_REAL:
-		case SQL_CONVERT_SMALLINT:
-		case SQL_CONVERT_TIME:
-		case SQL_CONVERT_TIMESTAMP:
-		case SQL_CONVERT_TINYINT:
-		case SQL_CONVERT_VARBINARY:
-		case SQL_CONVERT_VARCHAR:		/* ODBC 1.0 */
-			len = 4;
-			value = fInfoType;
-			break;
-
-		case SQL_CONVERT_FUNCTIONS:		/* ODBC 1.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_CORRELATION_NAME:		/* ODBC 1.0 */
-
-			/*
-			 * Saying no correlation name makes Query not work right.
-			 * value = SQL_CN_NONE;
-			 */
-			len = 2;
-			value = SQL_CN_ANY;
-			break;
-
-		case SQL_CURSOR_COMMIT_BEHAVIOR:		/* ODBC 1.0 */
-			len = 2;
-			value = SQL_CB_CLOSE;
-			break;
-
-		case SQL_CURSOR_ROLLBACK_BEHAVIOR:		/* ODBC 1.0 */
-			len = 2;
-			value = SQL_CB_CLOSE;
-			break;
-
-		case SQL_DATA_SOURCE_NAME:		/* ODBC 1.0 */
-			p = CC_get_DSN(conn);
-			break;
-
-		case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */
-			p = CC_is_onlyread(conn) ? "Y" : "N";
-			break;
-
-		case SQL_DATABASE_NAME:/* Support for old ODBC 1.0 Apps */
-
-			/*
-			 * Returning the database name causes problems in MS Query. It
-			 * generates query like: "SELECT DISTINCT a FROM byronncrap3
-			 * crap3"
-			 *
-			 * p = CC_get_database(conn);
-			 */
-			p = "";
-			break;
-
-		case SQL_DBMS_NAME:		/* ODBC 1.0 */
-			p = DBMS_NAME;
-			break;
-
-		case SQL_DBMS_VER:		/* ODBC 1.0 */
-
-			/*
-			 * The ODBC spec wants ##.##.#### ...whatever... so prepend
-			 * the driver version number to the dbms version string
-			 */
-			sprintf(tmp, "%s %s", POSTGRESDRIVERVERSION, conn->pg_version);
-			p = tmp;
-			break;
-
-		case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */
-			len = 4;
-			value = SQL_TXN_READ_COMMITTED;		/* SQL_TXN_SERIALIZABLE; */
-			break;
-
-		case SQL_DRIVER_NAME:	/* ODBC 1.0 */
-			p = DRIVER_FILE_NAME;
-			break;
-
-		case SQL_DRIVER_ODBC_VER:
-			p = DRIVER_ODBC_VER;
-			break;
-
-		case SQL_DRIVER_VER:	/* ODBC 1.0 */
-			p = POSTGRESDRIVERVERSION;
-			break;
-
-		case SQL_EXPRESSIONS_IN_ORDERBY:		/* ODBC 1.0 */
-			p = "N";
-			break;
-
-		case SQL_FETCH_DIRECTION:		/* ODBC 1.0 */
-			len = 4;
-			value = globals.use_declarefetch ? (SQL_FD_FETCH_NEXT) : (SQL_FD_FETCH_NEXT |
-													 SQL_FD_FETCH_FIRST |
-													  SQL_FD_FETCH_LAST |
-													 SQL_FD_FETCH_PRIOR |
-												  SQL_FD_FETCH_ABSOLUTE |
-												  SQL_FD_FETCH_RELATIVE |
-												  SQL_FD_FETCH_BOOKMARK);
-			break;
-
-		case SQL_FILE_USAGE:	/* ODBC 2.0 */
-			len = 2;
-			value = SQL_FILE_NOT_SUPPORTED;
-			break;
-
-		case SQL_GETDATA_EXTENSIONS:	/* ODBC 2.0 */
-			len = 4;
-			value = (SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND | SQL_GD_BLOCK);
-			break;
-
-		case SQL_GROUP_BY:		/* ODBC 2.0 */
-			len = 2;
-			value = SQL_GB_GROUP_BY_EQUALS_SELECT;
-			break;
-
-		case SQL_IDENTIFIER_CASE:		/* ODBC 1.0 */
-
-			/*
-			 * are identifiers case-sensitive (yes, but only when quoted.
-			 * If not quoted, they default to lowercase)
-			 */
-			len = 2;
-			value = SQL_IC_LOWER;
-			break;
-
-		case SQL_IDENTIFIER_QUOTE_CHAR: /* ODBC 1.0 */
-			/* the character used to quote "identifiers" */
-			p = PG_VERSION_LE(conn, 6.2) ? " " : "\"";
-			break;
-
-		case SQL_KEYWORDS:		/* ODBC 2.0 */
-			p = "";
-			break;
-
-		case SQL_LIKE_ESCAPE_CLAUSE:	/* ODBC 2.0 */
-
-			/*
-			 * is there a character that escapes '%' and '_' in a LIKE
-			 * clause? not as far as I can tell
-			 */
-			p = "N";
-			break;
-
-		case SQL_LOCK_TYPES:	/* ODBC 2.0 */
-			len = 4;
-			value = globals.lie ? (SQL_LCK_NO_CHANGE | SQL_LCK_EXCLUSIVE | SQL_LCK_UNLOCK) : SQL_LCK_NO_CHANGE;
-			break;
-
-		case SQL_MAX_BINARY_LITERAL_LEN:		/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_MAX_CHAR_LITERAL_LEN:	/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_MAX_COLUMN_NAME_LEN:	/* ODBC 1.0 */
-			len = 2;
-			value = MAX_COLUMN_LEN;
-			break;
-
-		case SQL_MAX_COLUMNS_IN_GROUP_BY:		/* ODBC 2.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_COLUMNS_IN_INDEX:	/* ODBC 2.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_COLUMNS_IN_ORDER_BY:		/* ODBC 2.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_COLUMNS_IN_SELECT: /* ODBC 2.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_COLUMNS_IN_TABLE:	/* ODBC 2.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_CURSOR_NAME_LEN:	/* ODBC 1.0 */
-			len = 2;
-			value = MAX_CURSOR_LEN;
-			break;
-
-		case SQL_MAX_INDEX_SIZE:		/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_MAX_OWNER_NAME_LEN:	/* ODBC 1.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_PROCEDURE_NAME_LEN:		/* ODBC 1.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_QUALIFIER_NAME_LEN:		/* ODBC 1.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_ROW_SIZE:	/* ODBC 2.0 */
-			len = 4;
-			if (PG_VERSION_GE(conn, 7.1))
-			{					/* Large Rowa in 7.1+ */
-				value = MAX_ROW_SIZE;
-			}
-			else
-			{					/* Without the Toaster we're limited to
-								 * the blocksize */
-				value = BLCKSZ;
-			}
-			break;
-
-		case SQL_MAX_ROW_SIZE_INCLUDES_LONG:	/* ODBC 2.0 */
-
-			/*
-			 * does the preceding value include LONGVARCHAR and
-			 * LONGVARBINARY fields?   Well, it does include longvarchar,
-			 * but not longvarbinary.
-			 */
-			p = "Y";
-			break;
-
-		case SQL_MAX_STATEMENT_LEN:		/* ODBC 2.0 */
-			/* maybe this should be 0? */
-			len = 4;
-			if (PG_VERSION_GE(conn, 7.0))
-			{					/* Long Queries in 7.0+ */
-				value = MAX_STATEMENT_LEN;
-			}
-			else if (PG_VERSION_GE(conn, 6.5))	/* Prior to 7.0 we used
-												 * 2*BLCKSZ */
-				value = (2 * BLCKSZ);
-			else
-/* Prior to 6.5 we used BLCKSZ */
-				value = BLCKSZ;
-
-			break;
-
-		case SQL_MAX_TABLE_NAME_LEN:	/* ODBC 1.0 */
-			len = 2;
-			value = MAX_TABLE_LEN;
-			break;
-
-		case SQL_MAX_TABLES_IN_SELECT:	/* ODBC 2.0 */
-			len = 2;
-			value = 0;
-			break;
-
-		case SQL_MAX_USER_NAME_LEN:
-			len = 2;
+    switch (fInfoType) {
+    case SQL_ACCESSIBLE_PROCEDURES: /* ODBC 1.0 */
+		p = "N";
+        break;
+
+    case SQL_ACCESSIBLE_TABLES: /* ODBC 1.0 */
+		p = "N";
+        break;
+
+    case SQL_ACTIVE_CONNECTIONS: /* ODBC 1.0 */
+        len = 2;
+        value = MAX_CONNECTIONS;
+        break;
+
+    case SQL_ACTIVE_STATEMENTS: /* ODBC 1.0 */
+        len = 2;
+        value = 0;
+        break;
+
+    case SQL_ALTER_TABLE: /* ODBC 2.0 */
+        len = 4;
+        value = SQL_AT_ADD_COLUMN;
+        break;
+
+    case SQL_BOOKMARK_PERSISTENCE: /* ODBC 2.0 */
+		/* very simple bookmark support */        
+		len = 4;
+        value = globals.use_declarefetch ? 0 : (SQL_BP_SCROLL);		
+        break;
+
+    case SQL_COLUMN_ALIAS: /* ODBC 2.0 */
+		p = "N";
+        break;
+
+    case SQL_CONCAT_NULL_BEHAVIOR: /* ODBC 1.0 */
+        len = 2;
+        value = SQL_CB_NON_NULL;
+        break;
+
+    case SQL_CONVERT_BIGINT:
+    case SQL_CONVERT_BINARY:
+    case SQL_CONVERT_BIT:
+    case SQL_CONVERT_CHAR:
+    case SQL_CONVERT_DATE:
+    case SQL_CONVERT_DECIMAL:
+    case SQL_CONVERT_DOUBLE:
+    case SQL_CONVERT_FLOAT:
+    case SQL_CONVERT_INTEGER:
+    case SQL_CONVERT_LONGVARBINARY:
+    case SQL_CONVERT_LONGVARCHAR:
+    case SQL_CONVERT_NUMERIC:
+    case SQL_CONVERT_REAL:
+    case SQL_CONVERT_SMALLINT:
+    case SQL_CONVERT_TIME:
+    case SQL_CONVERT_TIMESTAMP:
+    case SQL_CONVERT_TINYINT:
+    case SQL_CONVERT_VARBINARY:
+    case SQL_CONVERT_VARCHAR: /* ODBC 1.0 */
+		len = 4;
+        value = fInfoType;
+        break;
+
+    case SQL_CONVERT_FUNCTIONS: /* ODBC 1.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_CORRELATION_NAME: /* ODBC 1.0 */
+
+		/*	Saying no correlation name makes Query not work right.
+			value = SQL_CN_NONE;
+		*/
+		len = 2;
+        value = SQL_CN_ANY;
+        break;
+
+    case SQL_CURSOR_COMMIT_BEHAVIOR: /* ODBC 1.0 */
+        len = 2;
+        value = SQL_CB_CLOSE;
+        break;
+
+    case SQL_CURSOR_ROLLBACK_BEHAVIOR: /* ODBC 1.0 */
+        len = 2;
+        value = SQL_CB_CLOSE;
+        break;
+
+    case SQL_DATA_SOURCE_NAME: /* ODBC 1.0 */
+		p = CC_get_DSN(conn);
+        break;
+
+    case SQL_DATA_SOURCE_READ_ONLY: /* ODBC 1.0 */
+		p = CC_is_onlyread(conn) ? "Y" : "N";
+        break;
+
+    case SQL_DATABASE_NAME: /* Support for old ODBC 1.0 Apps */
+
+		/*	Returning the database name causes problems in MS Query.
+			It generates query like: "SELECT DISTINCT a FROM byronncrap3 crap3"
+
+			p = CC_get_database(conn);
+		*/
+		p = "";    
+		break;
+
+    case SQL_DBMS_NAME: /* ODBC 1.0 */
+		p = DBMS_NAME;
+        break;
+
+    case SQL_DBMS_VER: /* ODBC 1.0 */
+		/* The ODBC spec wants ##.##.#### ...whatever... so prepend the driver */
+		/* version number to the dbms version string */
+		sprintf(tmp, "%s %s", POSTGRESDRIVERVERSION, conn->pg_version);
+		p = tmp;
+        break;
+
+    case SQL_DEFAULT_TXN_ISOLATION: /* ODBC 1.0 */
+		len = 4;
+        value = SQL_TXN_READ_COMMITTED; /*SQL_TXN_SERIALIZABLE; */
+        break;
+
+    case SQL_DRIVER_NAME: /* ODBC 1.0 */
+        p = DRIVER_FILE_NAME;
+        break;
+
+    case SQL_DRIVER_ODBC_VER:
+		p = DRIVER_ODBC_VER;
+        break;
+
+    case SQL_DRIVER_VER: /* ODBC 1.0 */
+        p = POSTGRESDRIVERVERSION;
+        break;
+
+    case SQL_EXPRESSIONS_IN_ORDERBY: /* ODBC 1.0 */
+		p = "N";
+        break;
+
+    case SQL_FETCH_DIRECTION: /* ODBC 1.0 */
+		len = 4;
+        value = globals.use_declarefetch ? (SQL_FD_FETCH_NEXT) : (SQL_FD_FETCH_NEXT |
+                                   SQL_FD_FETCH_FIRST |
+                                   SQL_FD_FETCH_LAST |
+                                   SQL_FD_FETCH_PRIOR |
+                                   SQL_FD_FETCH_ABSOLUTE |
+								   SQL_FD_FETCH_RELATIVE | 
+								   SQL_FD_FETCH_BOOKMARK);
+        break;
+
+    case SQL_FILE_USAGE: /* ODBC 2.0 */
+		len = 2;
+        value = SQL_FILE_NOT_SUPPORTED;
+        break;
+
+    case SQL_GETDATA_EXTENSIONS: /* ODBC 2.0 */
+		len = 4;
+        value = (SQL_GD_ANY_COLUMN | SQL_GD_ANY_ORDER | SQL_GD_BOUND | SQL_GD_BLOCK);
+        break;
+
+    case SQL_GROUP_BY: /* ODBC 2.0 */
+		len = 2;
+        value = SQL_GB_GROUP_BY_EQUALS_SELECT;
+        break;
+
+    case SQL_IDENTIFIER_CASE: /* ODBC 1.0 */
+        /*	are identifiers case-sensitive (yes, but only when quoted.  If not quoted, they
+			default to lowercase)
+		*/
+		len = 2;
+        value = SQL_IC_LOWER;
+        break;
+
+    case SQL_IDENTIFIER_QUOTE_CHAR: /* ODBC 1.0 */
+        /* the character used to quote "identifiers" */
+		p = PG_VERSION_LE(conn, 6.2) ? " " : "\"";
+        break;
+
+    case SQL_KEYWORDS: /* ODBC 2.0 */
+		p = "";
+        break;
+
+    case SQL_LIKE_ESCAPE_CLAUSE: /* ODBC 2.0 */
+		/*	is there a character that escapes '%' and '_' in a LIKE clause?
+			not as far as I can tell
+		*/
+        p = "N";
+        break;
+
+    case SQL_LOCK_TYPES: /* ODBC 2.0 */
+		len = 4;
+        value = globals.lie ? (SQL_LCK_NO_CHANGE | SQL_LCK_EXCLUSIVE | SQL_LCK_UNLOCK) : SQL_LCK_NO_CHANGE;
+        break;
+
+    case SQL_MAX_BINARY_LITERAL_LEN: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_MAX_CHAR_LITERAL_LEN: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_MAX_COLUMN_NAME_LEN: /* ODBC 1.0 */
+		len = 2;
+        value = MAX_COLUMN_LEN;
+        break;
+
+    case SQL_MAX_COLUMNS_IN_GROUP_BY: /* ODBC 2.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_COLUMNS_IN_INDEX: /* ODBC 2.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_COLUMNS_IN_ORDER_BY: /* ODBC 2.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_COLUMNS_IN_SELECT: /* ODBC 2.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_COLUMNS_IN_TABLE: /* ODBC 2.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_CURSOR_NAME_LEN: /* ODBC 1.0 */
+		len = 2;
+        value = MAX_CURSOR_LEN;
+        break;
+
+    case SQL_MAX_INDEX_SIZE: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_MAX_OWNER_NAME_LEN: /* ODBC 1.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_PROCEDURE_NAME_LEN: /* ODBC 1.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_QUALIFIER_NAME_LEN: /* ODBC 1.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_ROW_SIZE: /* ODBC 2.0 */
+		len = 4;
+		if (PG_VERSION_GE(conn, 7.1)) { /* Large Rowa in 7.1+ */
+			value = MAX_ROW_SIZE;
+		} else { /* Without the Toaster we're limited to the blocksize */
+			value = BLCKSZ;
+		}
+        break;
+
+    case SQL_MAX_ROW_SIZE_INCLUDES_LONG: /* ODBC 2.0 */
+        /*	does the preceding value include LONGVARCHAR and LONGVARBINARY
+			fields?   Well, it does include longvarchar, but not longvarbinary.
+		*/
+		p = "Y";
+        break;
+
+    case SQL_MAX_STATEMENT_LEN: /* ODBC 2.0 */
+        /* maybe this should be 0? */
+		len = 4;
+		if (PG_VERSION_GE(conn, 7.0)) { /* Long Queries in 7.0+ */
+			value = MAX_STATEMENT_LEN;
+		} else if (PG_VERSION_GE(conn, 6.5)) /* Prior to 7.0 we used 2*BLCKSZ */
+			value = (2*BLCKSZ);
+		else /* Prior to 6.5 we used BLCKSZ */
+			value = BLCKSZ;
+
+        break;
+
+    case SQL_MAX_TABLE_NAME_LEN: /* ODBC 1.0 */
+		len = 2;
+        value = MAX_TABLE_LEN;
+        break;
+
+    case SQL_MAX_TABLES_IN_SELECT: /* ODBC 2.0 */
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MAX_USER_NAME_LEN:
+		len = 2;
+        value = 0;
+        break;
+
+    case SQL_MULT_RESULT_SETS: /* ODBC 1.0 */
+        /* Don't support multiple result sets but say yes anyway? */
+		p = "Y";
+        break;
+
+    case SQL_MULTIPLE_ACTIVE_TXN: /* ODBC 1.0 */
+		p = "Y";
+        break;
+
+    case SQL_NEED_LONG_DATA_LEN: /* ODBC 2.0 */
+		/*	Dont need the length, SQLPutData can handle any size and multiple calls */
+		p = "N";
+        break;
+
+    case SQL_NON_NULLABLE_COLUMNS: /* ODBC 1.0 */
+		len = 2;
+        value = SQL_NNC_NON_NULL;
+        break;
+
+    case SQL_NULL_COLLATION: /* ODBC 2.0 */
+        /* where are nulls sorted? */
+		len = 2;
+        value = SQL_NC_END;
+        break;
+
+    case SQL_NUMERIC_FUNCTIONS: /* ODBC 1.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_ODBC_API_CONFORMANCE: /* ODBC 1.0 */
+		len = 2;
+        value = SQL_OAC_LEVEL1;
+        break;
+
+    case SQL_ODBC_SAG_CLI_CONFORMANCE: /* ODBC 1.0 */
+		len = 2;
+        value = SQL_OSCC_NOT_COMPLIANT;
+        break;
+
+    case SQL_ODBC_SQL_CONFORMANCE: /* ODBC 1.0 */
+		len = 2;
+        value = SQL_OSC_CORE;
+        break;
+
+    case SQL_ODBC_SQL_OPT_IEF: /* ODBC 1.0 */
+		p = "N";
+        break;
+
+	case SQL_OJ_CAPABILITIES: /* ODBC 2.01 */
+		len = 4;
+		if (PG_VERSION_GE(conn, 7.1)) { /* OJs in 7.1+ */
+			value = (SQL_OJ_LEFT |
+					SQL_OJ_RIGHT |
+					SQL_OJ_FULL |
+					SQL_OJ_NESTED |
+					SQL_OJ_NOT_ORDERED |
+					SQL_OJ_INNER |
+					SQL_OJ_ALL_COMPARISON_OPS);
+		} else { /* OJs not in <7.1 */
 			value = 0;
-			break;
+		}
+		break;
 
-		case SQL_MULT_RESULT_SETS:		/* ODBC 1.0 */
-			/* Don't support multiple result sets but say yes anyway? */
-			p = "Y";
-			break;
+    case SQL_ORDER_BY_COLUMNS_IN_SELECT: /* ODBC 2.0 */
+		p = (PG_VERSION_LE(conn, 6.3)) ? "Y" : "N";		
+        break;
 
-		case SQL_MULTIPLE_ACTIVE_TXN:	/* ODBC 1.0 */
+    case SQL_OUTER_JOINS: /* ODBC 1.0 */
+		if (PG_VERSION_GE(conn, 7.1)) { /* OJs in 7.1+ */
 			p = "Y";
-			break;
-
-		case SQL_NEED_LONG_DATA_LEN:	/* ODBC 2.0 */
-
-			/*
-			 * Dont need the length, SQLPutData can handle any size and
-			 * multiple calls
-			 */
-			p = "N";
-			break;
-
-		case SQL_NON_NULLABLE_COLUMNS:	/* ODBC 1.0 */
-			len = 2;
-			value = SQL_NNC_NON_NULL;
-			break;
-
-		case SQL_NULL_COLLATION:		/* ODBC 2.0 */
-			/* where are nulls sorted? */
-			len = 2;
-			value = SQL_NC_END;
-			break;
-
-		case SQL_NUMERIC_FUNCTIONS:		/* ODBC 1.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_ODBC_API_CONFORMANCE:	/* ODBC 1.0 */
-			len = 2;
-			value = SQL_OAC_LEVEL1;
-			break;
-
-		case SQL_ODBC_SAG_CLI_CONFORMANCE:		/* ODBC 1.0 */
-			len = 2;
-			value = SQL_OSCC_NOT_COMPLIANT;
-			break;
-
-		case SQL_ODBC_SQL_CONFORMANCE:	/* ODBC 1.0 */
-			len = 2;
-			value = SQL_OSC_CORE;
-			break;
-
-		case SQL_ODBC_SQL_OPT_IEF:		/* ODBC 1.0 */
+		} else { /* OJs not in <7.1 */
 			p = "N";
-			break;
-
-		case SQL_OJ_CAPABILITIES:		/* ODBC 2.01 */
-			len = 4;
-			if (PG_VERSION_GE(conn, 7.1))
-			{					/* OJs in 7.1+ */
-				value = (SQL_OJ_LEFT |
-						 SQL_OJ_RIGHT |
-						 SQL_OJ_FULL |
-						 SQL_OJ_NESTED |
-						 SQL_OJ_NOT_ORDERED |
-						 SQL_OJ_INNER |
-						 SQL_OJ_ALL_COMPARISON_OPS);
-			}
-			else
-			{					/* OJs not in <7.1 */
-				value = 0;
-			}
-			break;
-
-		case SQL_ORDER_BY_COLUMNS_IN_SELECT:	/* ODBC 2.0 */
-			p = (PG_VERSION_LE(conn, 6.3)) ? "Y" : "N";
-			break;
-
-		case SQL_OUTER_JOINS:	/* ODBC 1.0 */
-			if (PG_VERSION_GE(conn, 7.1))
-			{					/* OJs in 7.1+ */
-				p = "Y";
-			}
-			else
-			{					/* OJs not in <7.1 */
-				p = "N";
-			}
-			break;
-
-		case SQL_OWNER_TERM:	/* ODBC 1.0 */
-			p = "owner";
-			break;
-
-		case SQL_OWNER_USAGE:	/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_POS_OPERATIONS:		/* ODBC 2.0 */
-			len = 4;
-			value = globals.lie ? (SQL_POS_POSITION | SQL_POS_REFRESH | SQL_POS_UPDATE | SQL_POS_DELETE | SQL_POS_ADD) : (SQL_POS_POSITION | SQL_POS_REFRESH);
-			break;
-
-		case SQL_POSITIONED_STATEMENTS: /* ODBC 2.0 */
-			len = 4;
-			value = globals.lie ? (SQL_PS_POSITIONED_DELETE |
-								   SQL_PS_POSITIONED_UPDATE |
-								   SQL_PS_SELECT_FOR_UPDATE) : 0;
-			break;
-
-		case SQL_PROCEDURE_TERM:		/* ODBC 1.0 */
-			p = "procedure";
-			break;
-
-		case SQL_PROCEDURES:	/* ODBC 1.0 */
-			p = "Y";
-			break;
-
-		case SQL_QUALIFIER_LOCATION:	/* ODBC 2.0 */
-			len = 2;
-			value = SQL_QL_START;
-			break;
-
-		case SQL_QUALIFIER_NAME_SEPARATOR:		/* ODBC 1.0 */
-			p = "";
-			break;
-
-		case SQL_QUALIFIER_TERM:		/* ODBC 1.0 */
-			p = "";
-			break;
-
-		case SQL_QUALIFIER_USAGE:		/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_QUOTED_IDENTIFIER_CASE:		/* ODBC 2.0 */
-			/* are "quoted" identifiers case-sensitive?  YES! */
-			len = 2;
-			value = SQL_IC_SENSITIVE;
-			break;
-
-		case SQL_ROW_UPDATES:	/* ODBC 1.0 */
-
-			/*
-			 * Driver doesn't support keyset-driven or mixed cursors, so
-			 * not much point in saying row updates are supported
-			 */
-			p = globals.lie ? "Y" : "N";
-			break;
-
-		case SQL_SCROLL_CONCURRENCY:	/* ODBC 1.0 */
-			len = 4;
-			value = globals.lie ? (SQL_SCCO_READ_ONLY |
-								   SQL_SCCO_LOCK |
-								   SQL_SCCO_OPT_ROWVER |
-							 SQL_SCCO_OPT_VALUES) : (SQL_SCCO_READ_ONLY);
-			break;
-
-		case SQL_SCROLL_OPTIONS:		/* ODBC 1.0 */
-			len = 4;
-			value = globals.lie ? (SQL_SO_FORWARD_ONLY |
-								   SQL_SO_STATIC |
-								   SQL_SO_KEYSET_DRIVEN |
-								   SQL_SO_DYNAMIC |
-								   SQL_SO_MIXED) : (globals.use_declarefetch ? SQL_SO_FORWARD_ONLY : (SQL_SO_FORWARD_ONLY | SQL_SO_STATIC));
-			break;
-
-		case SQL_SEARCH_PATTERN_ESCAPE: /* ODBC 1.0 */
-			p = "";
-			break;
-
-		case SQL_SERVER_NAME:	/* ODBC 1.0 */
-			p = CC_get_server(conn);
-			break;
-
-		case SQL_SPECIAL_CHARACTERS:	/* ODBC 2.0 */
-			p = "_";
-			break;
-
-		case SQL_STATIC_SENSITIVITY:	/* ODBC 2.0 */
-			len = 4;
-			value = globals.lie ? (SQL_SS_ADDITIONS | SQL_SS_DELETIONS | SQL_SS_UPDATES) : 0;
-			break;
-
-		case SQL_STRING_FUNCTIONS:		/* ODBC 1.0 */
-			len = 4;
-			value = (SQL_FN_STR_CONCAT |
-					 SQL_FN_STR_LCASE |
-					 SQL_FN_STR_LENGTH |
-					 SQL_FN_STR_LOCATE |
-					 SQL_FN_STR_LTRIM |
-					 SQL_FN_STR_RTRIM |
-					 SQL_FN_STR_SUBSTRING |
-					 SQL_FN_STR_UCASE);
-			break;
-
-		case SQL_SUBQUERIES:	/* ODBC 2.0 */
-			/* postgres 6.3 supports subqueries */
-			len = 4;
-			value = (SQL_SQ_QUANTIFIED |
-					 SQL_SQ_IN |
-					 SQL_SQ_EXISTS |
-					 SQL_SQ_COMPARISON);
-			break;
-
-		case SQL_SYSTEM_FUNCTIONS:		/* ODBC 1.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_TABLE_TERM:	/* ODBC 1.0 */
-			p = "table";
-			break;
-
-		case SQL_TIMEDATE_ADD_INTERVALS:		/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_TIMEDATE_DIFF_INTERVALS:		/* ODBC 2.0 */
-			len = 4;
-			value = 0;
-			break;
-
-		case SQL_TIMEDATE_FUNCTIONS:	/* ODBC 1.0 */
-			len = 4;
-			value = (SQL_FN_TD_NOW);
-			break;
-
-		case SQL_TXN_CAPABLE:	/* ODBC 1.0 */
-
-			/*
-			 * Postgres can deal with create or drop table statements in a
-			 * transaction
-			 */
-			len = 2;
-			value = SQL_TC_ALL;
-			break;
-
-		case SQL_TXN_ISOLATION_OPTION:	/* ODBC 1.0 */
-			len = 4;
-			value = SQL_TXN_READ_COMMITTED;		/* SQL_TXN_SERIALIZABLE; */
-			break;
-
-		case SQL_UNION: /* ODBC 2.0 */
-			/* unions with all supported in postgres 6.3 */
-			len = 4;
-			value = (SQL_U_UNION | SQL_U_UNION_ALL);
-			break;
-
-		case SQL_USER_NAME:		/* ODBC 1.0 */
-			p = CC_get_username(conn);
-			break;
-
-		default:
-			/* unrecognized key */
-			conn->errormsg = "Unrecognized key passed to SQLGetInfo.";
-			conn->errornumber = CONN_NOT_IMPLEMENTED_ERROR;
-			CC_log_error(func, "", conn);
-			return SQL_ERROR;
-	}
+		}
+        break;
+
+    case SQL_OWNER_TERM: /* ODBC 1.0 */
+		p = "owner";
+        break;
+
+    case SQL_OWNER_USAGE: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_POS_OPERATIONS: /* ODBC 2.0 */
+		len = 4;
+        value = globals.lie ? (SQL_POS_POSITION | SQL_POS_REFRESH | SQL_POS_UPDATE | SQL_POS_DELETE | SQL_POS_ADD) : (SQL_POS_POSITION | SQL_POS_REFRESH);
+        break;
+
+    case SQL_POSITIONED_STATEMENTS: /* ODBC 2.0 */
+		len = 4;
+        value = globals.lie ? (SQL_PS_POSITIONED_DELETE | 
+								SQL_PS_POSITIONED_UPDATE | 
+								SQL_PS_SELECT_FOR_UPDATE) : 0;
+        break;
+
+    case SQL_PROCEDURE_TERM: /* ODBC 1.0 */
+        p = "procedure";
+        break;
+
+    case SQL_PROCEDURES: /* ODBC 1.0 */
+		p = "Y";
+        break;
+
+    case SQL_QUALIFIER_LOCATION: /* ODBC 2.0 */
+		len = 2;
+        value = SQL_QL_START;
+        break;
+
+    case SQL_QUALIFIER_NAME_SEPARATOR: /* ODBC 1.0 */
+		p = "";
+        break;
+
+    case SQL_QUALIFIER_TERM: /* ODBC 1.0 */
+		p = "";
+        break;
+
+    case SQL_QUALIFIER_USAGE: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_QUOTED_IDENTIFIER_CASE: /* ODBC 2.0 */
+        /* are "quoted" identifiers case-sensitive?  YES! */
+		len = 2;
+        value = SQL_IC_SENSITIVE;
+        break;
+
+    case SQL_ROW_UPDATES: /* ODBC 1.0 */
+        /*  Driver doesn't support keyset-driven or mixed cursors, so
+			not much point in saying row updates are supported
+		*/
+        p = globals.lie ? "Y" : "N";
+        break;
+
+    case SQL_SCROLL_CONCURRENCY: /* ODBC 1.0 */
+		len = 4;
+        value = globals.lie ? (SQL_SCCO_READ_ONLY | 
+								SQL_SCCO_LOCK | 
+								SQL_SCCO_OPT_ROWVER | 
+								SQL_SCCO_OPT_VALUES) : (SQL_SCCO_READ_ONLY);
+        break;
+
+    case SQL_SCROLL_OPTIONS: /* ODBC 1.0 */
+		len = 4;
+        value = globals.lie ? (SQL_SO_FORWARD_ONLY | 
+								SQL_SO_STATIC | 
+								SQL_SO_KEYSET_DRIVEN | 
+								SQL_SO_DYNAMIC | 
+								SQL_SO_MIXED) : (globals.use_declarefetch ? SQL_SO_FORWARD_ONLY : (SQL_SO_FORWARD_ONLY | SQL_SO_STATIC));
+        break;
+
+    case SQL_SEARCH_PATTERN_ESCAPE: /* ODBC 1.0 */
+		p = "";
+        break;
+
+    case SQL_SERVER_NAME: /* ODBC 1.0 */
+		p = CC_get_server(conn);
+        break;
+
+    case SQL_SPECIAL_CHARACTERS: /* ODBC 2.0 */
+        p = "_";
+        break;
+
+    case SQL_STATIC_SENSITIVITY: /* ODBC 2.0 */
+		len = 4;
+        value = globals.lie ? (SQL_SS_ADDITIONS | SQL_SS_DELETIONS | SQL_SS_UPDATES) : 0;
+        break;
+
+    case SQL_STRING_FUNCTIONS: /* ODBC 1.0 */
+		len = 4;
+        value = (SQL_FN_STR_CONCAT |
+				SQL_FN_STR_LCASE | 
+				SQL_FN_STR_LENGTH | 
+				SQL_FN_STR_LOCATE | 
+				SQL_FN_STR_LTRIM | 
+				SQL_FN_STR_RTRIM |
+				SQL_FN_STR_SUBSTRING |
+				SQL_FN_STR_UCASE);
+        break;
+
+    case SQL_SUBQUERIES: /* ODBC 2.0 */
+		/* postgres 6.3 supports subqueries */
+		len = 4;
+        value = (SQL_SQ_QUANTIFIED |
+				SQL_SQ_IN |
+				SQL_SQ_EXISTS |
+				SQL_SQ_COMPARISON);
+        break;
+
+    case SQL_SYSTEM_FUNCTIONS: /* ODBC 1.0 */
+		len = 4;
+		value = 0;
+        break;
+
+    case SQL_TABLE_TERM: /* ODBC 1.0 */
+		p = "table";
+        break;
+
+    case SQL_TIMEDATE_ADD_INTERVALS: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_TIMEDATE_DIFF_INTERVALS: /* ODBC 2.0 */
+		len = 4;
+        value = 0;
+        break;
+
+    case SQL_TIMEDATE_FUNCTIONS: /* ODBC 1.0 */
+		len = 4;
+        value = (SQL_FN_TD_NOW);
+        break;
+
+    case SQL_TXN_CAPABLE: /* ODBC 1.0 */
+        /* Postgres can deal with create or drop table statements in a transaction */
+		len = 2;
+        value = SQL_TC_ALL;
+        break;
+
+    case SQL_TXN_ISOLATION_OPTION: /* ODBC 1.0 */
+		len = 4;
+        value = SQL_TXN_READ_COMMITTED; /* SQL_TXN_SERIALIZABLE; */
+        break;
+
+    case SQL_UNION: /* ODBC 2.0 */
+		/*  unions with all supported in postgres 6.3 */
+		len = 4;
+        value = (SQL_U_UNION | SQL_U_UNION_ALL);
+        break;
+
+    case SQL_USER_NAME: /* ODBC 1.0 */
+		p = CC_get_username(conn);
+        break;
+
+    default:
+        /* unrecognized key */
+        conn->errormsg = "Unrecognized key passed to SQLGetInfo.";
+        conn->errornumber = CONN_NOT_IMPLEMENTED_ERROR;
+		CC_log_error(func, "", conn);
+        return SQL_ERROR;
+    }
 
 	result = SQL_SUCCESS;
 
-	mylog("SQLGetInfo: p='%s', len=%d, value=%d, cbMax=%d\n", p ? p : "<NULL>", len, value, cbInfoValueMax);
+	mylog("SQLGetInfo: p='%s', len=%d, value=%d, cbMax=%d\n", p?p:"<NULL>", len, value, cbInfoValueMax);
 
-	/*
-	 * NOTE, that if rgbInfoValue is NULL, then no warnings or errors
-	 * should result and just pcbInfoValue is returned, which indicates
-	 * what length would be required if a real buffer had been passed in.
-	 */
-	if (p)
-	{							/* char/binary data */
+	/*	NOTE, that if rgbInfoValue is NULL, then no warnings or errors should
+		result and just pcbInfoValue is returned, which indicates what length 
+		would be required if a real buffer had been passed in.
+	*/
+	if (p) {  /* char/binary data */
 		len = strlen(p);
 
-		if (rgbInfoValue)
-		{
-			strncpy_null((char *) rgbInfoValue, p, (size_t) cbInfoValueMax);
+		if (rgbInfoValue) {
+			strncpy_null((char *)rgbInfoValue, p, (size_t)cbInfoValueMax);
 
-			if (len >= cbInfoValueMax)
-			{
+			if (len >= cbInfoValueMax)  {
 				result = SQL_SUCCESS_WITH_INFO;
 				conn->errornumber = STMT_TRUNCATED;
 				conn->errormsg = "The buffer was too small for the result.";
@@ -692,45 +647,41 @@ SQLGetInfo(
 		}
 	}
 
-	else
-	{							/* numeric data */
-
-		if (rgbInfoValue)
-		{
-			if (len == 2)
-				*((WORD *) rgbInfoValue) = (WORD) value;
+	else {	/* numeric data */
+		
+		if (rgbInfoValue) {
+		
+			if (len == 2 ) 
+				*((WORD *)rgbInfoValue) = (WORD) value;
 			else if (len == 4)
-				*((DWORD *) rgbInfoValue) = (DWORD) value;
+				*((DWORD *)rgbInfoValue) = (DWORD) value;
 		}
 	}
 
-	if (pcbInfoValue)
+	if (pcbInfoValue) 
 		*pcbInfoValue = len;
 
 	return result;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
 
-RETCODE SQL_API
-SQLGetTypeInfo(
-			   HSTMT hstmt,
-			   SWORD fSqlType)
+RETCODE SQL_API SQLGetTypeInfo(
+        HSTMT   hstmt,
+        SWORD   fSqlType)
 {
-	static char *func = "SQLGetTypeInfo";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	TupleNode  *row;
-	int			i;
-
+static char *func = "SQLGetTypeInfo";
+StatementClass *stmt = (StatementClass *) hstmt;
+TupleNode *row;
+int i;
 /* Int4 type; */
-	Int4		pgType;
-	Int2		sqlType;
+Int4 pgType; 
+Int2 sqlType;
 
 	mylog("%s: entering...fSqlType = %d\n", func, fSqlType);
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -738,8 +689,7 @@ SQLGetTypeInfo(
 
 	stmt->manual_result = TRUE;
 	stmt->result = QR_Constructor();
-	if (!stmt->result)
-	{
+	if( ! stmt->result) {
 		SC_log_error(func, "Error creating result.", stmt);
 		return SQL_ERROR;
 	}
@@ -763,15 +713,13 @@ SQLGetTypeInfo(
 	QR_set_field_info(stmt->result, 13, "MINIMUM_SCALE", PG_TYPE_INT2, 2);
 	QR_set_field_info(stmt->result, 14, "MAXIMUM_SCALE", PG_TYPE_INT2, 2);
 
-	for (i = 0, sqlType = sqlTypes[0]; sqlType; sqlType = sqlTypes[++i])
-	{
+	for(i=0, sqlType = sqlTypes[0]; sqlType; sqlType = sqlTypes[++i]) {
 		pgType = sqltype_to_pgtype(sqlType);
 
-		if (fSqlType == SQL_ALL_TYPES || fSqlType == sqlType)
-		{
-			row = (TupleNode *) malloc(sizeof(TupleNode) + (15 - 1) *sizeof(TupleField));
+		if (fSqlType == SQL_ALL_TYPES || fSqlType == sqlType) {
+			row = (TupleNode *)malloc(sizeof(TupleNode) + (15 - 1)*sizeof(TupleField));
 
-			/* These values can't be NULL */
+			/*	These values can't be NULL */
 			set_tuplefield_string(&row->tuple[0], pgtype_to_name(stmt, pgType));
 			set_tuplefield_int2(&row->tuple[1], (Int2) sqlType);
 			set_tuplefield_int2(&row->tuple[6], pgtype_nullable(stmt, pgType));
@@ -779,13 +727,10 @@ SQLGetTypeInfo(
 			set_tuplefield_int2(&row->tuple[8], pgtype_searchable(stmt, pgType));
 			set_tuplefield_int2(&row->tuple[10], pgtype_money(stmt, pgType));
 
-			/*
-			 * Localized data-source dependent data type name (always
-			 * NULL)
-			 */
-			set_tuplefield_null(&row->tuple[12]);
+			/*	Localized data-source dependent data type name (always NULL) */
+			set_tuplefield_null(&row->tuple[12]);	
 
-			/* These values can be NULL */
+			/*	These values can be NULL */
 			set_nullfield_int4(&row->tuple[2], pgtype_precision(stmt, pgType, PG_STATIC, PG_STATIC));
 			set_nullfield_string(&row->tuple[3], pgtype_literal_prefix(stmt, pgType));
 			set_nullfield_string(&row->tuple[4], pgtype_literal_suffix(stmt, pgType));
@@ -800,33 +745,30 @@ SQLGetTypeInfo(
 	}
 
 
-	stmt->status = STMT_FINISHED;
-	stmt->currTuple = -1;
+    stmt->status = STMT_FINISHED;
+    stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLGetFunctions(
-				HDBC hdbc,
-				UWORD fFunction,
-				UWORD FAR *pfExists)
+RETCODE SQL_API SQLGetFunctions(
+        HDBC      hdbc,
+        UWORD     fFunction,
+        UWORD FAR *pfExists)
 {
-	static char *func = "SQLGetFunctions";
+static char *func="SQLGetFunctions";
 
-	mylog("%s: entering...\n", func);
+	mylog( "%s: entering...\n", func);
 
-	if (fFunction == SQL_API_ALL_FUNCTIONS)
-	{
-		if (globals.lie)
-		{
-			int			i;
+    if (fFunction == SQL_API_ALL_FUNCTIONS) {
 
-			memset(pfExists, 0, sizeof(UWORD) * 100);
+		if (globals.lie) {
+			int i;
+			memset(pfExists, 0, sizeof(UWORD)*100);
 
 			pfExists[SQL_API_SQLALLOCENV] = TRUE;
 			pfExists[SQL_API_SQLFREEENV] = TRUE;
@@ -835,306 +777,179 @@ SQLGetFunctions(
 			for (i = SQL_EXT_API_START; i <= SQL_EXT_API_LAST; i++)
 				pfExists[i] = TRUE;
 		}
-		else
-		{
-			memset(pfExists, 0, sizeof(UWORD) * 100);
+		else {
+			memset(pfExists, 0, sizeof(UWORD)*100);
 
 			/* ODBC core functions */
-			pfExists[SQL_API_SQLALLOCCONNECT] = TRUE;
-			pfExists[SQL_API_SQLALLOCENV] = TRUE;
-			pfExists[SQL_API_SQLALLOCSTMT] = TRUE;
-			pfExists[SQL_API_SQLBINDCOL] = TRUE;
-			pfExists[SQL_API_SQLCANCEL] = TRUE;
-			pfExists[SQL_API_SQLCOLATTRIBUTES] = TRUE;
-			pfExists[SQL_API_SQLCONNECT] = TRUE;
-			pfExists[SQL_API_SQLDESCRIBECOL] = TRUE;	/* partial */
-			pfExists[SQL_API_SQLDISCONNECT] = TRUE;
-			pfExists[SQL_API_SQLERROR] = TRUE;
-			pfExists[SQL_API_SQLEXECDIRECT] = TRUE;
-			pfExists[SQL_API_SQLEXECUTE] = TRUE;
-			pfExists[SQL_API_SQLFETCH] = TRUE;
-			pfExists[SQL_API_SQLFREECONNECT] = TRUE;
-			pfExists[SQL_API_SQLFREEENV] = TRUE;
-			pfExists[SQL_API_SQLFREESTMT] = TRUE;
-			pfExists[SQL_API_SQLGETCURSORNAME] = TRUE;
-			pfExists[SQL_API_SQLNUMRESULTCOLS] = TRUE;
-			pfExists[SQL_API_SQLPREPARE] = TRUE;		/* complete? */
-			pfExists[SQL_API_SQLROWCOUNT] = TRUE;
-			pfExists[SQL_API_SQLSETCURSORNAME] = TRUE;
-			pfExists[SQL_API_SQLSETPARAM] = FALSE;		/* odbc 1.0 */
-			pfExists[SQL_API_SQLTRANSACT] = TRUE;
+			pfExists[SQL_API_SQLALLOCCONNECT]     = TRUE;
+			pfExists[SQL_API_SQLALLOCENV]         = TRUE;
+			pfExists[SQL_API_SQLALLOCSTMT]        = TRUE;
+			pfExists[SQL_API_SQLBINDCOL]          = TRUE;  
+			pfExists[SQL_API_SQLCANCEL]           = TRUE;
+			pfExists[SQL_API_SQLCOLATTRIBUTES]    = TRUE;
+			pfExists[SQL_API_SQLCONNECT]          = TRUE;
+			pfExists[SQL_API_SQLDESCRIBECOL]      = TRUE;  /* partial */
+			pfExists[SQL_API_SQLDISCONNECT]       = TRUE;
+			pfExists[SQL_API_SQLERROR]            = TRUE;
+			pfExists[SQL_API_SQLEXECDIRECT]       = TRUE;
+			pfExists[SQL_API_SQLEXECUTE]          = TRUE;
+			pfExists[SQL_API_SQLFETCH]            = TRUE;
+			pfExists[SQL_API_SQLFREECONNECT]      = TRUE;
+			pfExists[SQL_API_SQLFREEENV]          = TRUE;
+			pfExists[SQL_API_SQLFREESTMT]         = TRUE;
+			pfExists[SQL_API_SQLGETCURSORNAME]    = TRUE;
+			pfExists[SQL_API_SQLNUMRESULTCOLS]    = TRUE;
+			pfExists[SQL_API_SQLPREPARE]          = TRUE;  /* complete? */
+			pfExists[SQL_API_SQLROWCOUNT]         = TRUE;
+			pfExists[SQL_API_SQLSETCURSORNAME]    = TRUE;
+			pfExists[SQL_API_SQLSETPARAM]         = FALSE; /* odbc 1.0 */
+			pfExists[SQL_API_SQLTRANSACT]         = TRUE;
 
 			/* ODBC level 1 functions */
-			pfExists[SQL_API_SQLBINDPARAMETER] = TRUE;
-			pfExists[SQL_API_SQLCOLUMNS] = TRUE;
-			pfExists[SQL_API_SQLDRIVERCONNECT] = TRUE;
-			pfExists[SQL_API_SQLGETCONNECTOPTION] = TRUE;		/* partial */
-			pfExists[SQL_API_SQLGETDATA] = TRUE;
-			pfExists[SQL_API_SQLGETFUNCTIONS] = TRUE;
-			pfExists[SQL_API_SQLGETINFO] = TRUE;
-			pfExists[SQL_API_SQLGETSTMTOPTION] = TRUE;	/* partial */
-			pfExists[SQL_API_SQLGETTYPEINFO] = TRUE;
-			pfExists[SQL_API_SQLPARAMDATA] = TRUE;
-			pfExists[SQL_API_SQLPUTDATA] = TRUE;
-			pfExists[SQL_API_SQLSETCONNECTOPTION] = TRUE;		/* partial */
-			pfExists[SQL_API_SQLSETSTMTOPTION] = TRUE;
-			pfExists[SQL_API_SQLSPECIALCOLUMNS] = TRUE;
-			pfExists[SQL_API_SQLSTATISTICS] = TRUE;
-			pfExists[SQL_API_SQLTABLES] = TRUE;
+			pfExists[SQL_API_SQLBINDPARAMETER]    = TRUE;
+			pfExists[SQL_API_SQLCOLUMNS]          = TRUE;
+			pfExists[SQL_API_SQLDRIVERCONNECT]    = TRUE;
+			pfExists[SQL_API_SQLGETCONNECTOPTION] = TRUE;  /* partial */
+			pfExists[SQL_API_SQLGETDATA]          = TRUE;
+			pfExists[SQL_API_SQLGETFUNCTIONS]     = TRUE;                                                       
+			pfExists[SQL_API_SQLGETINFO]          = TRUE;
+			pfExists[SQL_API_SQLGETSTMTOPTION]    = TRUE;  /* partial */
+			pfExists[SQL_API_SQLGETTYPEINFO]      = TRUE;
+			pfExists[SQL_API_SQLPARAMDATA]        = TRUE;
+			pfExists[SQL_API_SQLPUTDATA]          = TRUE;
+			pfExists[SQL_API_SQLSETCONNECTOPTION] = TRUE;  /* partial */
+			pfExists[SQL_API_SQLSETSTMTOPTION]    = TRUE;
+			pfExists[SQL_API_SQLSPECIALCOLUMNS]   = TRUE;
+			pfExists[SQL_API_SQLSTATISTICS]       = TRUE;
+			pfExists[SQL_API_SQLTABLES]           = TRUE;
 
 			/* ODBC level 2 functions */
-			pfExists[SQL_API_SQLBROWSECONNECT] = FALSE;
+			pfExists[SQL_API_SQLBROWSECONNECT]    = FALSE;
 			pfExists[SQL_API_SQLCOLUMNPRIVILEGES] = FALSE;
-			pfExists[SQL_API_SQLDATASOURCES] = FALSE;	/* only implemented by
-														 * DM */
-			pfExists[SQL_API_SQLDESCRIBEPARAM] = FALSE; /* not properly
-														 * implemented */
-			pfExists[SQL_API_SQLDRIVERS] = FALSE;		/* only implemented by
-														 * DM */
-			pfExists[SQL_API_SQLEXTENDEDFETCH] = TRUE;
-			pfExists[SQL_API_SQLFOREIGNKEYS] = TRUE;
-			pfExists[SQL_API_SQLMORERESULTS] = TRUE;
-			pfExists[SQL_API_SQLNATIVESQL] = TRUE;
-			pfExists[SQL_API_SQLNUMPARAMS] = TRUE;
-			pfExists[SQL_API_SQLPARAMOPTIONS] = FALSE;
-			pfExists[SQL_API_SQLPRIMARYKEYS] = TRUE;
+			pfExists[SQL_API_SQLDATASOURCES]      = FALSE;  /* only implemented by DM */
+			pfExists[SQL_API_SQLDESCRIBEPARAM]    = FALSE;	/* not properly implemented */
+			pfExists[SQL_API_SQLDRIVERS]          = FALSE;  /* only implemented by DM */
+			pfExists[SQL_API_SQLEXTENDEDFETCH]    = TRUE;
+			pfExists[SQL_API_SQLFOREIGNKEYS]      = TRUE;
+			pfExists[SQL_API_SQLMORERESULTS]      = TRUE;
+			pfExists[SQL_API_SQLNATIVESQL]        = TRUE;
+			pfExists[SQL_API_SQLNUMPARAMS]        = TRUE;
+			pfExists[SQL_API_SQLPARAMOPTIONS]     = FALSE;
+			pfExists[SQL_API_SQLPRIMARYKEYS]      = TRUE;
 			pfExists[SQL_API_SQLPROCEDURECOLUMNS] = FALSE;
-			pfExists[SQL_API_SQLPROCEDURES] = FALSE;
-			pfExists[SQL_API_SQLSETPOS] = TRUE;
-			pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE;		/* odbc 1.0 */
-			pfExists[SQL_API_SQLTABLEPRIVILEGES] = FALSE;
+			pfExists[SQL_API_SQLPROCEDURES]       = FALSE;
+			pfExists[SQL_API_SQLSETPOS]           = TRUE;
+			pfExists[SQL_API_SQLSETSCROLLOPTIONS] = TRUE;	/* odbc 1.0 */
+			pfExists[SQL_API_SQLTABLEPRIVILEGES]  = FALSE;
 		}
-	}
-	else
-	{
+    } else {
+
 		if (globals.lie)
 			*pfExists = TRUE;
-		else
-		{
-			switch (fFunction)
-			{
-				case SQL_API_SQLALLOCCONNECT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLALLOCENV:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLALLOCSTMT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLBINDCOL:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLCANCEL:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLCOLATTRIBUTES:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLCONNECT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLDESCRIBECOL:
-					*pfExists = TRUE;
-					break;		/* partial */
-				case SQL_API_SQLDISCONNECT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLERROR:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLEXECDIRECT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLEXECUTE:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLFETCH:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLFREECONNECT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLFREEENV:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLFREESTMT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLGETCURSORNAME:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLNUMRESULTCOLS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLPREPARE:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLROWCOUNT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLSETCURSORNAME:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLSETPARAM:
-					*pfExists = FALSE;
-					break;		/* odbc 1.0 */
-				case SQL_API_SQLTRANSACT:
-					*pfExists = TRUE;
-					break;
 
-					/* ODBC level 1 functions */
-				case SQL_API_SQLBINDPARAMETER:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLCOLUMNS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLDRIVERCONNECT:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLGETCONNECTOPTION:
-					*pfExists = TRUE;
-					break;		/* partial */
-				case SQL_API_SQLGETDATA:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLGETFUNCTIONS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLGETINFO:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLGETSTMTOPTION:
-					*pfExists = TRUE;
-					break;		/* partial */
-				case SQL_API_SQLGETTYPEINFO:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLPARAMDATA:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLPUTDATA:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLSETCONNECTOPTION:
-					*pfExists = TRUE;
-					break;		/* partial */
-				case SQL_API_SQLSETSTMTOPTION:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLSPECIALCOLUMNS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLSTATISTICS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLTABLES:
-					*pfExists = TRUE;
-					break;
-
-					/* ODBC level 2 functions */
-				case SQL_API_SQLBROWSECONNECT:
-					*pfExists = FALSE;
-					break;
-				case SQL_API_SQLCOLUMNPRIVILEGES:
-					*pfExists = FALSE;
-					break;
-				case SQL_API_SQLDATASOURCES:
-					*pfExists = FALSE;
-					break;		/* only implemented by DM */
-				case SQL_API_SQLDESCRIBEPARAM:
-					*pfExists = FALSE;
-					break;		/* not properly implemented */
-				case SQL_API_SQLDRIVERS:
-					*pfExists = FALSE;
-					break;		/* only implemented by DM */
-				case SQL_API_SQLEXTENDEDFETCH:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLFOREIGNKEYS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLMORERESULTS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLNATIVESQL:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLNUMPARAMS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLPARAMOPTIONS:
-					*pfExists = FALSE;
-					break;
-				case SQL_API_SQLPRIMARYKEYS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLPROCEDURECOLUMNS:
-					*pfExists = FALSE;
-					break;
-				case SQL_API_SQLPROCEDURES:
-					*pfExists = FALSE;
-					break;
-				case SQL_API_SQLSETPOS:
-					*pfExists = TRUE;
-					break;
-				case SQL_API_SQLSETSCROLLOPTIONS:
-					*pfExists = TRUE;
-					break;		/* odbc 1.0 */
-				case SQL_API_SQLTABLEPRIVILEGES:
-					*pfExists = FALSE;
-					break;
+		else {
+
+			switch(fFunction) {
+			case SQL_API_SQLALLOCCONNECT:     *pfExists = TRUE; break;
+			case SQL_API_SQLALLOCENV:         *pfExists = TRUE; break;
+			case SQL_API_SQLALLOCSTMT:        *pfExists = TRUE; break;
+			case SQL_API_SQLBINDCOL:          *pfExists = TRUE; break;
+			case SQL_API_SQLCANCEL:           *pfExists = TRUE; break;
+			case SQL_API_SQLCOLATTRIBUTES:    *pfExists = TRUE; break;
+			case SQL_API_SQLCONNECT:          *pfExists = TRUE; break;
+			case SQL_API_SQLDESCRIBECOL:      *pfExists = TRUE; break;  /* partial */
+			case SQL_API_SQLDISCONNECT:       *pfExists = TRUE; break;
+			case SQL_API_SQLERROR:            *pfExists = TRUE; break;
+			case SQL_API_SQLEXECDIRECT:       *pfExists = TRUE; break;
+			case SQL_API_SQLEXECUTE:          *pfExists = TRUE; break;
+			case SQL_API_SQLFETCH:            *pfExists = TRUE; break;
+			case SQL_API_SQLFREECONNECT:      *pfExists = TRUE; break;
+			case SQL_API_SQLFREEENV:          *pfExists = TRUE; break;
+			case SQL_API_SQLFREESTMT:         *pfExists = TRUE; break;
+			case SQL_API_SQLGETCURSORNAME:    *pfExists = TRUE; break;
+			case SQL_API_SQLNUMRESULTCOLS:    *pfExists = TRUE; break;
+			case SQL_API_SQLPREPARE:          *pfExists = TRUE; break;
+			case SQL_API_SQLROWCOUNT:         *pfExists = TRUE; break;
+			case SQL_API_SQLSETCURSORNAME:    *pfExists = TRUE; break;
+			case SQL_API_SQLSETPARAM:         *pfExists = FALSE; break; /* odbc 1.0 */
+			case SQL_API_SQLTRANSACT:         *pfExists = TRUE; break;
+
+				/* ODBC level 1 functions */
+			case SQL_API_SQLBINDPARAMETER:    *pfExists = TRUE; break;
+			case SQL_API_SQLCOLUMNS:          *pfExists = TRUE; break;
+			case SQL_API_SQLDRIVERCONNECT:    *pfExists = TRUE; break;
+			case SQL_API_SQLGETCONNECTOPTION: *pfExists = TRUE; break;  /* partial */
+			case SQL_API_SQLGETDATA:          *pfExists = TRUE; break;
+			case SQL_API_SQLGETFUNCTIONS:     *pfExists = TRUE; break;
+			case SQL_API_SQLGETINFO:          *pfExists = TRUE; break;
+			case SQL_API_SQLGETSTMTOPTION:    *pfExists = TRUE; break;  /* partial */
+			case SQL_API_SQLGETTYPEINFO:      *pfExists = TRUE; break;
+			case SQL_API_SQLPARAMDATA:        *pfExists = TRUE; break;
+			case SQL_API_SQLPUTDATA:          *pfExists = TRUE; break;
+			case SQL_API_SQLSETCONNECTOPTION: *pfExists = TRUE; break;  /* partial */
+			case SQL_API_SQLSETSTMTOPTION:    *pfExists = TRUE; break;
+			case SQL_API_SQLSPECIALCOLUMNS:   *pfExists = TRUE; break;
+			case SQL_API_SQLSTATISTICS:       *pfExists = TRUE; break;
+			case SQL_API_SQLTABLES:           *pfExists = TRUE; break;
+
+				/* ODBC level 2 functions */
+			case SQL_API_SQLBROWSECONNECT:    *pfExists = FALSE; break;
+			case SQL_API_SQLCOLUMNPRIVILEGES: *pfExists = FALSE; break;
+			case SQL_API_SQLDATASOURCES:      *pfExists = FALSE; break;  /* only implemented by DM */
+			case SQL_API_SQLDESCRIBEPARAM:    *pfExists = FALSE; break;  /* not properly implemented */
+			case SQL_API_SQLDRIVERS:          *pfExists = FALSE; break;  /* only implemented by DM */
+			case SQL_API_SQLEXTENDEDFETCH:    *pfExists = TRUE; break;
+			case SQL_API_SQLFOREIGNKEYS:      *pfExists = TRUE; break;
+			case SQL_API_SQLMORERESULTS:      *pfExists = TRUE; break;
+			case SQL_API_SQLNATIVESQL:        *pfExists = TRUE; break;
+			case SQL_API_SQLNUMPARAMS:        *pfExists = TRUE; break;
+			case SQL_API_SQLPARAMOPTIONS:     *pfExists = FALSE; break;
+			case SQL_API_SQLPRIMARYKEYS:      *pfExists = TRUE; break;
+			case SQL_API_SQLPROCEDURECOLUMNS: *pfExists = FALSE; break;
+			case SQL_API_SQLPROCEDURES:       *pfExists = FALSE; break;
+			case SQL_API_SQLSETPOS:           *pfExists = TRUE; break;
+			case SQL_API_SQLSETSCROLLOPTIONS: *pfExists = TRUE; break;	/* odbc 1.0 */
+			case SQL_API_SQLTABLEPRIVILEGES:  *pfExists = FALSE; break;
 			}
 		}
-	}
+    }
 
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
 
 
-RETCODE SQL_API
-SQLTables(
-		  HSTMT hstmt,
-		  UCHAR FAR *szTableQualifier,
-		  SWORD cbTableQualifier,
-		  UCHAR FAR *szTableOwner,
-		  SWORD cbTableOwner,
-		  UCHAR FAR *szTableName,
-		  SWORD cbTableName,
-		  UCHAR FAR *szTableType,
-		  SWORD cbTableType)
+RETCODE SQL_API SQLTables(
+                          HSTMT       hstmt,
+                          UCHAR FAR * szTableQualifier,
+                          SWORD       cbTableQualifier,
+                          UCHAR FAR * szTableOwner,
+                          SWORD       cbTableOwner,
+                          UCHAR FAR * szTableName,
+                          SWORD       cbTableName,
+                          UCHAR FAR * szTableType,
+                          SWORD       cbTableType)
 {
-	static char *func = "SQLTables";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	StatementClass *tbl_stmt;
-	TupleNode  *row;
-	HSTMT		htbl_stmt;
-	RETCODE		result;
-	char	   *tableType;
-	char		tables_query[STD_STATEMENT_LEN];
-	char		table_name[MAX_INFO_STRING],
-				table_owner[MAX_INFO_STRING],
-				relkind_or_hasrules[MAX_INFO_STRING];
-	ConnectionClass *conn;
-	ConnInfo   *ci;
-	char	   *prefix[32],
-				prefixes[MEDIUM_REGISTRY_LEN];
-	char	   *table_type[32],
-				table_types[MAX_INFO_STRING];
-	char		show_system_tables,
-				show_regular_tables,
-				show_views;
-	char		regular_table,
-				view,
-				systable;
-	int			i;
-
-	mylog("%s: entering...stmt=%u\n", func, stmt);
-
-	if (!stmt)
-	{
+static char *func = "SQLTables";
+StatementClass *stmt = (StatementClass *) hstmt;
+StatementClass *tbl_stmt;
+TupleNode *row;
+HSTMT htbl_stmt;
+RETCODE result;
+char *tableType;
+char tables_query[STD_STATEMENT_LEN];
+char table_name[MAX_INFO_STRING], table_owner[MAX_INFO_STRING], relkind_or_hasrules[MAX_INFO_STRING];
+ConnectionClass *conn;
+ConnInfo *ci;
+char *prefix[32], prefixes[MEDIUM_REGISTRY_LEN];
+char *table_type[32], table_types[MAX_INFO_STRING];
+char show_system_tables, show_regular_tables, show_views;
+char regular_table, view, systable;
+int i;
+
+mylog("%s: entering...stmt=%u\n", func, stmt);
+
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -1145,9 +960,8 @@ SQLTables(
 	conn = (ConnectionClass *) (stmt->hdbc);
 	ci = &stmt->hdbc->connInfo;
 
-	result = SQLAllocStmt(stmt->hdbc, &htbl_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	result = SQLAllocStmt( stmt->hdbc, &htbl_stmt);
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLTables result.";
 		SC_log_error(func, "", stmt);
@@ -1156,17 +970,14 @@ SQLTables(
 	tbl_stmt = (StatementClass *) htbl_stmt;
 
 	/* ********************************************************************** */
-	/* Create the query to find out the tables */
+	/*	Create the query to find out the tables */
 	/* ********************************************************************** */
 
-	if (PG_VERSION_GE(conn, 7.1))
-	{							/* view is represented by its relkind
-								 * since 7.1 */
+	if (PG_VERSION_GE(conn, 7.1)) { /* view is represented by its relkind since 7.1 */
 		strcpy(tables_query, "select relname, usename, relkind from pg_class, pg_user");
 		strcat(tables_query, " where relkind in ('r', 'v')");
 	}
-	else
-	{
+	else {
 		strcpy(tables_query, "select relname, usename, relhasrules from pg_class, pg_user");
 		strcat(tables_query, " where relkind = 'r'");
 	}
@@ -1175,64 +986,58 @@ SQLTables(
 	my_strcat(tables_query, " and relname like '%.*s'", szTableName, cbTableName);
 
 
-	/* Parse the extra systable prefix	*/
+	/*	Parse the extra systable prefix  */
 	strcpy(prefixes, globals.extra_systable_prefixes);
 	i = 0;
 	prefix[i] = strtok(prefixes, ";");
-	while (prefix[i] && i < 32)
-	{
+	while (prefix[i] && i<32) {
 		prefix[++i] = strtok(NULL, ";");
 	}
 
-	/* Parse the desired table types to return */
+	/*	Parse the desired table types to return */
 	show_system_tables = FALSE;
 	show_regular_tables = FALSE;
 	show_views = FALSE;
 
-	/* make_string mallocs memory */
+	/*	make_string mallocs memory */
 	tableType = make_string(szTableType, cbTableType, NULL);
-	if (tableType)
-	{
+	if (tableType) {
 		strcpy(table_types, tableType);
 		free(tableType);
 		i = 0;
 		table_type[i] = strtok(table_types, ",");
-		while (table_type[i] && i < 32)
+		while (table_type[i] && i<32) {
 			table_type[++i] = strtok(NULL, ",");
+		}
 
-		/* Check for desired table types to return */
+		/*	Check for desired table types to return */
 		i = 0;
-		while (table_type[i])
-		{
-			if (strstr(table_type[i], "SYSTEM TABLE"))
+		while (table_type[i]) {
+			if ( strstr(table_type[i], "SYSTEM TABLE"))
 				show_system_tables = TRUE;
-			else if (strstr(table_type[i], "TABLE"))
+			else if ( strstr(table_type[i], "TABLE"))
 				show_regular_tables = TRUE;
-			else if (strstr(table_type[i], "VIEW"))
+			else if ( strstr(table_type[i], "VIEW"))
 				show_views = TRUE;
 
 			i++;
 		}
 	}
-	else
-	{
+	else {
 		show_regular_tables = TRUE;
 		show_views = TRUE;
 	}
 
-	/*
-	 * If not interested in SYSTEM TABLES then filter them out to save
-	 * some time on the query.	If treating system tables as regular
-	 * tables, then dont filter either.
-	 */
-	if (!atoi(ci->show_system_tables) && !show_system_tables)
-	{
+	/*  If not interested in SYSTEM TABLES then filter them out
+		to save some time on the query.  If treating system tables
+		as regular tables, then dont filter either.
+	*/
+	if ( ! atoi(ci->show_system_tables) && ! show_system_tables) {
 		strcat(tables_query, " and relname !~ '^" POSTGRES_SYS_PREFIX);
 
-		/* Also filter out user-defined system table types */
+		/*	Also filter out user-defined system table types */
 		i = 0;
-		while (prefix[i])
-		{
+		while(prefix[i]) {
 			strcat(tables_query, "|^");
 			strcat(tables_query, prefix[i]);
 			i++;
@@ -1243,9 +1048,8 @@ SQLTables(
 
 
 	/* match users */
-	if (PG_VERSION_LT(conn, 7.1))		/* filter out large objects in
-										 * older versions */
-		strcat(tables_query, " and relname !~ '^xinv[0-9]+'");
+	if (PG_VERSION_LT(conn, 7.1)) /* filter out large objects in older versions */ 
+		strcat(tables_query, " and relname !~ '^xinv[0-9]+'"); 
 
 	strcat(tables_query, " and usesysid = relowner");
 	strcat(tables_query, " order by relname");
@@ -1253,8 +1057,7 @@ SQLTables(
 	/* ********************************************************************** */
 
 	result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
@@ -1262,41 +1065,37 @@ SQLTables(
 		return SQL_ERROR;
 	}
 
-	result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
-						table_name, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
+                        table_name, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(htbl_stmt, 2, SQL_C_CHAR,
-						table_owner, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(htbl_stmt, 2, SQL_C_CHAR,
+                        table_owner, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
-	result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
-						relkind_or_hasrules, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+        return SQL_ERROR;
+    }
+    result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
+                        relkind_or_hasrules, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
 	stmt->result = QR_Constructor();
-	if (!stmt->result)
-	{
+	if(!stmt->result) {
 		stmt->errormsg = "Couldn't allocate memory for SQLTables result.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
@@ -1305,13 +1104,9 @@ SQLTables(
 	}
 
 	/* the binding structure for a statement is not set up until */
-
-	/*
-	 * a statement is actually executed, so we'll have to do this
-	 * ourselves.
-	 */
+	/* a statement is actually executed, so we'll have to do this ourselves. */
 	extend_bindings(stmt, 5);
-
+	
 	/* set the field names */
 	QR_set_num_fields(stmt->result, 5);
 	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
@@ -1322,27 +1117,23 @@ SQLTables(
 
 	/* add the tuples */
 	result = SQLFetch(htbl_stmt);
-	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
-	{
+	while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
 
-		/*
-		 * Determine if this table name is a system table. If treating
-		 * system tables as regular tables, then no need to do this test.
-		 */
+		/*	Determine if this table name is a system table.
+			If treating system tables as regular tables, then 
+			no need to do this test.
+		*/		
 		systable = FALSE;
-		if (!atoi(ci->show_system_tables))
-		{
-			if (strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)
+		if( ! atoi(ci->show_system_tables)) {
+
+			if ( strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)
 				systable = TRUE;
 
-			else
-			{					/* Check extra system table prefixes */
+			else {			/* Check extra system table prefixes */
 				i = 0;
-				while (prefix[i])
-				{
+				while (prefix[i]) {
 					mylog("table_name='%s', prefix[%d]='%s'\n", table_name, i, prefix[i]);
-					if (strncmp(table_name, prefix[i], strlen(prefix[i])) == 0)
-					{
+					if (strncmp(table_name, prefix[i], strlen(prefix[i])) == 0) {
 						systable = TRUE;
 						break;
 					}
@@ -1351,28 +1142,24 @@ SQLTables(
 			}
 		}
 
-		/* Determine if the table name is a view */
-		if (PG_VERSION_GE(conn, 7.1))	/* view is represented by its
-										 * relkind since 7.1 */
+		/*	Determine if the table name is a view */
+		if (PG_VERSION_GE(conn, 7.1)) /* view is represented by its relkind since 7.1 */
 			view = (relkind_or_hasrules[0] == 'v');
 		else
 			view = (relkind_or_hasrules[0] == '1');
 
-		/* It must be a regular table */
-		regular_table = (!systable && !view);
+		/*	It must be a regular table */
+		regular_table = ( ! systable && ! view);
 
 
-		/* Include the row in the result set if meets all criteria */
+		/*	Include the row in the result set if meets all criteria */
+		/*	NOTE: Unsupported table types (i.e., LOCAL TEMPORARY, ALIAS, etc)
+					will return nothing */
+		if ( (systable && show_system_tables) ||
+			 (view && show_views) || 
+			 (regular_table && show_regular_tables)) {
 
-		/*
-		 * NOTE: Unsupported table types (i.e., LOCAL TEMPORARY, ALIAS,
-		 * etc) will return nothing
-		 */
-		if ((systable && show_system_tables) ||
-			(view && show_views) ||
-			(regular_table && show_regular_tables))
-		{
-			row = (TupleNode *) malloc(sizeof(TupleNode) + (5 - 1) *sizeof(TupleField));
+			row = (TupleNode *)malloc(sizeof(TupleNode) + (5 - 1) * sizeof(TupleField));
 
 			set_tuplefield_string(&row->tuple[0], "");
 
@@ -1392,9 +1179,8 @@ SQLTables(
 			QR_add_tuple(stmt->result, row);
 		}
 		result = SQLFetch(htbl_stmt);
-	}
-	if (result != SQL_NO_DATA_FOUND)
-	{
+    }
+	if(result != SQL_NO_DATA_FOUND) {
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
@@ -1419,48 +1205,36 @@ SQLTables(
 
 
 
-RETCODE SQL_API
-SQLColumns(
-		   HSTMT hstmt,
-		   UCHAR FAR *szTableQualifier,
-		   SWORD cbTableQualifier,
-		   UCHAR FAR *szTableOwner,
-		   SWORD cbTableOwner,
-		   UCHAR FAR *szTableName,
-		   SWORD cbTableName,
-		   UCHAR FAR *szColumnName,
-		   SWORD cbColumnName)
+RETCODE SQL_API SQLColumns(
+                           HSTMT        hstmt,
+                           UCHAR FAR *  szTableQualifier,
+                           SWORD        cbTableQualifier,
+                           UCHAR FAR *  szTableOwner,
+                           SWORD        cbTableOwner,
+                           UCHAR FAR *  szTableName,
+                           SWORD        cbTableName,
+                           UCHAR FAR *  szColumnName,
+                           SWORD        cbColumnName)
 {
-	static char *func = "SQLColumns";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	TupleNode  *row;
-	HSTMT		hcol_stmt;
-	StatementClass *col_stmt;
-	char		columns_query[STD_STATEMENT_LEN];
-	RETCODE		result;
-	char		table_owner[MAX_INFO_STRING],
-				table_name[MAX_INFO_STRING],
-				field_name[MAX_INFO_STRING],
-				field_type_name[MAX_INFO_STRING];
-	Int2		field_number,
-				result_cols,
-				scale;
-	Int4		field_type,
-				the_type,
-				field_length,
-				mod_length,
-				precision;
-	char		useStaticPrecision;
-	char		not_null[MAX_INFO_STRING],
-				relhasrules[MAX_INFO_STRING];
-	ConnInfo   *ci;
-	ConnectionClass *conn;
+static char *func = "SQLColumns";
+StatementClass *stmt = (StatementClass *) hstmt;
+TupleNode *row;
+HSTMT hcol_stmt;
+StatementClass *col_stmt;
+char columns_query[STD_STATEMENT_LEN];
+RETCODE result;
+char table_owner[MAX_INFO_STRING], table_name[MAX_INFO_STRING], field_name[MAX_INFO_STRING], field_type_name[MAX_INFO_STRING];
+Int2 field_number, result_cols, scale;
+Int4 field_type, the_type, field_length, mod_length, precision;
+char useStaticPrecision;
+char not_null[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
+ConnInfo *ci;
+ConnectionClass *conn;
 
 
 	mylog("%s: entering...stmt=%u\n", func, stmt);
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -1472,17 +1246,13 @@ SQLColumns(
 	ci = &stmt->hdbc->connInfo;
 
 	/* ********************************************************************** */
-
-	/*
-	 * Create the query to find out the columns (Note: pre 6.3 did not
-	 * have the atttypmod field)
-	 */
+	/*	Create the query to find out the columns (Note: pre 6.3 did not have the atttypmod field) */
 	/* ********************************************************************** */
 	sprintf(columns_query, "select u.usename, c.relname, a.attname, a.atttypid"
-	   ", t.typname, a.attnum, a.attlen, %s, a.attnotnull, c.relhasrules"
+			", t.typname, a.attnum, a.attlen, %s, a.attnotnull, c.relhasrules"
 			" from pg_user u, pg_class c, pg_attribute a, pg_type t"
 			" where u.usesysid = c.relowner"
-	  " and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)",
+			" and c.oid= a.attrelid and a.atttypid = t.oid and (a.attnum > 0)",
 			PG_VERSION_LE(conn, 6.2) ? "a.attlen" : "a.atttypmod");
 
 	my_strcat(columns_query, " and c.relname like '%.*s'", szTableName, cbTableName);
@@ -1491,204 +1261,186 @@ SQLColumns(
 
 	/* give the output in the order the columns were defined */
 	/* when the table was created */
-	strcat(columns_query, " order by attnum");
-	/* ********************************************************************** */
+    strcat(columns_query, " order by attnum");
+    /* ********************************************************************** */
 
-	result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLColumns result.";
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 	col_stmt = (StatementClass *) hcol_stmt;
 
 	mylog("SQLColumns: hcol_stmt = %u, col_stmt = %u\n", hcol_stmt, col_stmt);
 
-	result = SQLExecDirect(hcol_stmt, columns_query,
-						   strlen(columns_query));
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLExecDirect(hcol_stmt, columns_query,
+                           strlen(columns_query));
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = SC_create_errormsg(hcol_stmt);
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
-						table_owner, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
+                        table_owner, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 2, SQL_C_CHAR,
-						table_name, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 2, SQL_C_CHAR,
+                        table_name, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 3, SQL_C_CHAR,
-						field_name, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 3, SQL_C_CHAR,
+                        field_name, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 4, SQL_C_LONG,
-						&field_type, 4, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 4, SQL_C_LONG,
+                        &field_type, 4, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 5, SQL_C_CHAR,
-						field_type_name, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 5, SQL_C_CHAR,
+                        field_type_name, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 6, SQL_C_SHORT,
-						&field_number, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 6, SQL_C_SHORT,
+                        &field_number, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 7, SQL_C_LONG,
-						&field_length, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 7, SQL_C_LONG,
+                        &field_length, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 8, SQL_C_LONG,
-						&mod_length, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 8, SQL_C_LONG,
+                        &mod_length, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 9, SQL_C_CHAR,
-						not_null, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 9, SQL_C_CHAR,
+                        not_null, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 10, SQL_C_CHAR,
-						relhasrules, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 10, SQL_C_CHAR,
+                        relhasrules, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	stmt->result = QR_Constructor();
-	if (!stmt->result)
-	{
+    stmt->result = QR_Constructor();
+    if(!stmt->result) {
 		stmt->errormsg = "Couldn't allocate memory for SQLColumns result.";
-		stmt->errornumber = STMT_NO_MEMORY_ERROR;
+        stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	/* the binding structure for a statement is not set up until */
-
-	/*
-	 * a statement is actually executed, so we'll have to do this
-	 * ourselves.
-	 */
+    /* the binding structure for a statement is not set up until */
+    /* a statement is actually executed, so we'll have to do this ourselves. */
 	result_cols = 14;
-	extend_bindings(stmt, result_cols);
-
-	/* set the field names */
-	QR_set_num_fields(stmt->result, result_cols);
-	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 4, "DATA_TYPE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 5, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 6, "PRECISION", PG_TYPE_INT4, 4);
-	QR_set_field_info(stmt->result, 7, "LENGTH", PG_TYPE_INT4, 4);
-	QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254);
-
-	/* User defined fields */
-	QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4);
+    extend_bindings(stmt, result_cols);
+
+    /* set the field names */
+    QR_set_num_fields(stmt->result, result_cols);
+    QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 4, "DATA_TYPE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 5, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 6, "PRECISION", PG_TYPE_INT4, 4);
+    QR_set_field_info(stmt->result, 7, "LENGTH", PG_TYPE_INT4, 4);
+    QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254);
+
+    /*	User defined fields */
+    QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4);
 	QR_set_field_info(stmt->result, 13, "FIELD_TYPE", PG_TYPE_INT4, 4);
 
-
+	
 	result = SQLFetch(hcol_stmt);
 
 
-	/*
-	 * Only show oid if option AND there are other columns AND it's not
-	 * being called by SQLStatistics . Always show OID if it's a system
-	 * table
-	 */
+	/*	Only show oid if option AND there are other columns AND 
+		it's not being called by SQLStatistics .
+		Always show OID if it's a system table
+	*/
+
+	if (result != SQL_ERROR && ! stmt->internal) {
 
-	if (result != SQL_ERROR && !stmt->internal)
-	{
-		if (relhasrules[0] != '1' &&
-			(atoi(ci->show_oid_column) ||
-			 strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0))
-		{
-			/* For OID fields */
+		if (relhasrules[0] != '1' && 
+		    (atoi(ci->show_oid_column) || 
+			 strncmp(table_name, POSTGRES_SYS_PREFIX, strlen(POSTGRES_SYS_PREFIX)) == 0)) {
+
+			/*	For OID fields */
 			the_type = PG_TYPE_OID;
-			row = (TupleNode *) malloc(sizeof(TupleNode) +
-								  (result_cols - 1) *sizeof(TupleField));
+			row = (TupleNode *)malloc(sizeof(TupleNode) +
+									  (result_cols - 1) * sizeof(TupleField));
 
 			set_tuplefield_string(&row->tuple[0], "");
 			/* see note in SQLTables() */
-			/* set_tuplefield_string(&row->tuple[1], table_owner); */
+			/*      set_tuplefield_string(&row->tuple[1], table_owner); */
 			set_tuplefield_string(&row->tuple[1], "");
 			set_tuplefield_string(&row->tuple[2], table_name);
 			set_tuplefield_string(&row->tuple[3], "oid");
@@ -1708,70 +1460,67 @@ SQLColumns(
 
 			QR_add_tuple(stmt->result, row);
 		}
+
 	}
 
-	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
-	{
-		row = (TupleNode *) malloc(sizeof(TupleNode) +
-								   (result_cols - 1) *sizeof(TupleField));
+    while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
+        row = (TupleNode *)malloc(sizeof(TupleNode) +
+                                  (result_cols - 1) * sizeof(TupleField));
 
 
-		set_tuplefield_string(&row->tuple[0], "");
-		/* see note in SQLTables() */
-		/* set_tuplefield_string(&row->tuple[1], table_owner); */
-		set_tuplefield_string(&row->tuple[1], "");
-		set_tuplefield_string(&row->tuple[2], table_name);
-		set_tuplefield_string(&row->tuple[3], field_name);
-		set_tuplefield_int2(&row->tuple[4], pgtype_to_sqltype(stmt, field_type));
-		set_tuplefield_string(&row->tuple[5], field_type_name);
-
-
-		/*
-		 * Some Notes about Postgres Data Types:
-		 *
-		 * VARCHAR - the length is stored in the pg_attribute.atttypmod field
-		 * BPCHAR  - the length is also stored as varchar is
-		 *
-		 * NUMERIC - the scale is stored in atttypmod as follows: precision =
-		 * ((atttypmod - VARHDRSZ) >> 16) & 0xffff scale	 = (atttypmod
-		 * - VARHDRSZ) & 0xffff
-		 *
-		 *
-		 */
+        set_tuplefield_string(&row->tuple[0], "");
+        /* see note in SQLTables() */
+        /*      set_tuplefield_string(&row->tuple[1], table_owner); */
+        set_tuplefield_string(&row->tuple[1], "");
+        set_tuplefield_string(&row->tuple[2], table_name);
+        set_tuplefield_string(&row->tuple[3], field_name);
+        set_tuplefield_int2(&row->tuple[4], pgtype_to_sqltype(stmt, field_type));
+        set_tuplefield_string(&row->tuple[5], field_type_name);
+
+
+		/*	Some Notes about Postgres Data Types:
+
+			VARCHAR - the length is stored in the pg_attribute.atttypmod field
+			BPCHAR  - the length is also stored as varchar is
+
+			NUMERIC - the scale is stored in atttypmod as follows:
+					precision = ((atttypmod - VARHDRSZ) >> 16) & 0xffff
+					scale     = (atttypmod - VARHDRSZ) & 0xffff
+
+
+		*/
 		qlog("SQLColumns: table='%s',field_name='%s',type=%d,sqltype=%d,name='%s'\n",
-			 table_name, field_name, field_type, pgtype_to_sqltype, field_type_name);
+			table_name,field_name,field_type,pgtype_to_sqltype,field_type_name);
 
 		useStaticPrecision = TRUE;
 
-		if (field_type == PG_TYPE_NUMERIC)
-		{
+		if (field_type == PG_TYPE_NUMERIC) {
 			if (mod_length >= 4)
-				mod_length -= 4;/* the length is in atttypmod - 4 */
+				mod_length -= 4;			/* the length is in atttypmod - 4 */
 
-			if (mod_length >= 0)
-			{
+			if (mod_length >= 0) {
 				useStaticPrecision = FALSE;
 
 				precision = (mod_length >> 16) & 0xffff;
 				scale = mod_length & 0xffff;
 
-				mylog("SQLColumns: field type is NUMERIC: field_type = %d, mod_length=%d, precision=%d, scale=%d\n", field_type, mod_length, precision, scale);
+				mylog("SQLColumns: field type is NUMERIC: field_type = %d, mod_length=%d, precision=%d, scale=%d\n", field_type, mod_length, precision, scale );
 
-				set_tuplefield_int4(&row->tuple[7], precision + 2);		/* sign+dec.point */
+				set_tuplefield_int4(&row->tuple[7], precision + 2);  /* sign+dec.point */
 				set_tuplefield_int4(&row->tuple[6], precision);
-				set_tuplefield_int4(&row->tuple[12], precision + 2);	/* sign+dec.point */
+				set_tuplefield_int4(&row->tuple[12], precision + 2); /* sign+dec.point */
 				set_nullfield_int2(&row->tuple[8], scale);
 			}
 		}
 
 
-		if ((field_type == PG_TYPE_VARCHAR) ||
-			(field_type == PG_TYPE_BPCHAR))
-		{
+        if((field_type == PG_TYPE_VARCHAR) ||
+		   (field_type == PG_TYPE_BPCHAR)) {
+
 			useStaticPrecision = FALSE;
 
 			if (mod_length >= 4)
-				mod_length -= 4;/* the length is in atttypmod - 4 */
+				mod_length -= 4;			/* the length is in atttypmod - 4 */
 
 			if (mod_length > globals.max_varchar_size || mod_length <= 0)
 				mod_length = globals.max_varchar_size;
@@ -1782,46 +1531,44 @@ SQLColumns(
 			set_tuplefield_int4(&row->tuple[6], mod_length);
 			set_tuplefield_int4(&row->tuple[12], mod_length);
 			set_nullfield_int2(&row->tuple[8], pgtype_scale(stmt, field_type, PG_STATIC));
-		}
-
-		if (useStaticPrecision)
-		{
+        } 
+		
+		if (useStaticPrecision) {
 			mylog("SQLColumns: field type is OTHER: field_type = %d, pgtype_length = %d\n", field_type, pgtype_length(stmt, field_type, PG_STATIC, PG_STATIC));
 
-			set_tuplefield_int4(&row->tuple[7], pgtype_length(stmt, field_type, PG_STATIC, PG_STATIC));
+            set_tuplefield_int4(&row->tuple[7], pgtype_length(stmt, field_type, PG_STATIC, PG_STATIC));
 			set_tuplefield_int4(&row->tuple[6], pgtype_precision(stmt, field_type, PG_STATIC, PG_STATIC));
 			set_tuplefield_int4(&row->tuple[12], pgtype_display_size(stmt, field_type, PG_STATIC, PG_STATIC));
 			set_nullfield_int2(&row->tuple[8], pgtype_scale(stmt, field_type, PG_STATIC));
-		}
+        }
 
 		set_nullfield_int2(&row->tuple[9], pgtype_radix(stmt, field_type));
 		set_tuplefield_int2(&row->tuple[10], (Int2) (not_null[0] == '1' ? SQL_NO_NULLS : pgtype_nullable(stmt, field_type)));
 		set_tuplefield_string(&row->tuple[11], "");
 		set_tuplefield_int4(&row->tuple[13], field_type);
 
-		QR_add_tuple(stmt->result, row);
+        QR_add_tuple(stmt->result, row);
 
 
-		result = SQLFetch(hcol_stmt);
-	}
-	if (result != SQL_NO_DATA_FOUND)
-	{
+        result = SQLFetch(hcol_stmt);
+
+    }
+    if(result != SQL_NO_DATA_FOUND) {
 		stmt->errormsg = SC_create_errormsg(hcol_stmt);
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	/* Put the row version column at the end so it might not be */
-	/* mistaken for a key field. */
-	if (relhasrules[0] != '1' && !stmt->internal && atoi(ci->row_versioning))
-	{
-		/* For Row Versioning fields */
+	/*	Put the row version column at the end so it might not be */
+	/*	mistaken for a key field. */
+	if ( relhasrules[0] != '1' && ! stmt->internal && atoi(ci->row_versioning)) {
+		/*	For Row Versioning fields */
 		the_type = PG_TYPE_INT4;
 
-		row = (TupleNode *) malloc(sizeof(TupleNode) +
-								   (result_cols - 1) *sizeof(TupleField));
+		row = (TupleNode *)malloc(sizeof(TupleNode) +
+								  (result_cols - 1) * sizeof(TupleField));
 
 		set_tuplefield_string(&row->tuple[0], "");
 		set_tuplefield_string(&row->tuple[1], "");
@@ -1843,122 +1590,115 @@ SQLColumns(
 
 	/* also, things need to think that this statement is finished so */
 	/* the results can be retrieved. */
-	stmt->status = STMT_FINISHED;
+    stmt->status = STMT_FINISHED;
 
-	/* set up the current tuple pointer for SQLFetch */
-	stmt->currTuple = -1;
+    /* set up the current tuple pointer for SQLFetch */
+    stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 	SQLFreeStmt(hcol_stmt, SQL_DROP);
 	mylog("SQLColumns(): EXIT,  stmt=%u\n", stmt);
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
-RETCODE SQL_API
-SQLSpecialColumns(
-				  HSTMT hstmt,
-				  UWORD fColType,
-				  UCHAR FAR *szTableQualifier,
-				  SWORD cbTableQualifier,
-				  UCHAR FAR *szTableOwner,
-				  SWORD cbTableOwner,
-				  UCHAR FAR *szTableName,
-				  SWORD cbTableName,
-				  UWORD fScope,
-				  UWORD fNullable)
+RETCODE SQL_API SQLSpecialColumns(
+                                  HSTMT        hstmt,
+                                  UWORD        fColType,
+                                  UCHAR FAR *  szTableQualifier,
+                                  SWORD        cbTableQualifier,
+                                  UCHAR FAR *  szTableOwner,
+                                  SWORD        cbTableOwner,
+                                  UCHAR FAR *  szTableName,
+                                  SWORD        cbTableName,
+                                  UWORD        fScope,
+                                  UWORD        fNullable)
 {
-	static char *func = "SQLSpecialColumns";
-	TupleNode  *row;
-	StatementClass *stmt = (StatementClass *) hstmt;
-	ConnInfo   *ci;
-	HSTMT		hcol_stmt;
-	StatementClass *col_stmt;
-	char		columns_query[STD_STATEMENT_LEN];
-	RETCODE		result;
-	char		relhasrules[MAX_INFO_STRING];
+static char *func = "SQLSpecialColumns";
+TupleNode *row;
+StatementClass *stmt = (StatementClass *) hstmt;
+ConnInfo *ci;
+HSTMT hcol_stmt;
+StatementClass *col_stmt;
+char columns_query[STD_STATEMENT_LEN];
+RETCODE result;
+char relhasrules[MAX_INFO_STRING];
 
 
 
-	mylog("%s: entering...stmt=%u\n", func, stmt);
+mylog("%s: entering...stmt=%u\n", func, stmt);
 
-	if (!stmt)
-	{
+    if( ! stmt) {
 		SC_log_error(func, "", NULL);
-		return SQL_INVALID_HANDLE;
-	}
+        return SQL_INVALID_HANDLE;
+    }
 	ci = &stmt->hdbc->connInfo;
 
 	stmt->manual_result = TRUE;
 
 
 	/* ********************************************************************** */
-	/* Create the query to find out if this is a view or not... */
+	/*	Create the query to find out if this is a view or not... */
 	/* ********************************************************************** */
 	sprintf(columns_query, "select c.relhasrules "
-			"from pg_user u, pg_class c where "
-			"u.usesysid = c.relowner");
+		"from pg_user u, pg_class c where "
+		"u.usesysid = c.relowner");
 
 	my_strcat(columns_query, " and c.relname like '%.*s'", szTableName, cbTableName);
 	my_strcat(columns_query, " and u.usename like '%.*s'", szTableOwner, cbTableOwner);
 
 
-	result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLSpecialColumns result.";
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 	col_stmt = (StatementClass *) hcol_stmt;
 
 	mylog("SQLSpecialColumns: hcol_stmt = %u, col_stmt = %u\n", hcol_stmt, col_stmt);
 
-	result = SQLExecDirect(hcol_stmt, columns_query,
-						   strlen(columns_query));
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLExecDirect(hcol_stmt, columns_query,
+                           strlen(columns_query));
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = SC_create_errormsg(hcol_stmt);
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
-						relhasrules, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(hcol_stmt, 1, SQL_C_CHAR,
+                        relhasrules, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
 	result = SQLFetch(hcol_stmt);
 	SQLFreeStmt(hcol_stmt, SQL_DROP);
 
-	stmt->result = QR_Constructor();
-	extend_bindings(stmt, 8);
-
-	QR_set_num_fields(stmt->result, 8);
-	QR_set_field_info(stmt->result, 0, "SCOPE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 1, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 2, "DATA_TYPE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 3, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 4, "PRECISION", PG_TYPE_INT4, 4);
-	QR_set_field_info(stmt->result, 5, "LENGTH", PG_TYPE_INT4, 4);
-	QR_set_field_info(stmt->result, 6, "SCALE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 7, "PSEUDO_COLUMN", PG_TYPE_INT2, 2);
-
-	if (relhasrules[0] != '1')
-	{
+    stmt->result = QR_Constructor();
+    extend_bindings(stmt, 8);
+
+    QR_set_num_fields(stmt->result, 8);
+    QR_set_field_info(stmt->result, 0, "SCOPE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 1, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 2, "DATA_TYPE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 3, "TYPE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 4, "PRECISION", PG_TYPE_INT4, 4);
+    QR_set_field_info(stmt->result, 5, "LENGTH", PG_TYPE_INT4, 4);
+    QR_set_field_info(stmt->result, 6, "SCALE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 7, "PSEUDO_COLUMN", PG_TYPE_INT2, 2);
+
+    if ( relhasrules[0] != '1' ) {
 		/* use the oid value for the rowid */
-		if (fColType == SQL_BEST_ROWID)
-		{
-			row = (TupleNode *) malloc(sizeof(TupleNode) + (8 - 1) *sizeof(TupleField));
+		if(fColType == SQL_BEST_ROWID) {
+			row = (TupleNode *)malloc(sizeof(TupleNode) + (8 - 1) * sizeof(TupleField));
 
 			set_tuplefield_int2(&row->tuple[0], SQL_SCOPE_SESSION);
 			set_tuplefield_string(&row->tuple[1], "oid");
@@ -1970,14 +1710,13 @@ SQLSpecialColumns(
 			set_tuplefield_int2(&row->tuple[7], SQL_PC_PSEUDO);
 
 			QR_add_tuple(stmt->result, row);
-		}
-		else if (fColType == SQL_ROWVER)
-		{
-			Int2		the_type = PG_TYPE_INT4;
 
-			if (atoi(ci->row_versioning))
-			{
-				row = (TupleNode *) malloc(sizeof(TupleNode) + (8 - 1) *sizeof(TupleField));
+		} else if(fColType == SQL_ROWVER) {
+
+			Int2 the_type = PG_TYPE_INT4;
+
+			if (atoi(ci->row_versioning)) {
+				row = (TupleNode *)malloc(sizeof(TupleNode) + (8 - 1) * sizeof(TupleField));
 
 				set_tuplefield_null(&row->tuple[0]);
 				set_tuplefield_string(&row->tuple[1], "xmin");
@@ -1995,116 +1734,103 @@ SQLSpecialColumns(
 
 
 
-	stmt->status = STMT_FINISHED;
-	stmt->currTuple = -1;
+    stmt->status = STMT_FINISHED;
+    stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 	mylog("SQLSpecialColumns(): EXIT,  stmt=%u\n", stmt);
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
-RETCODE SQL_API
-SQLStatistics(
-			  HSTMT hstmt,
-			  UCHAR FAR *szTableQualifier,
-			  SWORD cbTableQualifier,
-			  UCHAR FAR *szTableOwner,
-			  SWORD cbTableOwner,
-			  UCHAR FAR *szTableName,
-			  SWORD cbTableName,
-			  UWORD fUnique,
-			  UWORD fAccuracy)
+RETCODE SQL_API SQLStatistics(
+                              HSTMT         hstmt,
+                              UCHAR FAR *   szTableQualifier,
+                              SWORD         cbTableQualifier,
+                              UCHAR FAR *   szTableOwner,
+                              SWORD         cbTableOwner,
+                              UCHAR FAR *   szTableName,
+                              SWORD         cbTableName,
+                              UWORD         fUnique,
+                              UWORD         fAccuracy)
 {
-	static char *func = "SQLStatistics";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	char		index_query[STD_STATEMENT_LEN];
-	HSTMT		hindx_stmt;
-	RETCODE		result;
-	char	   *table_name;
-	char		index_name[MAX_INFO_STRING];
-	short		fields_vector[8];
-	char		isunique[10],
-				isclustered[10];
-	SDWORD		index_name_len,
-				fields_vector_len;
-	TupleNode  *row;
-	int			i;
-	HSTMT		hcol_stmt;
-	StatementClass *col_stmt,
-			   *indx_stmt;
-	char		column_name[MAX_INFO_STRING],
-				relhasrules[MAX_INFO_STRING];
-	char	  **column_names = 0;
-	Int4		column_name_len;
-	int			total_columns = 0;
-	char		error = TRUE;
-	ConnInfo   *ci;
-	char		buf[256];
-
-	mylog("%s: entering...stmt=%u\n", func, stmt);
-
-	if (!stmt)
-	{
+static char *func="SQLStatistics";
+StatementClass *stmt = (StatementClass *) hstmt;
+char index_query[STD_STATEMENT_LEN];
+HSTMT hindx_stmt;
+RETCODE result;
+char *table_name;
+char index_name[MAX_INFO_STRING];
+short fields_vector[8];
+char isunique[10], isclustered[10];
+SDWORD index_name_len, fields_vector_len;
+TupleNode *row;
+int i;
+HSTMT hcol_stmt;
+StatementClass *col_stmt, *indx_stmt;
+char column_name[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
+char **column_names = 0;
+Int4 column_name_len;
+int total_columns = 0;
+char error = TRUE;
+ConnInfo *ci;
+char buf[256];
+
+mylog("%s: entering...stmt=%u\n", func, stmt);
+
+    if( ! stmt) {
 		SC_log_error(func, "", NULL);
-		return SQL_INVALID_HANDLE;
-	}
+        return SQL_INVALID_HANDLE;
+    }
 
 	stmt->manual_result = TRUE;
 	stmt->errormsg_created = TRUE;
 
 	ci = &stmt->hdbc->connInfo;
 
-	stmt->result = QR_Constructor();
-	if (!stmt->result)
-	{
-		stmt->errormsg = "Couldn't allocate memory for SQLStatistics result.";
-		stmt->errornumber = STMT_NO_MEMORY_ERROR;
+    stmt->result = QR_Constructor();
+    if(!stmt->result) {
+        stmt->errormsg = "Couldn't allocate memory for SQLStatistics result.";
+        stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
-
-	/* the binding structure for a statement is not set up until */
-
-	/*
-	 * a statement is actually executed, so we'll have to do this
-	 * ourselves.
-	 */
-	extend_bindings(stmt, 13);
-
-	/* set the field names */
-	QR_set_num_fields(stmt->result, 13);
-	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 3, "NON_UNIQUE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 4, "INDEX_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 5, "INDEX_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 6, "TYPE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 7, "SEQ_IN_INDEX", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 8, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 9, "COLLATION", PG_TYPE_CHAR, 1);
-	QR_set_field_info(stmt->result, 10, "CARDINALITY", PG_TYPE_INT4, 4);
-	QR_set_field_info(stmt->result, 11, "PAGES", PG_TYPE_INT4, 4);
-	QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING);
-
-
-	/* only use the table name... the owner should be redundant, and */
-	/* we never use qualifiers. */
+        return SQL_ERROR;
+    }
+
+    /* the binding structure for a statement is not set up until */
+    /* a statement is actually executed, so we'll have to do this ourselves. */
+    extend_bindings(stmt, 13);
+
+    /* set the field names */
+    QR_set_num_fields(stmt->result, 13);
+    QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 3, "NON_UNIQUE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 4, "INDEX_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 5, "INDEX_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 6, "TYPE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 7, "SEQ_IN_INDEX", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 8, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 9, "COLLATION", PG_TYPE_CHAR, 1);
+    QR_set_field_info(stmt->result, 10, "CARDINALITY", PG_TYPE_INT4, 4);
+    QR_set_field_info(stmt->result, 11, "PAGES", PG_TYPE_INT4, 4);
+    QR_set_field_info(stmt->result, 12, "FILTER_CONDITION", PG_TYPE_TEXT, MAX_INFO_STRING);
+
+
+    /* only use the table name... the owner should be redundant, and */
+    /* we never use qualifiers. */
 	table_name = make_string(szTableName, cbTableName, NULL);
-	if (!table_name)
-	{
-		stmt->errormsg = "No table name passed to SQLStatistics.";
-		stmt->errornumber = STMT_INTERNAL_ERROR;
+	if ( ! table_name) {
+        stmt->errormsg = "No table name passed to SQLStatistics.";
+        stmt->errornumber = STMT_INTERNAL_ERROR;
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
 	/* we need to get a list of the field names first, */
 	/* so we can return them later. */
-	result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+	result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for columns.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		goto SEEYA;
@@ -2112,69 +1838,63 @@ SQLStatistics(
 
 	col_stmt = (StatementClass *) hcol_stmt;
 
-	/*
-	 * "internal" prevents SQLColumns from returning the oid if it is
-	 * being shown. This would throw everything off.
-	 */
+	/*	"internal" prevents SQLColumns from returning the oid if it is being shown.
+		This would throw everything off.
+	*/
 	col_stmt->internal = TRUE;
-	result = SQLColumns(hcol_stmt, "", 0, "", 0,
-						table_name, (SWORD) strlen(table_name), "", 0);
+	result = SQLColumns(hcol_stmt, "", 0, "", 0, 
+				table_name, (SWORD) strlen(table_name), "", 0);
 	col_stmt->internal = FALSE;
 
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
-		stmt->errormsg = col_stmt->errormsg;	/* "SQLColumns failed in
-												 * SQLStatistics."; */
-		stmt->errornumber = col_stmt->errornumber;		/* STMT_EXEC_ERROR; */
-		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		goto SEEYA;
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+			stmt->errormsg = col_stmt->errormsg;        /* "SQLColumns failed in SQLStatistics."; */
+			stmt->errornumber = col_stmt->errornumber;  /* STMT_EXEC_ERROR; */
+			SQLFreeStmt(hcol_stmt, SQL_DROP);
+			goto SEEYA;
 	}
 	result = SQLBindCol(hcol_stmt, 4, SQL_C_CHAR,
-						column_name, MAX_INFO_STRING, &column_name_len);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+				column_name, MAX_INFO_STRING, &column_name_len);
+	if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = col_stmt->errormsg;
 		stmt->errornumber = col_stmt->errornumber;
 		SQLFreeStmt(hcol_stmt, SQL_DROP);
 		goto SEEYA;
+
 	}
 
 	result = SQLFetch(hcol_stmt);
-	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
-	{
+	while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
 		total_columns++;
 
-		column_names =
-			(char **) realloc(column_names,
-							  total_columns * sizeof(char *));
-		column_names[total_columns - 1] =
-			(char *) malloc(strlen(column_name) + 1);
-		strcpy(column_names[total_columns - 1], column_name);
+		column_names = 
+		(char **)realloc(column_names, 
+				 total_columns * sizeof(char *));
+		column_names[total_columns-1] = 
+		(char *)malloc(strlen(column_name)+1);
+		strcpy(column_names[total_columns-1], column_name);
 
 		mylog("SQLStatistics: column_name = '%s'\n", column_name);
 
 		result = SQLFetch(hcol_stmt);
 	}
-	if (result != SQL_NO_DATA_FOUND || total_columns == 0)
-	{
-		stmt->errormsg = SC_create_errormsg(hcol_stmt); /* "Couldn't get column
-														 * names in
-														 * SQLStatistics."; */
-		stmt->errornumber = col_stmt->errornumber;
-		SQLFreeStmt(hcol_stmt, SQL_DROP);
-		goto SEEYA;
-	}
+	if(result != SQL_NO_DATA_FOUND || total_columns == 0) {
+			stmt->errormsg = SC_create_errormsg(hcol_stmt); /* "Couldn't get column names in SQLStatistics."; */
+			stmt->errornumber = col_stmt->errornumber;
+			SQLFreeStmt(hcol_stmt, SQL_DROP);
+   			goto SEEYA;
 
+	}
+	
 	SQLFreeStmt(hcol_stmt, SQL_DROP);
 
 	/* get a list of indexes on this table */
-	result = SQLAllocStmt(stmt->hdbc, &hindx_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLAllocStmt( stmt->hdbc, &hindx_stmt);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = "SQLAllocStmt failed in SQLStatistics for indices.";
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		goto SEEYA;
-	}
+
+    }
 	indx_stmt = (StatementClass *) hindx_stmt;
 
 	sprintf(index_query, "select c.relname, i.indkey, i.indisunique"
@@ -2183,79 +1903,69 @@ SQLStatistics(
 			" where c.oid = i.indexrelid and d.relname = '%s'"
 			" and d.oid = i.indrelid", table_name);
 
-	result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
-		stmt->errormsg = SC_create_errormsg(hindx_stmt);		/* "Couldn't execute
-																 * index query
-																 * (w/SQLExecDirect) in
-																 * SQLStatistics."; */
+    result = SQLExecDirect(hindx_stmt, index_query, strlen(index_query));
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		stmt->errormsg = SC_create_errormsg(hindx_stmt); /* "Couldn't execute index query (w/SQLExecDirect) in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
-		goto SEEYA;
-	}
+  		goto SEEYA;
 
-	/* bind the index name column */
-	result = SQLBindCol(hindx_stmt, 1, SQL_C_CHAR,
-						index_name, MAX_INFO_STRING, &index_name_len);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
-		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
-												 * in SQLStatistics."; */
+    }
+
+    /* bind the index name column */
+    result = SQLBindCol(hindx_stmt, 1, SQL_C_CHAR,
+                        index_name, MAX_INFO_STRING, &index_name_len);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		stmt->errormsg = indx_stmt->errormsg; /* "Couldn't bind column in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
-		goto SEEYA;
-	}
-	/* bind the vector column */
-	result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT,
-						fields_vector, 16, &fields_vector_len);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
-		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
-												 * in SQLStatistics."; */
+   		goto SEEYA;
+
+    }
+    /* bind the vector column */
+    result = SQLBindCol(hindx_stmt, 2, SQL_C_DEFAULT,
+                        fields_vector, 16, &fields_vector_len);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		stmt->errormsg = indx_stmt->errormsg;  /* "Couldn't bind column in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
-	}
-	/* bind the "is unique" column */
-	result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR,
-						isunique, sizeof(isunique), NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
-		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
-												 * in SQLStatistics."; */
+
+    }
+    /* bind the "is unique" column */
+    result = SQLBindCol(hindx_stmt, 3, SQL_C_CHAR,
+                        isunique, sizeof(isunique), NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		stmt->errormsg = indx_stmt->errormsg;  /* "Couldn't bind column in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
-	}
+    }
 
-	/* bind the "is clustered" column */
-	result = SQLBindCol(hindx_stmt, 4, SQL_C_CHAR,
-						isclustered, sizeof(isclustered), NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
-		stmt->errormsg = indx_stmt->errormsg;	/* "Couldn't bind column
-												 * in SQLStatistics."; */
+    /* bind the "is clustered" column */
+    result = SQLBindCol(hindx_stmt, 4, SQL_C_CHAR,
+                        isclustered, sizeof(isclustered), NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
+		stmt->errormsg = indx_stmt->errormsg;  /* "Couldn't bind column in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
-	}
 
-	result = SQLBindCol(hindx_stmt, 5, SQL_C_CHAR,
-						relhasrules, MAX_INFO_STRING, NULL);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    }
+
+    result = SQLBindCol(hindx_stmt, 5, SQL_C_CHAR,
+                        relhasrules, MAX_INFO_STRING, NULL);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = indx_stmt->errormsg;
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
-		goto SEEYA;
-	}
+        goto SEEYA;
+    }
 
-	/* fake index of OID */
-	if (relhasrules[0] != '1' && atoi(ci->show_oid_column) && atoi(ci->fake_oid_index))
-	{
-		row = (TupleNode *) malloc(sizeof(TupleNode) +
-								   (13 - 1) *sizeof(TupleField));
+	/*	fake index of OID */
+	if ( relhasrules[0] != '1' && atoi(ci->show_oid_column) && atoi(ci->fake_oid_index)) {
+		row = (TupleNode *)malloc(sizeof(TupleNode) + 
+					  (13 - 1) * sizeof(TupleField));
 
 		/* no table qualifier */
 		set_tuplefield_string(&row->tuple[0], "");
@@ -2265,17 +1975,14 @@ SQLStatistics(
 
 		/* non-unique index? */
 		set_tuplefield_int2(&row->tuple[3], (Int2) (globals.unique_index ? FALSE : TRUE));
-
+		
 		/* no index qualifier */
 		set_tuplefield_string(&row->tuple[4], "");
 
 		sprintf(buf, "%s_idx_fake_oid", table_name);
 		set_tuplefield_string(&row->tuple[5], buf);
 
-		/*
-		 * Clustered index?  I think non-clustered should be type OTHER
-		 * not HASHED
-		 */
+		/* Clustered index?  I think non-clustered should be type OTHER not HASHED */
 		set_tuplefield_int2(&row->tuple[6], (Int2) SQL_INDEX_OTHER);
 		set_tuplefield_int2(&row->tuple[7], (Int2) 1);
 
@@ -2288,19 +1995,18 @@ SQLStatistics(
 		QR_add_tuple(stmt->result, row);
 	}
 
-	result = SQLFetch(hindx_stmt);
-	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
-	{
-		/* If only requesting unique indexs, then just return those. */
-		if (fUnique == SQL_INDEX_ALL ||
-			(fUnique == SQL_INDEX_UNIQUE && atoi(isunique)))
-		{
+    result = SQLFetch(hindx_stmt);
+    while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
+
+      /*	If only requesting unique indexs, then just return those. */
+		if (fUnique == SQL_INDEX_ALL || 
+			(fUnique == SQL_INDEX_UNIQUE && atoi(isunique))) {
 			i = 0;
 			/* add a row in this table for each field in the index */
-			while (i < 8 && fields_vector[i] != 0)
-			{
-				row = (TupleNode *) malloc(sizeof(TupleNode) +
-										   (13 - 1) *sizeof(TupleField));
+			while(i < 8 && fields_vector[i] != 0) {
+
+				row = (TupleNode *)malloc(sizeof(TupleNode) + 
+							  (13 - 1) * sizeof(TupleField));
 
 				/* no table qualifier */
 				set_tuplefield_string(&row->tuple[0], "");
@@ -2313,32 +2019,26 @@ SQLStatistics(
 					set_tuplefield_int2(&row->tuple[3], (Int2) (atoi(isunique) ? FALSE : TRUE));
 				else
 					set_tuplefield_int2(&row->tuple[3], TRUE);
-
+				
 				/* no index qualifier */
 				set_tuplefield_string(&row->tuple[4], "");
 				set_tuplefield_string(&row->tuple[5], index_name);
 
-				/*
-				 * Clustered index?  I think non-clustered should be type
-				 * OTHER not HASHED
-				 */
+				/* Clustered index?  I think non-clustered should be type OTHER not HASHED */
 				set_tuplefield_int2(&row->tuple[6], (Int2) (atoi(isclustered) ? SQL_INDEX_CLUSTERED : SQL_INDEX_OTHER));
-				set_tuplefield_int2(&row->tuple[7], (Int2) (i + 1));
+				set_tuplefield_int2(&row->tuple[7], (Int2) (i+1));
 
-				if (fields_vector[i] == OID_ATTNUM)
-				{
+				if(fields_vector[i] == OID_ATTNUM) {
 					set_tuplefield_string(&row->tuple[8], "oid");
 					mylog("SQLStatistics: column name = oid\n");
 				}
-				else if (fields_vector[i] < 0 || fields_vector[i] > total_columns)
-				{
+				else if(fields_vector[i] < 0 || fields_vector[i] > total_columns) {
 					set_tuplefield_string(&row->tuple[8], "UNKNOWN");
 					mylog("SQLStatistics: column name = UNKNOWN\n");
 				}
-				else
-				{
-					set_tuplefield_string(&row->tuple[8], column_names[fields_vector[i] - 1]);
-					mylog("SQLStatistics: column name = '%s'\n", column_names[fields_vector[i] - 1]);
+				else {
+					set_tuplefield_string(&row->tuple[8], column_names[fields_vector[i]-1]);
+					mylog("SQLStatistics: column name = '%s'\n", column_names[fields_vector[i]-1]);
 				}
 
 				set_tuplefield_string(&row->tuple[9], "A");
@@ -2351,25 +2051,23 @@ SQLStatistics(
 			}
 		}
 
-		result = SQLFetch(hindx_stmt);
-	}
-	if (result != SQL_NO_DATA_FOUND)
-	{
-		stmt->errormsg = SC_create_errormsg(hindx_stmt);		/* "SQLFetch failed in
-																 * SQLStatistics."; */
+        result = SQLFetch(hindx_stmt);
+    }
+    if(result != SQL_NO_DATA_FOUND) {
+		stmt->errormsg = SC_create_errormsg(hindx_stmt); /* "SQLFetch failed in SQLStatistics."; */
 		stmt->errornumber = indx_stmt->errornumber;
 		SQLFreeStmt(hindx_stmt, SQL_DROP);
 		goto SEEYA;
-	}
+    }
 
 	SQLFreeStmt(hindx_stmt, SQL_DROP);
 
 	/* also, things need to think that this statement is finished so */
 	/* the results can be retrieved. */
-	stmt->status = STMT_FINISHED;
+    stmt->status = STMT_FINISHED;
 
-	/* set up the current tuple pointer for SQLFetch */
-	stmt->currTuple = -1;
+    /* set up the current tuple pointer for SQLFetch */
+    stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
@@ -2378,14 +2076,14 @@ SQLStatistics(
 SEEYA:
 	/* These things should be freed on any error ALSO! */
 	free(table_name);
-	for (i = 0; i < total_columns; i++)
+    for(i = 0; i < total_columns; i++) {
 		free(column_names[i]);
-	free(column_names);
+    }
+    free(column_names);
 
 	mylog("SQLStatistics(): EXIT, %s, stmt=%u\n", error ? "error" : "success", stmt);
 
-	if (error)
-	{
+	if (error) {
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
@@ -2393,109 +2091,99 @@ SEEYA:
 		return SQL_SUCCESS;
 }
 
-RETCODE SQL_API
-SQLColumnPrivileges(
-					HSTMT hstmt,
-					UCHAR FAR *szTableQualifier,
-					SWORD cbTableQualifier,
-					UCHAR FAR *szTableOwner,
-					SWORD cbTableOwner,
-					UCHAR FAR *szTableName,
-					SWORD cbTableName,
-					UCHAR FAR *szColumnName,
-					SWORD cbColumnName)
+RETCODE SQL_API SQLColumnPrivileges(
+                                    HSTMT        hstmt,
+                                    UCHAR FAR *  szTableQualifier,
+                                    SWORD        cbTableQualifier,
+                                    UCHAR FAR *  szTableOwner,
+                                    SWORD        cbTableOwner,
+                                    UCHAR FAR *  szTableName,
+                                    SWORD        cbTableName,
+                                    UCHAR FAR *  szColumnName,
+                                    SWORD        cbColumnName)
 {
-	static char *func = "SQLColumnPrivileges";
+static char *func="SQLColumnPrivileges";
 
 	mylog("%s: entering...\n", func);
 
 /*	Neither Access or Borland care about this. */
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-	return SQL_ERROR;
+    return SQL_ERROR;
 }
 
 
 /* SQLPrimaryKeys()
  * Retrieve the primary key columns for the specified table.
  */
-RETCODE SQL_API
-SQLPrimaryKeys(
-			   HSTMT hstmt,
-			   UCHAR FAR *szTableQualifier,
-			   SWORD cbTableQualifier,
-			   UCHAR FAR *szTableOwner,
-			   SWORD cbTableOwner,
-			   UCHAR FAR *szTableName,
-			   SWORD cbTableName)
+RETCODE SQL_API SQLPrimaryKeys(
+                               HSTMT         hstmt,
+                               UCHAR FAR *   szTableQualifier,
+                               SWORD         cbTableQualifier,
+                               UCHAR FAR *   szTableOwner,
+                               SWORD         cbTableOwner,
+                               UCHAR FAR *   szTableName,
+                               SWORD         cbTableName)
 {
-	static char *func = "SQLPrimaryKeys";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	TupleNode  *row;
-	RETCODE		result;
-	int			seq = 0;
-	HSTMT		htbl_stmt;
-	StatementClass *tbl_stmt;
-	char		tables_query[STD_STATEMENT_LEN];
-	char		attname[MAX_INFO_STRING];
-	SDWORD		attname_len;
-	char		pktab[MAX_TABLE_LEN + 1];
-	Int2		result_cols;
+static char *func = "SQLPrimaryKeys";
+StatementClass *stmt = (StatementClass *) hstmt;
+TupleNode *row;
+RETCODE result;
+int seq = 0;
+HSTMT htbl_stmt;
+StatementClass *tbl_stmt;
+char tables_query[STD_STATEMENT_LEN];
+char attname[MAX_INFO_STRING];
+SDWORD attname_len;
+char pktab[MAX_TABLE_LEN + 1];
+Int2 result_cols;
 
 	mylog("%s: entering...stmt=%u\n", func, stmt);
 
-	if (!stmt)
-	{
+    if( ! stmt) {
 		SC_log_error(func, "", NULL);
-		return SQL_INVALID_HANDLE;
-	}
+        return SQL_INVALID_HANDLE;
+    }
 	stmt->manual_result = TRUE;
 	stmt->errormsg_created = TRUE;
 
-	stmt->result = QR_Constructor();
-	if (!stmt->result)
-	{
-		stmt->errormsg = "Couldn't allocate memory for SQLPrimaryKeys result.";
-		stmt->errornumber = STMT_NO_MEMORY_ERROR;
+    stmt->result = QR_Constructor();
+    if(!stmt->result) {
+        stmt->errormsg = "Couldn't allocate memory for SQLPrimaryKeys result.";
+        stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
-
-	/* the binding structure for a statement is not set up until */
+        return SQL_ERROR;
+    }
 
-	/*
-	 * a statement is actually executed, so we'll have to do this
-	 * ourselves.
-	 */
+    /* the binding structure for a statement is not set up until */
+    /* a statement is actually executed, so we'll have to do this ourselves. */
 	result_cols = 6;
-	extend_bindings(stmt, result_cols);
-
-	/* set the field names */
-	QR_set_num_fields(stmt->result, result_cols);
-	QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 4, "KEY_SEQ", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 5, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-
-
-	result = SQLAllocStmt(stmt->hdbc, &htbl_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    extend_bindings(stmt, result_cols);
+	
+    /* set the field names */
+    QR_set_num_fields(stmt->result, result_cols);
+    QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 2, "TABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 3, "COLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 4, "KEY_SEQ", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 5, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+
+
+    result = SQLAllocStmt( stmt->hdbc, &htbl_stmt);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for Primary Key result.";
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 	tbl_stmt = (StatementClass *) htbl_stmt;
 
 	pktab[0] = '\0';
 	make_string(szTableName, cbTableName, pktab);
-	if (pktab[0] == '\0')
-	{
+	if ( pktab[0] == '\0') {
 		stmt->errormsg = "No Table specified to SQLPrimaryKeys.";
-		stmt->errornumber = STMT_INTERNAL_ERROR;
+	    stmt->errornumber = STMT_INTERNAL_ERROR;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
 		return SQL_ERROR;
@@ -2504,13 +2192,12 @@ SQLPrimaryKeys(
 #if 0
 	sprintf(tables_query, "select distinct on (attnum) a2.attname, a2.attnum from pg_attribute a1, pg_attribute a2, pg_class c, pg_index i where c.relname = '%s_pkey' AND c.oid = i.indexrelid AND a1.attrelid = c.oid AND a2.attrelid = c.oid AND (i.indkey[0] = a1.attnum OR i.indkey[1] = a1.attnum OR i.indkey[2] = a1.attnum OR i.indkey[3] = a1.attnum OR i.indkey[4] = a1.attnum OR i.indkey[5] = a1.attnum OR i.indkey[6] = a1.attnum OR i.indkey[7] = a1.attnum) order by a2.attnum", pktab);
 #else
-
-	/*
-	 * Simplified query to remove assumptions about number of possible
-	 * index columns. Courtesy of Tom Lane - thomas 2000-03-21
+	/* Simplified query to remove assumptions about
+	 * number of possible index columns.
+	 * Courtesy of Tom Lane - thomas 2000-03-21
 	 */
 	sprintf(tables_query, "select ta.attname, ia.attnum"
-		 " from pg_attribute ta, pg_attribute ia, pg_class c, pg_index i"
+			" from pg_attribute ta, pg_attribute ia, pg_class c, pg_index i"
 			" where c.relname = '%s_pkey'"
 			" AND c.oid = i.indexrelid"
 			" AND ia.attrelid = i.indexrelid"
@@ -2522,199 +2209,174 @@ SQLPrimaryKeys(
 
 	mylog("SQLPrimaryKeys: tables_query='%s'\n", tables_query);
 
-	result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
-						attname, MAX_INFO_STRING, &attname_len);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLBindCol(htbl_stmt, 1, SQL_C_CHAR,
+                        attname, MAX_INFO_STRING, &attname_len);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errormsg = tbl_stmt->errormsg;
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	result = SQLFetch(htbl_stmt);
+    result = SQLFetch(htbl_stmt);
+
+    while((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO)) {
 
-	while ((result == SQL_SUCCESS) || (result == SQL_SUCCESS_WITH_INFO))
-	{
-		row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
+        row = (TupleNode *)malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
 
-		set_tuplefield_null(&row->tuple[0]);
+        set_tuplefield_null(&row->tuple[0]);
 
-		/*
-		 * I have to hide the table owner from Access, otherwise it
-		 * insists on referring to the table as 'owner.table'. (this is
-		 * valid according to the ODBC SQL grammar, but Postgres won't
-		 * support it.)
+		/* I have to hide the table owner from Access, otherwise it
+		 * insists on referring to the table as 'owner.table'.
+		 * (this is valid according to the ODBC SQL grammar, but
+		 * Postgres won't support it.)
 		 */
-		set_tuplefield_string(&row->tuple[1], "");
-		set_tuplefield_string(&row->tuple[2], pktab);
-		set_tuplefield_string(&row->tuple[3], attname);
+        set_tuplefield_string(&row->tuple[1], "");
+        set_tuplefield_string(&row->tuple[2], pktab);
+        set_tuplefield_string(&row->tuple[3], attname);
 		set_tuplefield_int2(&row->tuple[4], (Int2) (++seq));
 		set_tuplefield_null(&row->tuple[5]);
 
-		QR_add_tuple(stmt->result, row);
+        QR_add_tuple(stmt->result, row);
 
 		mylog(">> primaryKeys: pktab = '%s', attname = '%s', seq = %d\n", pktab, attname, seq);
 
-		result = SQLFetch(htbl_stmt);
-	}
+        result = SQLFetch(htbl_stmt);
+    }
 
-	if (result != SQL_NO_DATA_FOUND)
-	{
+    if(result != SQL_NO_DATA_FOUND) {
 		stmt->errormsg = SC_create_errormsg(htbl_stmt);
 		stmt->errornumber = tbl_stmt->errornumber;
 		SC_log_error(func, "", stmt);
 		SQLFreeStmt(htbl_stmt, SQL_DROP);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
 	SQLFreeStmt(htbl_stmt, SQL_DROP);
 
 
 	/* also, things need to think that this statement is finished so */
 	/* the results can be retrieved. */
-	stmt->status = STMT_FINISHED;
+    stmt->status = STMT_FINISHED;
 
-	/* set up the current tuple pointer for SQLFetch */
-	stmt->currTuple = -1;
+    /* set up the current tuple pointer for SQLFetch */
+    stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 	mylog("SQLPrimaryKeys(): EXIT, stmt=%u\n", stmt);
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
-RETCODE SQL_API
-SQLForeignKeys(
-			   HSTMT hstmt,
-			   UCHAR FAR *szPkTableQualifier,
-			   SWORD cbPkTableQualifier,
-			   UCHAR FAR *szPkTableOwner,
-			   SWORD cbPkTableOwner,
-			   UCHAR FAR *szPkTableName,
-			   SWORD cbPkTableName,
-			   UCHAR FAR *szFkTableQualifier,
-			   SWORD cbFkTableQualifier,
-			   UCHAR FAR *szFkTableOwner,
-			   SWORD cbFkTableOwner,
-			   UCHAR FAR *szFkTableName,
-			   SWORD cbFkTableName)
+RETCODE SQL_API SQLForeignKeys(
+                               HSTMT         hstmt,
+                               UCHAR FAR *   szPkTableQualifier,
+                               SWORD         cbPkTableQualifier,
+                               UCHAR FAR *   szPkTableOwner,
+                               SWORD         cbPkTableOwner,
+                               UCHAR FAR *   szPkTableName,
+                               SWORD         cbPkTableName,
+                               UCHAR FAR *   szFkTableQualifier,
+                               SWORD         cbFkTableQualifier,
+                               UCHAR FAR *   szFkTableOwner,
+                               SWORD         cbFkTableOwner,
+                               UCHAR FAR *   szFkTableName,
+                               SWORD         cbFkTableName)
 {
-	static char *func = "SQLForeignKeys";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	TupleNode  *row;
-	HSTMT		htbl_stmt,
-				hpkey_stmt;
-	StatementClass *tbl_stmt;
-	RETCODE		result,
-				keyresult;
-	char		tables_query[STD_STATEMENT_LEN];
-	char		trig_deferrable[2];
-	char		trig_initdeferred[2];
-	char		trig_args[1024];
-	char		upd_rule[MAX_TABLE_LEN],
-				del_rule[MAX_TABLE_LEN];
-	char		pk_table_needed[MAX_TABLE_LEN + 1];
-	char		fk_table_needed[MAX_TABLE_LEN + 1];
-	char	   *pkey_ptr,
-			   *fkey_ptr,
-			   *pk_table,
-			   *fk_table;
-	int			i,
-				j,
-				k,
-				num_keys;
-	SWORD		trig_nargs,
-				upd_rule_type = 0,
-				del_rule_type = 0;
-
+static char *func = "SQLForeignKeys";
+StatementClass *stmt = (StatementClass *) hstmt;
+TupleNode *row;
+HSTMT htbl_stmt, hpkey_stmt;
+StatementClass *tbl_stmt;
+RETCODE result, keyresult;
+char tables_query[STD_STATEMENT_LEN];
+char trig_deferrable[2];
+char trig_initdeferred[2];
+char trig_args[1024];
+char upd_rule[MAX_TABLE_LEN], del_rule[MAX_TABLE_LEN];
+char pk_table_needed[MAX_TABLE_LEN + 1];
+char fk_table_needed[MAX_TABLE_LEN + 1];
+char *pkey_ptr, *fkey_ptr, *pk_table, *fk_table;
+int i, j, k, num_keys;
+SWORD trig_nargs, upd_rule_type=0, del_rule_type=0;
 #if (ODBCVER >= 0x0300)
-	SWORD		defer_type;
-
+SWORD defer_type;
 #endif
-	char		pkey[MAX_INFO_STRING];
-	Int2		result_cols;
+char pkey[MAX_INFO_STRING];
+Int2 result_cols;
 
 
 	mylog("%s: entering...stmt=%u\n", func, stmt);
 
 
-	if (!stmt)
-	{
+    if( ! stmt) {
 		SC_log_error(func, "", NULL);
-		return SQL_INVALID_HANDLE;
-	}
-
+        return SQL_INVALID_HANDLE;
+    }
+	
 	stmt->manual_result = TRUE;
 	stmt->errormsg_created = TRUE;
 
-	stmt->result = QR_Constructor();
-	if (!stmt->result)
-	{
+    stmt->result = QR_Constructor();
+    if(!stmt->result) {
 		stmt->errormsg = "Couldn't allocate memory for SQLForeignKeys result.";
-		stmt->errornumber = STMT_NO_MEMORY_ERROR;
+        stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	/* the binding structure for a statement is not set up until */
-
-	/*
-	 * a statement is actually executed, so we'll have to do this
-	 * ourselves.
-	 */
+    /* the binding structure for a statement is not set up until */
+    /* a statement is actually executed, so we'll have to do this ourselves. */
 	result_cols = 14;
-	extend_bindings(stmt, result_cols);
-
-	/* set the field names */
-	QR_set_num_fields(stmt->result, result_cols);
-	QR_set_field_info(stmt->result, 0, "PKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 1, "PKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 2, "PKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 3, "PKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 4, "FKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 5, "FKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 6, "FKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 7, "FKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 8, "KEY_SEQ", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 9, "UPDATE_RULE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 10, "DELETE_RULE", PG_TYPE_INT2, 2);
-	QR_set_field_info(stmt->result, 11, "FK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 12, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
-	QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    extend_bindings(stmt, result_cols);
+
+    /* set the field names */
+    QR_set_num_fields(stmt->result, result_cols);
+    QR_set_field_info(stmt->result, 0, "PKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 1, "PKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 2, "PKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 3, "PKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 4, "FKTABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 5, "FKTABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 6, "FKTABLE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 7, "FKCOLUMN_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 8, "KEY_SEQ", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 9, "UPDATE_RULE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 10, "DELETE_RULE", PG_TYPE_INT2, 2);
+    QR_set_field_info(stmt->result, 11, "FK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 12, "PK_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
+    QR_set_field_info(stmt->result, 13, "TRIGGER_NAME", PG_TYPE_TEXT, MAX_INFO_STRING);
 #if (ODBCVER >= 0x0300)
 	QR_set_field_info(stmt->result, 14, "DEFERRABILITY", PG_TYPE_INT2, 2);
-#endif	 /* ODBCVER >= 0x0300 */
+#endif /* ODBCVER >= 0x0300 */
 
-	/* also, things need to think that this statement is finished so */
-	/* the results can be retrieved. */
-	stmt->status = STMT_FINISHED;
+    /* also, things need to think that this statement is finished so */
+    /* the results can be retrieved. */
+    stmt->status = STMT_FINISHED;
 
-	/* set up the current tuple pointer for SQLFetch */
-	stmt->currTuple = -1;
+    /* set up the current tuple pointer for SQLFetch */
+    stmt->currTuple = -1;
 	stmt->rowset_start = -1;
 	stmt->current_col = -1;
 
 
-	result = SQLAllocStmt(stmt->hdbc, &htbl_stmt);
-	if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-	{
+    result = SQLAllocStmt( stmt->hdbc, &htbl_stmt);
+    if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 		stmt->errornumber = STMT_NO_MEMORY_ERROR;
 		stmt->errormsg = "Couldn't allocate statement for SQLForeignKeys result.";
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
 	tbl_stmt = (StatementClass *) htbl_stmt;
 
@@ -2724,57 +2386,53 @@ SQLForeignKeys(
 	make_string(szPkTableName, cbPkTableName, pk_table_needed);
 	make_string(szFkTableName, cbFkTableName, fk_table_needed);
 
-	/*
-	 * Case #2 -- Get the foreign keys in the specified table (fktab) that
-	 * refer to the primary keys of other table(s).
-	 */
-	if (fk_table_needed[0] != '\0')
-	{
+	/*	Case #2 -- Get the foreign keys in the specified table (fktab) that 
+		refer to the primary keys of other table(s).
+	*/
+	if (fk_table_needed[0] != '\0') {
 		mylog("%s: entering Foreign Key Case #2", func);
 		sprintf(tables_query, "SELECT	pt.tgargs, "
-				"		pt.tgnargs, "
-				"		pt.tgdeferrable, "
-				"		pt.tginitdeferred, "
-				"		pg_proc.proname, "
-				"		pg_proc_1.proname "
-				"FROM	pg_class pc, "
-				"		pg_proc pg_proc, "
-				"		pg_proc pg_proc_1, "
-				"		pg_trigger pg_trigger, "
-				"		pg_trigger pg_trigger_1, "
-				"		pg_proc pp, "
-				"		pg_trigger pt "
-				"WHERE	pt.tgrelid = pc.oid "
-				"AND pp.oid = pt.tgfoid "
-				"AND pg_trigger.tgconstrrelid = pc.oid "
-				"AND pg_proc.oid = pg_trigger.tgfoid "
-				"AND pg_trigger_1.tgfoid = pg_proc_1.oid "
-				"AND pg_trigger_1.tgconstrrelid = pc.oid "
-				"AND ((pc.relname='%s') "
-				"AND (pp.proname LIKE '%%ins') "
-				"AND (pg_proc.proname LIKE '%%upd') "
-				"AND (pg_proc_1.proname LIKE '%%del') "
-				"AND (pg_trigger.tgrelid=pt.tgconstrrelid) "
-				"AND (pg_trigger.tgconstrname=pt.tgconstrname) "
-				"AND (pg_trigger_1.tgrelid=pt.tgconstrrelid) "
-				"AND (pg_trigger_1.tgconstrname=pt.tgconstrname))",
-				fk_table_needed);
+								"		pt.tgnargs, "
+								"		pt.tgdeferrable, "
+								"		pt.tginitdeferred, "
+								"		pg_proc.proname, "
+								"		pg_proc_1.proname "
+								"FROM	pg_class pc, "
+								"		pg_proc pg_proc, "
+								"		pg_proc pg_proc_1, "
+								"		pg_trigger pg_trigger, "
+								"		pg_trigger pg_trigger_1, "
+								"		pg_proc pp, "
+								"		pg_trigger pt "
+								"WHERE	pt.tgrelid = pc.oid "
+								"AND pp.oid = pt.tgfoid "
+								"AND pg_trigger.tgconstrrelid = pc.oid "
+								"AND pg_proc.oid = pg_trigger.tgfoid "
+								"AND pg_trigger_1.tgfoid = pg_proc_1.oid "
+								"AND pg_trigger_1.tgconstrrelid = pc.oid "
+								"AND ((pc.relname='%s') "
+								"AND (pp.proname LIKE '%%ins') "
+								"AND (pg_proc.proname LIKE '%%upd') "
+								"AND (pg_proc_1.proname LIKE '%%del') "
+								"AND (pg_trigger.tgrelid=pt.tgconstrrelid) "
+								"AND (pg_trigger.tgconstrname=pt.tgconstrname) "
+								"AND (pg_trigger_1.tgrelid=pt.tgconstrrelid) "
+								"AND (pg_trigger_1.tgconstrname=pt.tgconstrname))", 
+				fk_table_needed);		
 
 		result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
 
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
-			SQLFreeStmt(htbl_stmt, SQL_DROP);
+    		SQLFreeStmt(htbl_stmt, SQL_DROP);
 			return SQL_ERROR;
 		}
 
 		result = SQLBindCol(htbl_stmt, 1, SQL_C_BINARY,
 							trig_args, sizeof(trig_args), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2784,8 +2442,7 @@ SQLForeignKeys(
 
 		result = SQLBindCol(htbl_stmt, 2, SQL_C_SHORT,
 							&trig_nargs, 0, NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2794,9 +2451,8 @@ SQLForeignKeys(
 		}
 
 		result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
-						 trig_deferrable, sizeof(trig_deferrable), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+							trig_deferrable, sizeof(trig_deferrable), NULL);
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2805,9 +2461,8 @@ SQLForeignKeys(
 		}
 
 		result = SQLBindCol(htbl_stmt, 4, SQL_C_CHAR,
-					 trig_initdeferred, sizeof(trig_initdeferred), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+							trig_initdeferred, sizeof(trig_initdeferred), NULL);
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2817,8 +2472,7 @@ SQLForeignKeys(
 
 		result = SQLBindCol(htbl_stmt, 5, SQL_C_CHAR,
 							upd_rule, sizeof(upd_rule), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2828,8 +2482,7 @@ SQLForeignKeys(
 
 		result = SQLBindCol(htbl_stmt, 6, SQL_C_CHAR,
 							del_rule, sizeof(del_rule), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2841,8 +2494,7 @@ SQLForeignKeys(
 		if (result == SQL_NO_DATA_FOUND)
 			return SQL_SUCCESS;
 
-		if (result != SQL_SUCCESS)
-		{
+		if(result != SQL_SUCCESS) {
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -2850,9 +2502,8 @@ SQLForeignKeys(
 			return SQL_ERROR;
 		}
 
-		keyresult = SQLAllocStmt(stmt->hdbc, &hpkey_stmt);
-		if ((keyresult != SQL_SUCCESS) && (keyresult != SQL_SUCCESS_WITH_INFO))
-		{
+		keyresult = SQLAllocStmt( stmt->hdbc, &hpkey_stmt);
+		if((keyresult != SQL_SUCCESS) && (keyresult != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Couldn't allocate statement for SQLForeignKeys (pkeys) result.";
 			SC_log_error(func, "", stmt);
@@ -2860,9 +2511,8 @@ SQLForeignKeys(
 		}
 
 		keyresult = SQLBindCol(hpkey_stmt, 4, SQL_C_CHAR,
-							   pkey, sizeof(pkey), NULL);
-		if (keyresult != SQL_SUCCESS)
-		{
+								pkey, sizeof(pkey), NULL);
+		if (keyresult != SQL_SUCCESS) {
 			stmt->errornumber = STMT_NO_MEMORY_ERROR;
 			stmt->errormsg = "Couldn't bindcol for primary keys for SQLForeignKeys result.";
 			SC_log_error(func, "", stmt);
@@ -2870,33 +2520,31 @@ SQLForeignKeys(
 			return SQL_ERROR;
 		}
 
-		while (result == SQL_SUCCESS)
-		{
-			/* Compute the number of keyparts. */
+		while (result == SQL_SUCCESS) {
+
+			/*	Compute the number of keyparts.	*/
 			num_keys = (trig_nargs - 4) / 2;
 
 			mylog("Foreign Key Case#2: trig_nargs = %d, num_keys = %d\n", trig_nargs, num_keys);
 
 			pk_table = trig_args;
 
-			/* Get to the PK Table Name */
+			/*	Get to the PK Table Name */
 			for (k = 0; k < 2; k++)
 				pk_table += strlen(pk_table) + 1;
 
-			/* If there is a pk table specified, then check it. */
-			if (pk_table_needed[0] != '\0')
-			{
-				/* If it doesn't match, then continue */
-				if (strcmp(pk_table, pk_table_needed))
-				{
+			/*	If there is a pk table specified, then check it. */
+			if (pk_table_needed[0] != '\0') {
+
+				/*	If it doesn't match, then continue */
+				if ( strcmp(pk_table, pk_table_needed)) {	
 					result = SQLFetch(htbl_stmt);
 					continue;
 				}
 			}
 
 			keyresult = SQLPrimaryKeys(hpkey_stmt, NULL, 0, NULL, 0, pk_table, SQL_NTS);
-			if (keyresult != SQL_SUCCESS)
-			{
+			if (keyresult != SQL_SUCCESS) {
 				stmt->errornumber = STMT_NO_MEMORY_ERROR;
 				stmt->errormsg = "Couldn't get primary keys for SQLForeignKeys result.";
 				SC_log_error(func, "", stmt);
@@ -2905,76 +2553,77 @@ SQLForeignKeys(
 			}
 
 
-			/* Check that the key listed is the primary key */
+			/*	Check that the key listed is the primary key */
 			keyresult = SQLFetch(hpkey_stmt);
 
-			/* Get to first primary key */
+			/*	Get to first primary key */
 			pkey_ptr = trig_args;
 			for (i = 0; i < 5; i++)
 				pkey_ptr += strlen(pkey_ptr) + 1;
 
-			for (k = 0; k < num_keys; k++)
-			{
+			for (k = 0; k < num_keys; k++) {
 				mylog("%s: pkey_ptr='%s', pkey='%s'\n", func, pkey_ptr, pkey);
-				if (keyresult != SQL_SUCCESS || strcmp(pkey_ptr, pkey))
-				{
+				if ( keyresult != SQL_SUCCESS || strcmp(pkey_ptr, pkey)) {
 					num_keys = 0;
 					break;
 				}
 
-				/* Get to next primary key */
+				/*	Get to next primary key */
 				for (k = 0; k < 2; k++)
 					pkey_ptr += strlen(pkey_ptr) + 1;
 
 				keyresult = SQLFetch(hpkey_stmt);
 			}
 
-			/* Set to first fk column */
+			/*	Set to first fk column */
 			fkey_ptr = trig_args;
 			for (k = 0; k < 4; k++)
 				fkey_ptr += strlen(fkey_ptr) + 1;
 
 			/* Set update and delete actions for foreign keys */
-			if (!strcmp(upd_rule, "RI_FKey_cascade_upd"))
+			if (!strcmp(upd_rule, "RI_FKey_cascade_upd")) {
 				upd_rule_type = SQL_CASCADE;
-			else if (!strcmp(upd_rule, "RI_FKey_noaction_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_noaction_upd")) {
 				upd_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_restrict_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_restrict_upd")) {
 				upd_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd")) {
 				upd_rule_type = SQL_SET_DEFAULT;
-			else if (!strcmp(upd_rule, "RI_FKey_setnull_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setnull_upd")) {
 				upd_rule_type = SQL_SET_NULL;
-
-			if (!strcmp(upd_rule, "RI_FKey_cascade_del"))
+			}
+			
+			if (!strcmp(upd_rule, "RI_FKey_cascade_del")) {
 				del_rule_type = SQL_CASCADE;
-			else if (!strcmp(upd_rule, "RI_FKey_noaction_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_noaction_del")) {
 				del_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_restrict_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_restrict_del")) {
 				del_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_setdefault_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_del")) {
 				del_rule_type = SQL_SET_DEFAULT;
-			else if (!strcmp(upd_rule, "RI_FKey_setnull_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setnull_del")) {
 				del_rule_type = SQL_SET_NULL;
+			}
 
 #if (ODBCVER >= 0x0300)
 			/* Set deferrability type */
-			if (!strcmp(trig_initdeferred, "y"))
+			if (!strcmp(trig_initdeferred, "y")) {
 				defer_type = SQL_INITIALLY_DEFERRED;
-			else if (!strcmp(trig_deferrable, "y"))
+			} else if (!strcmp(trig_deferrable, "y")) {
 				defer_type = SQL_INITIALLY_IMMEDIATE;
-			else
+			} else {
 				defer_type = SQL_NOT_DEFERRABLE;
-#endif	 /* ODBCVER >= 0x0300 */
+			}
+#endif /* ODBCVER >= 0x0300 */
 
-			/* Get to first primary key */
+			/*	Get to first primary key */
 			pkey_ptr = trig_args;
 			for (i = 0; i < 5; i++)
 				pkey_ptr += strlen(pkey_ptr) + 1;
 
-			for (k = 0; k < num_keys; k++)
-			{
-				row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
+			for (k = 0; k < num_keys; k++) {
+
+				row = (TupleNode *)malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
 
 				mylog("%s: pk_table = '%s', pkey_ptr = '%s'\n", func, pk_table, pkey_ptr);
 				set_tuplefield_null(&row->tuple[0]);
@@ -2997,13 +2646,12 @@ SQLForeignKeys(
 				set_tuplefield_string(&row->tuple[13], trig_args);
 #if (ODBCVER >= 0x0300)
 				set_tuplefield_int2(&row->tuple[14], defer_type);
-#endif	 /* ODBCVER >= 0x0300 */
+#endif /* ODBCVER >= 0x0300 */
 
 				QR_add_tuple(stmt->result, row);
 
 				/* next primary/foreign key */
-				for (i = 0; i < 2; i++)
-				{
+				for (i = 0; i < 2; i++) {
 					fkey_ptr += strlen(fkey_ptr) + 1;
 					pkey_ptr += strlen(pkey_ptr) + 1;
 				}
@@ -3014,57 +2662,53 @@ SQLForeignKeys(
 		SQLFreeStmt(hpkey_stmt, SQL_DROP);
 	}
 
-	/*
-	 * Case #1 -- Get the foreign keys in other tables that refer to the
-	 * primary key in the specified table (pktab).	i.e., Who points to
-	 * me?
-	 */
-	else if (pk_table_needed[0] != '\0')
-	{
+	/*	Case #1 -- Get the foreign keys in other tables that refer to the primary key
+		in the specified table (pktab).  i.e., Who points to me?
+	*/
+    else if (pk_table_needed[0] != '\0') {
+
 		sprintf(tables_query, "SELECT	pg_trigger.tgargs, "
-				"		pg_trigger.tgnargs, "
-				"		pg_trigger.tgdeferrable, "
-				"		pg_trigger.tginitdeferred, "
-				"		pg_proc.proname, "
-				"		pg_proc_1.proname "
-				"FROM	pg_class pg_class, "
-				"		pg_class pg_class_1, "
-				"		pg_class pg_class_2, "
-				"		pg_proc pg_proc, "
-				"		pg_proc pg_proc_1, "
-				"		pg_trigger pg_trigger, "
-				"		pg_trigger pg_trigger_1, "
-				"		pg_trigger pg_trigger_2 "
-				"WHERE	pg_trigger.tgconstrrelid = pg_class.oid "
-				"	AND pg_trigger.tgrelid = pg_class_1.oid "
-				"	AND pg_trigger_1.tgfoid = pg_proc_1.oid "
-				"	AND pg_trigger_1.tgconstrrelid = pg_class_1.oid "
-				"	AND pg_trigger_2.tgconstrrelid = pg_class_2.oid "
-				"	AND pg_trigger_2.tgfoid = pg_proc.oid "
-				"	AND pg_class_2.oid = pg_trigger.tgrelid "
-				"	AND ("
-				"		 (pg_class.relname='%s') "
-				"	AND  (pg_proc.proname Like '%%upd') "
-				"	AND  (pg_proc_1.proname Like '%%del')"
-				"	AND	 (pg_trigger_1.tgrelid = pg_trigger.tgconstrrelid) "
-				"	AND	 (pg_trigger_2.tgrelid = pg_trigger.tgconstrrelid) "
-				"		)",
+								"		pg_trigger.tgnargs, "
+								"		pg_trigger.tgdeferrable, "
+								"		pg_trigger.tginitdeferred, "
+								"		pg_proc.proname, "
+								"		pg_proc_1.proname "
+								"FROM	pg_class pg_class, "
+								"		pg_class pg_class_1, "
+								"		pg_class pg_class_2, "
+								"		pg_proc pg_proc, "
+								"		pg_proc pg_proc_1, "
+								"		pg_trigger pg_trigger, "
+								"		pg_trigger pg_trigger_1, "
+								"		pg_trigger pg_trigger_2 "
+								"WHERE	pg_trigger.tgconstrrelid = pg_class.oid "
+								"	AND pg_trigger.tgrelid = pg_class_1.oid "
+								"	AND pg_trigger_1.tgfoid = pg_proc_1.oid "
+								"	AND pg_trigger_1.tgconstrrelid = pg_class_1.oid "
+								"	AND pg_trigger_2.tgconstrrelid = pg_class_2.oid "
+								"	AND pg_trigger_2.tgfoid = pg_proc.oid "
+								"	AND pg_class_2.oid = pg_trigger.tgrelid "
+								"	AND ("
+								"		 (pg_class.relname='%s') "
+								"	AND  (pg_proc.proname Like '%%upd') "
+								"	AND  (pg_proc_1.proname Like '%%del')"
+								"	AND	 (pg_trigger_1.tgrelid = pg_trigger.tgconstrrelid) "
+								"	AND	 (pg_trigger_2.tgrelid = pg_trigger.tgconstrrelid) "
+								"		)",
 				pk_table_needed);
 
 		result = SQLExecDirect(htbl_stmt, tables_query, strlen(tables_query));
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
-			SQLFreeStmt(htbl_stmt, SQL_DROP);
+    		SQLFreeStmt(htbl_stmt, SQL_DROP);
 			return SQL_ERROR;
 		}
 
 		result = SQLBindCol(htbl_stmt, 1, SQL_C_BINARY,
 							trig_args, sizeof(trig_args), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3074,8 +2718,7 @@ SQLForeignKeys(
 
 		result = SQLBindCol(htbl_stmt, 2, SQL_C_SHORT,
 							&trig_nargs, 0, NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3084,9 +2727,8 @@ SQLForeignKeys(
 		}
 
 		result = SQLBindCol(htbl_stmt, 3, SQL_C_CHAR,
-						 trig_deferrable, sizeof(trig_deferrable), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+							trig_deferrable, sizeof(trig_deferrable), NULL);
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3095,9 +2737,8 @@ SQLForeignKeys(
 		}
 
 		result = SQLBindCol(htbl_stmt, 4, SQL_C_CHAR,
-					 trig_initdeferred, sizeof(trig_initdeferred), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+							trig_initdeferred, sizeof(trig_initdeferred), NULL);
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3107,8 +2748,7 @@ SQLForeignKeys(
 
 		result = SQLBindCol(htbl_stmt, 5, SQL_C_CHAR,
 							upd_rule, sizeof(upd_rule), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3118,8 +2758,7 @@ SQLForeignKeys(
 
 		result = SQLBindCol(htbl_stmt, 6, SQL_C_CHAR,
 							del_rule, sizeof(del_rule), NULL);
-		if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-		{
+		if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 			stmt->errormsg = tbl_stmt->errormsg;
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3131,8 +2770,7 @@ SQLForeignKeys(
 		if (result == SQL_NO_DATA_FOUND)
 			return SQL_SUCCESS;
 
-		if (result != SQL_SUCCESS)
-		{
+		if(result != SQL_SUCCESS) {
 			stmt->errormsg = SC_create_errormsg(htbl_stmt);
 			stmt->errornumber = tbl_stmt->errornumber;
 			SC_log_error(func, "", stmt);
@@ -3140,76 +2778,79 @@ SQLForeignKeys(
 			return SQL_ERROR;
 		}
 
-		while (result == SQL_SUCCESS)
-		{
-			/* Calculate the number of key parts */
+		while (result == SQL_SUCCESS) {
+
+			/*	Calculate the number of key parts */
 			num_keys = (trig_nargs - 4) / 2;;
 
-			/* Handle action (i.e., 'cascade', 'restrict', 'setnull') */
-			if (!strcmp(upd_rule, "RI_FKey_cascade_upd"))
+			/*	Handle action (i.e., 'cascade', 'restrict', 'setnull') */
+			if (!strcmp(upd_rule, "RI_FKey_cascade_upd")) {
 				upd_rule_type = SQL_CASCADE;
-			else if (!strcmp(upd_rule, "RI_FKey_noaction_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_noaction_upd")) {
 				upd_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_restrict_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_restrict_upd")) {
 				upd_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_upd")) {
 				upd_rule_type = SQL_SET_DEFAULT;
-			else if (!strcmp(upd_rule, "RI_FKey_setnull_upd"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setnull_upd")) {
 				upd_rule_type = SQL_SET_NULL;
-
-			if (!strcmp(upd_rule, "RI_FKey_cascade_del"))
+			}
+			
+			if (!strcmp(upd_rule, "RI_FKey_cascade_del")) {
 				del_rule_type = SQL_CASCADE;
-			else if (!strcmp(upd_rule, "RI_FKey_noaction_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_noaction_del")) {
 				del_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_restrict_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_restrict_del")) {
 				del_rule_type = SQL_NO_ACTION;
-			else if (!strcmp(upd_rule, "RI_FKey_setdefault_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setdefault_del")) {
 				del_rule_type = SQL_SET_DEFAULT;
-			else if (!strcmp(upd_rule, "RI_FKey_setnull_del"))
+			} else if (!strcmp(upd_rule, "RI_FKey_setnull_del")) {
 				del_rule_type = SQL_SET_NULL;
+			}			
 
 #if (ODBCVER >= 0x0300)
 			/* Set deferrability type */
-			if (!strcmp(trig_initdeferred, "y"))
+			if (!strcmp(trig_initdeferred, "y")) {
 				defer_type = SQL_INITIALLY_DEFERRED;
-			else if (!strcmp(trig_deferrable, "y"))
+			} else if (!strcmp(trig_deferrable, "y")) {
 				defer_type = SQL_INITIALLY_IMMEDIATE;
-			else
+			} else {
 				defer_type = SQL_NOT_DEFERRABLE;
-#endif	 /* ODBCVER >= 0x0300 */
+			}
+#endif /* ODBCVER >= 0x0300 */
 
 			mylog("Foreign Key Case#1: trig_nargs = %d, num_keys = %d\n", trig_nargs, num_keys);
 
-			/* Get to first primary key */
+			/*	Get to first primary key */
 			pkey_ptr = trig_args;
 			for (i = 0; i < 5; i++)
 				pkey_ptr += strlen(pkey_ptr) + 1;
 
 
-			/* Get to first foreign table */
+			/*	Get to first foreign table */
 			fk_table = trig_args;
 			fk_table += strlen(fk_table) + 1;
 
 			/* Get to first foreign key */
 			fkey_ptr = trig_args;
-			for (k = 0; k < 4; k++)
+			for (k = 0; k < 4; k++) 
 				fkey_ptr += strlen(fkey_ptr) + 1;
 
-			for (k = 0; k < num_keys; k++)
-			{
+			for (k = 0; k < num_keys; k++) {
+
 				mylog("pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'\n", pkey_ptr, fk_table, fkey_ptr);
 
-				row = (TupleNode *) malloc(sizeof(TupleNode) + (result_cols - 1) *sizeof(TupleField));
+					row = (TupleNode *)malloc(sizeof(TupleNode) + (result_cols - 1) * sizeof(TupleField));
 
 				mylog("pk_table_needed = '%s', pkey_ptr = '%s'\n", pk_table_needed, pkey_ptr);
-				set_tuplefield_null(&row->tuple[0]);
-				set_tuplefield_string(&row->tuple[1], "");
+					set_tuplefield_null(&row->tuple[0]);
+					set_tuplefield_string(&row->tuple[1], "");
 				set_tuplefield_string(&row->tuple[2], pk_table_needed);
 				set_tuplefield_string(&row->tuple[3], pkey_ptr);
 
 				mylog("fk_table = '%s', fkey_ptr = '%s'\n", fk_table, fkey_ptr);
-				set_tuplefield_null(&row->tuple[4]);
-				set_tuplefield_string(&row->tuple[5], "");
+					set_tuplefield_null(&row->tuple[4]);
+					set_tuplefield_string(&row->tuple[5], "");
 				set_tuplefield_string(&row->tuple[6], fk_table);
 				set_tuplefield_string(&row->tuple[7], fkey_ptr);
 
@@ -3219,21 +2860,20 @@ SQLForeignKeys(
 				set_nullfield_int2(&row->tuple[9], (Int2) upd_rule_type);
 				set_nullfield_int2(&row->tuple[10], (Int2) del_rule_type);
 
-				set_tuplefield_null(&row->tuple[11]);
-				set_tuplefield_null(&row->tuple[12]);
+					set_tuplefield_null(&row->tuple[11]);
+					set_tuplefield_null(&row->tuple[12]);
 
 				set_tuplefield_string(&row->tuple[13], trig_args);
 
 #if (ODBCVER >= 0x0300)
 				mylog("defer_type = '%s'", defer_type);
 				set_tuplefield_int2(&row->tuple[14], defer_type);
-#endif	 /* ODBCVER >= 0x0300 */
+#endif /* ODBCVER >= 0x0300 */
 
 				QR_add_tuple(stmt->result, row);
 
-				/* next primary/foreign key */
-				for (j = 0; j < 2; j++)
-				{
+				/*	next primary/foreign key */
+				for (j = 0; j < 2; j++) {
 					pkey_ptr += strlen(pkey_ptr) + 1;
 					fkey_ptr += strlen(fkey_ptr) + 1;
 				}
@@ -3241,9 +2881,8 @@ SQLForeignKeys(
 
 			result = SQLFetch(htbl_stmt);
 		}
-	}
-	else
-	{
+    }
+	else {
 		stmt->errormsg = "No tables specified to SQLForeignKeys.";
 		stmt->errornumber = STMT_INTERNAL_ERROR;
 		SC_log_error(func, "", stmt);
@@ -3254,63 +2893,60 @@ SQLForeignKeys(
 	SQLFreeStmt(htbl_stmt, SQL_DROP);
 
 	mylog("SQLForeignKeys(): EXIT, stmt=%u\n", stmt);
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
 
 
-RETCODE SQL_API
-SQLProcedureColumns(
-					HSTMT hstmt,
-					UCHAR FAR *szProcQualifier,
-					SWORD cbProcQualifier,
-					UCHAR FAR *szProcOwner,
-					SWORD cbProcOwner,
-					UCHAR FAR *szProcName,
-					SWORD cbProcName,
-					UCHAR FAR *szColumnName,
-					SWORD cbColumnName)
+RETCODE SQL_API SQLProcedureColumns(
+                                    HSTMT         hstmt,
+                                    UCHAR FAR *   szProcQualifier,
+                                    SWORD         cbProcQualifier,
+                                    UCHAR FAR *   szProcOwner,
+                                    SWORD         cbProcOwner,
+                                    UCHAR FAR *   szProcName,
+                                    SWORD         cbProcName,
+                                    UCHAR FAR *   szColumnName,
+                                    SWORD         cbColumnName)
 {
-	static char *func = "SQLProcedureColumns";
+static char *func="SQLProcedureColumns";
 
 	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-	return SQL_ERROR;
+    return SQL_ERROR;
 }
 
-RETCODE SQL_API
-SQLProcedures(
-			  HSTMT hstmt,
-			  UCHAR FAR *szProcQualifier,
-			  SWORD cbProcQualifier,
-			  UCHAR FAR *szProcOwner,
-			  SWORD cbProcOwner,
-			  UCHAR FAR *szProcName,
-			  SWORD cbProcName)
+RETCODE SQL_API SQLProcedures(
+                              HSTMT          hstmt,
+                              UCHAR FAR *    szProcQualifier,
+                              SWORD          cbProcQualifier,
+                              UCHAR FAR *    szProcOwner,
+                              SWORD          cbProcOwner,
+                              UCHAR FAR *    szProcName,
+                              SWORD          cbProcName)
 {
-	static char *func = "SQLProcedures";
+static char *func="SQLProcedures";
 
 	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-	return SQL_ERROR;
+    return SQL_ERROR;
 }
 
-RETCODE SQL_API
-SQLTablePrivileges(
-				   HSTMT hstmt,
-				   UCHAR FAR *szTableQualifier,
-				   SWORD cbTableQualifier,
-				   UCHAR FAR *szTableOwner,
-				   SWORD cbTableOwner,
-				   UCHAR FAR *szTableName,
-				   SWORD cbTableName)
+RETCODE SQL_API SQLTablePrivileges(
+                                   HSTMT           hstmt,
+                                   UCHAR FAR *     szTableQualifier,
+                                   SWORD           cbTableQualifier,
+                                   UCHAR FAR *     szTableOwner,
+                                   SWORD           cbTableOwner,
+                                   UCHAR FAR *     szTableName,
+                                   SWORD           cbTableName)
 {
-	static char *func = "SQLTablePrivileges";
+static char *func="SQLTablePrivileges";
 
 	mylog("%s: entering...\n", func);
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
-	return SQL_ERROR;
+    return SQL_ERROR;
 }
diff --git a/src/interfaces/odbc/iodbc.h b/src/interfaces/odbc/iodbc.h
index c8bc7bfd4b38096d7806a9a41bc9dca6cf015260..ab6a6015adad547454b06af22b634c74c58ac303 100644
--- a/src/interfaces/odbc/iodbc.h
+++ b/src/interfaces/odbc/iodbc.h
@@ -1,66 +1,66 @@
-#ifndef _IODBC_H
-#define _IODBC_H
-
-#if    !defined(WIN32) && !defined(WIN32_SYSTEM)
-#define   _UNIX_
-
-#include  <stdlib.h>
-#include  <sys/types.h>
-
-#define   MEM_ALLOC(size) (malloc((size_t)(size)))
-#define   MEM_FREE(ptr)   {if(ptr) free(ptr);}
-
-#define   STRCPY(t, s)	  (strcpy((char*)(t), (char*)(s)))
-#define   STRNCPY(t,s,n)  (strncpy((char*)(t), (char*)(s), (size_t)(n)))
-#define   STRCAT(t, s)	  (strcat((char*)(t), (char*)(s)))
-#define   STRNCAT(t,s,n)  (strncat((char*)(t), (char*)(s), (size_t)(n)))
-#define   STREQ(a, b) (strcmp((char*)(a), (char*)(b)) == 0)
-#define   STRLEN(str) ((str)? strlen((char*)(str)):0)
-
-#define   EXPORT
-#define   CALLBACK
-#define   FAR
-
-typedef signed short SSHOR;
-typedef short WORD;
-typedef long DWORD;
-
-typedef WORD WPARAM;
-typedef DWORD LPARAM;
-typedef void *HWND;
-typedef int BOOL;
-
-#endif	 /* _UNIX_ */
-
-#if    defined(WIN32) || defined(WIN32_SYSTEM)
-
-#include  <windows.h>
-#include  <windowsx.h>
-
-#ifdef	  _MSVC_
-#define  MEM_ALLOC(size) (fmalloc((size_t)(size)))
-#define  MEM_FREE(ptr)	 ((ptr)? ffree((PTR)(ptr)):0))
-#define  STRCPY(t, s)	 (fstrcpy((char FAR*)(t), (char FAR*)(s)))
-#define  STRNCPY(t,s,n)  (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
-#define  STRLEN(str) ((str)? fstrlen((char FAR*)(str)):0)
-#define  STREQ(a, b) (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
-#endif
-
-#ifdef	  _BORLAND_
-#define  MEM_ALLOC(size) (farmalloc((unsigned long)(size))
-#define  MEM_FREE(ptr)	 ((ptr)? farfree((void far*)(ptr)):0)
-#define  STRCPY(t, s)	 (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
-#define  STRNCPY(t,s,n)  (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
-#define  STRLEN(str)	 ((str)? _fstrlen((char FAR*)(str)):0)
-#define  STREQ(a, b)	 (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
-#endif
-
-#endif	 /* WIN32 */
-
-#define  SYSERR		(-1)
-
-#ifndef  NULL
-#define  NULL		((void FAR*)0UL)
-#endif
+#ifndef	_IODBC_H
+#define	_IODBC_H
+
+# if	!defined(WIN32) && !defined(WIN32_SYSTEM) 
+#  define	_UNIX_
+
+#  include	<stdlib.h>
+#  include	<sys/types.h>
+
+#  define	MEM_ALLOC(size)	(malloc((size_t)(size)))
+#  define	MEM_FREE(ptr)	{if(ptr) free(ptr);}
+
+#  define	STRCPY(t, s)	(strcpy((char*)(t), (char*)(s)))	
+#  define	STRNCPY(t,s,n)	(strncpy((char*)(t), (char*)(s), (size_t)(n)))
+#  define	STRCAT(t, s)	(strcat((char*)(t), (char*)(s)))
+#  define	STRNCAT(t,s,n)	(strncat((char*)(t), (char*)(s), (size_t)(n)))
+#  define	STREQ(a, b)	(strcmp((char*)(a), (char*)(b)) == 0)
+#  define	STRLEN(str)	((str)? strlen((char*)(str)):0)
+
+#  define	EXPORT
+#  define	CALLBACK
+#  define	FAR
+
+   typedef 	signed short	SSHOR;
+   typedef	short		WORD;
+   typedef 	long		DWORD;
+
+   typedef	WORD		WPARAM;
+   typedef	DWORD		LPARAM;
+   typedef	void*		HWND;
+   typedef	int		BOOL;
+
+# endif	/* _UNIX_ */
+
+# if	defined(WIN32) || defined(WIN32_SYSTEM)
+
+#  include	<windows.h>
+#  include	<windowsx.h>
+
+#  ifdef	_MSVC_
+#   define	MEM_ALLOC(size)	(fmalloc((size_t)(size)))
+#   define	MEM_FREE(ptr)	((ptr)? ffree((PTR)(ptr)):0))
+#   define	STRCPY(t, s)	(fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#   define	STRNCPY(t,s,n)	(fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#   define	STRLEN(str)	((str)? fstrlen((char FAR*)(str)):0)
+#   define	STREQ(a, b)	(fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
+#  endif
+
+#  ifdef	_BORLAND_
+#   define	MEM_ALLOC(size)	(farmalloc((unsigned long)(size))
+#   define	MEM_FREE(ptr)	((ptr)? farfree((void far*)(ptr)):0)
+#   define	STRCPY(t, s)	(_fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#   define	STRNCPY(t,s,n)	(_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#   define      STRLEN(str)     ((str)? _fstrlen((char FAR*)(str)):0)
+#   define      STREQ(a, b)     (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
+#  endif
+
+# endif	/* WIN32 */
+
+# define	SYSERR		(-1)
+
+# ifndef	NULL
+#   define	NULL		((void FAR*)0UL)
+# endif
 
 #endif
diff --git a/src/interfaces/odbc/isql.h b/src/interfaces/odbc/isql.h
index 5365ddd7af9e2cab3214c6b05ce21aa87a228859..deeddd3db04242300ff64c5d8722990418e1ab6b 100644
--- a/src/interfaces/odbc/isql.h
+++ b/src/interfaces/odbc/isql.h
@@ -2,108 +2,108 @@
 * include path to be used to create ODBC compliant applications.
 */
 #ifndef _INTRINSIC_SQL_H
-#define _INTRINSIC_SQL_H
+# define _INTRINSIC_SQL_H
 
-typedef unsigned char UCHAR;
-typedef long int SDWORD;
-typedef short int SWORD;
-typedef unsigned long int UDWORD;
-typedef unsigned short int UWORD;
+typedef unsigned char		UCHAR;
+typedef long int		SDWORD;
+typedef short int		SWORD;
+typedef unsigned long int	UDWORD; 
+typedef unsigned short int	UWORD;
 
-typedef void FAR *PTR;
+typedef void FAR*		PTR;
 
-typedef void FAR *HENV;
-typedef void FAR *HDBC;
-typedef void FAR *HSTMT;
+typedef void FAR*		HENV;
+typedef void FAR*		HDBC;
+typedef void FAR*		HSTMT;
 
-typedef signed short RETCODE;
+typedef signed short		RETCODE;
 
-#ifdef WIN32
-#define SQL_API				__stdcall
-#else
-#define SQL_API				EXPORT CALLBACK
-#endif
+# ifdef WIN32
+#   define SQL_API			__stdcall
+# else
+#   define SQL_API			EXPORT CALLBACK
+# endif
 
-#define ODBCVER				0x0250
+# define ODBCVER			0x0250
 
-#define SQL_MAX_MESSAGE_LENGTH 512
-#define SQL_MAX_DSN_LENGTH	32
+# define SQL_MAX_MESSAGE_LENGTH		512
+# define SQL_MAX_DSN_LENGTH		32
 
 /* return code */
-#define SQL_INVALID_HANDLE		(-2)
-#define SQL_ERROR				(-1)
-#define SQL_SUCCESS				0
-#define SQL_SUCCESS_WITH_INFO	1
-#define SQL_NO_DATA_FOUND		100
+# define SQL_INVALID_HANDLE		(-2)
+# define SQL_ERROR			(-1)
+# define SQL_SUCCESS 			0
+# define SQL_SUCCESS_WITH_INFO		1
+# define SQL_NO_DATA_FOUND		100
 
 /* standard SQL datatypes (agree with ANSI type numbering) */
-#define SQL_CHAR			1
-#define SQL_NUMERIC			2
-#define SQL_DECIMAL			3
-#define SQL_INTEGER			4
-#define SQL_SMALLINT		5
-#define SQL_FLOAT			6
-#define SQL_REAL			7
-#define SQL_DOUBLE			8
-#define SQL_VARCHAR			12
-
-#define SQL_TYPE_MIN		SQL_CHAR
-#define SQL_TYPE_NUL		0
-#define SQL_TYPE_MAX		SQL_VARCHAR
+# define SQL_CHAR			1
+# define SQL_NUMERIC 			2
+# define SQL_DECIMAL 			3
+# define SQL_INTEGER 			4
+# define SQL_SMALLINT			5
+# define SQL_FLOAT			6
+# define SQL_REAL			7
+# define SQL_DOUBLE			8
+# define SQL_VARCHAR 			12
+
+# define SQL_TYPE_MIN			SQL_CHAR
+# define SQL_TYPE_NULL			0
+# define SQL_TYPE_MAX			SQL_VARCHAR
 
 /* C to SQL datatype mapping */
-#define SQL_C_CHAR			SQL_CHAR
-#define SQL_C_LONG			SQL_INTEGER
-#define SQL_C_SHORT			SQL_SMALLINT
-#define SQL_C_FLOAT			SQL_REAL
-#define SQL_C_DOUBLE		SQL_DOUBLE
-#define SQL_C_DEFAULT		99
+# define SQL_C_CHAR			SQL_CHAR
+# define SQL_C_LONG			SQL_INTEGER
+# define SQL_C_SHORT   			SQL_SMALLINT
+# define SQL_C_FLOAT   			SQL_REAL
+# define SQL_C_DOUBLE			SQL_DOUBLE
+# define SQL_C_DEFAULT 			99
 
-#define SQL_NO_NULLS		0
-#define SQL_NULLABLE		1
-#define SQL_NULLABLE_UNKNOWN   2
+# define SQL_NO_NULLS			0
+# define SQL_NULLABLE			1
+# define SQL_NULLABLE_UNKNOWN		2
 
 /* some special length values */
-#define SQL_NULL_DATA		(-1)
-#define SQL_DATA_AT_EXEC	(-2)
-#define SQL_NTS				(-3)
+# define SQL_NULL_DATA			(-1)
+# define SQL_DATA_AT_EXEC		(-2)
+# define SQL_NTS 			(-3)
 
 /* SQLFreeStmt flag values */
-#define SQL_CLOSE			0
-#define SQL_DROP			1
-#define SQL_UNBIND			2
-#define SQL_RESET_PARAMS	3
+# define SQL_CLOSE			0
+# define SQL_DROP			1
+# define SQL_UNBIND			2
+# define SQL_RESET_PARAMS		3
 
 /* SQLTransact flag values */
-#define SQL_COMMIT			0
-#define SQL_ROLLBACK		1
+# define SQL_COMMIT			0
+# define SQL_ROLLBACK			1
 
 /* SQLColAttributes flag values */
-#define SQL_COLUMN_COUNT	0
-#define SQL_COLUMN_LABEL	18
-#define SQL_COLATT_OPT_MAX	SQL_COLUMN_LABEL
-#define SQL_COLUMN_DRIVER_START    1000
+# define SQL_COLUMN_COUNT            	0
+# define SQL_COLUMN_LABEL		18
+# define SQL_COLATT_OPT_MAX		SQL_COLUMN_LABEL
+# define SQL_COLUMN_DRIVER_START	1000
 
-#define SQL_COLATT_OPT_MIN	SQL_COLUMN_COUNT
+# define SQL_COLATT_OPT_MIN		SQL_COLUMN_COUNT
 
 /* Null handles */
-#define SQL_NULL_HENV		0
-#define SQL_NULL_HDBC		0
-#define SQL_NULL_HSTMT		0
+# define SQL_NULL_HENV			0
+# define SQL_NULL_HDBC			0
+# define SQL_NULL_HSTMT			0
 
 /* All code below has been added to the original isql.h coming from iodbc */
-typedef unsigned char BYTE;
+typedef unsigned char	BYTE;
 
 /* More SQLColAttributes flag values */
-#define SQL_COLUMN_NAME				1
-#define SQL_COLUMN_TYPE				2
-#define SQL_COLUMN_LENGTH			3
+#define SQL_COLUMN_NAME			1
+#define SQL_COLUMN_TYPE			2
+#define SQL_COLUMN_LENGTH		3
 #define SQL_COLUMN_PRECISION		4
-#define SQL_COLUMN_SCALE			5
+#define SQL_COLUMN_SCALE		5
 #define SQL_COLUMN_DISPLAY_SIZE		6
-#define SQL_COLUMN_NULLABLE			7
-#define SQL_COLUMN_UNSIGNED			8
-#define SQL_COLUMN_MONEY			9
+#define SQL_COLUMN_NULLABLE		7
+#define SQL_COLUMN_UNSIGNED		8
+#define SQL_COLUMN_MONEY		9
 #define SQL_COLUMN_UPDATABLE		10
 #define SQL_COLUMN_AUTO_INCREMENT	11
 #define SQL_COLUMN_CASE_SENSITIVE	12
@@ -114,118 +114,124 @@ typedef unsigned char BYTE;
 #define SQL_COLUMN_QUALIFIER_NAME	17
 
 /* SQLColAttributes Searchable flags */
-#define SQL_UNSEARCHABLE			0
-#define SQL_LIKE_ONLY				1
-#define SQL_ALL_EXCEPT_LIKE			2
-#define SQL_SEARCHABLE				3
-#define SQL_PRED_SEARCHABLE			SQL_SEARCHABLE
+#define SQL_UNSEARCHABLE	0
+#define SQL_LIKE_ONLY		1
+#define SQL_ALL_EXCEPT_LIKE	2
+#define SQL_SEARCHABLE		3
+#define SQL_PRED_SEARCHABLE	SQL_SEARCHABLE
 
 /* SQLColAttributes Updateable flags */
-#define SQL_ATTR_READONLY			0
-#define SQL_ATTR_WRITE				1
+#define SQL_ATTR_READONLY		0
+#define SQL_ATTR_WRITE			1
 #define SQL_ATTR_READWRITE_UNKNOWN	2
 
 /*
- *	function prototypes previously not contained in isql.h
+ *  function prototypes previously not contained in isql.h
  */
 #ifdef __cplusplus
-extern		"C"
+extern "C"
 {
 #endif
 
-	RETCODE SQL_API SQLAllocConnect(HENV henv, HDBC FAR *phdbc);
-	RETCODE SQL_API SQLAllocEnv(HENV FAR *phenv);
-	RETCODE SQL_API SQLAllocStmt(HDBC hdbc, HSTMT FAR *phstmt);
-	RETCODE SQL_API SQLBindCol(HSTMT hstmt,
-										   UWORD icol,
-										   SWORD fCType,
-										   PTR rgbValue,
-										   SDWORD cbValueMax,
-										   SDWORD FAR *pcbValue);
-
-	RETCODE SQL_API SQLCancel(HSTMT hstmt);
-
-	RETCODE SQL_API SQLColAttributes(HSTMT hstmt,
-												 UWORD icol,
-												 UWORD fDescType,
-												 PTR rgbDesc,
-												 SWORD cbDescMax,
-												 SWORD FAR *pcbDesc,
-												 SDWORD FAR *pfDesc);
-
-	RETCODE SQL_API SQLConnect(HDBC hdbc,
-										   UCHAR FAR *szDSN,
-										   SWORD cbDSN,
-										   UCHAR FAR *szUID,
-										   SWORD cbUID,
-										   UCHAR FAR *szAuthStr,
-										   SWORD cbAuthStr);
-
-	RETCODE SQL_API SQLDescribeCol(HSTMT hstmt,
-											   UWORD icol,
-											   UCHAR FAR *szColName,
-											   SWORD cbColNameMax,
-											   SWORD FAR *pcbColName,
-											   SWORD FAR *pfSqlType,
-											   UDWORD FAR *pcbColDef,
-											   SWORD FAR *pibScale,
-											   SWORD FAR *pfNullable);
-
-	RETCODE SQL_API SQLDisconnect(HDBC hdbc);
-
-	RETCODE SQL_API SQLError(HENV henv,
-										 HDBC hdbc,
-										 HSTMT hstmt,
-										 UCHAR FAR *szSqlState,
-										 SDWORD FAR *pfNativeError,
-										 UCHAR FAR *szErrorMsg,
-										 SWORD cbErrorMsgMax,
-										 SWORD FAR *pcbErrorMsg);
-
-	RETCODE SQL_API SQLExecDirect(HSTMT hstmt,
-											  UCHAR FAR *szSqlStr,
-											  SDWORD cbSqlStr);
-
-	RETCODE SQL_API SQLExecute(HSTMT hstmt);
-
-	RETCODE SQL_API SQLFetch(HSTMT hstmt);
-
-	RETCODE SQL_API SQLFreeConnect(HDBC hdbc);
-
-	RETCODE SQL_API SQLFreeEnv(HENV henv);
-
-	RETCODE SQL_API SQLFreeStmt(HSTMT hstmt,
-											UWORD fOption);
-
-	RETCODE SQL_API SQLGetCursorName(HSTMT hstmt,
-												 UCHAR FAR *szCursor,
-												 SWORD cbCursorMax,
-												 SWORD FAR *pcbCursor);
-
-	RETCODE SQL_API SQLNumResultCols(HSTMT hstmt, SWORD FAR *pccol);
-
-	RETCODE SQL_API SQLPrepare(HSTMT hstmt, UCHAR FAR *szSqlStr,
-										   SDWORD cbSqlStr);
-
-	RETCODE SQL_API SQLRowCount(HSTMT hstmt, SDWORD FAR *pcrow);
-
-	RETCODE SQL_API SQLSetCursorName(HSTMT hstmt, UCHAR FAR *szCursor,
-												 SWORD cbCursor);
-
-	RETCODE SQL_API SQLTransact(HENV henv, HDBC hdbc,
-											UWORD fType);
-
-	RETCODE SQL_API SQLSetParam(HSTMT hstmt,
-											UWORD ipar,
-											SWORD fCType,
-											SWORD fSqlType,
-											UDWORD cbColDef,
-											SWORD ibScale,
-											PTR rgbValue,
-											SDWORD FAR *pcbValue);
+RETCODE SQL_API SQLAllocConnect (HENV henv,
+	HDBC FAR * phdbc);
+RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv);
+RETCODE SQL_API SQLAllocStmt (HDBC hdbc,
+	HSTMT FAR * phstmt);
+RETCODE SQL_API SQLBindCol (HSTMT hstmt,
+	UWORD icol,
+	SWORD fCType,
+	PTR rgbValue,
+	SDWORD cbValueMax,
+	SDWORD FAR * pcbValue);
+
+RETCODE SQL_API SQLCancel (HSTMT hstmt);
+
+RETCODE SQL_API SQLColAttributes (HSTMT hstmt,
+	UWORD icol,
+	UWORD fDescType,
+	PTR rgbDesc,
+	SWORD cbDescMax,
+	SWORD FAR * pcbDesc,
+	SDWORD FAR * pfDesc);
+
+RETCODE SQL_API SQLConnect (HDBC hdbc,
+	UCHAR FAR * szDSN,
+	SWORD cbDSN,
+	UCHAR FAR * szUID,
+	SWORD cbUID,
+	UCHAR FAR * szAuthStr,
+	SWORD cbAuthStr);
+
+RETCODE SQL_API SQLDescribeCol (HSTMT hstmt,
+	UWORD icol,
+	UCHAR FAR * szColName,
+	SWORD cbColNameMax,
+	SWORD FAR * pcbColName,
+	SWORD FAR * pfSqlType,
+	UDWORD FAR * pcbColDef,
+	SWORD FAR * pibScale,
+	SWORD FAR * pfNullable);
+
+RETCODE SQL_API SQLDisconnect (HDBC hdbc);
+
+RETCODE SQL_API SQLError (HENV henv,
+	HDBC hdbc,
+	HSTMT hstmt,
+	UCHAR FAR * szSqlState,
+	SDWORD FAR * pfNativeError,
+	UCHAR FAR * szErrorMsg,
+	SWORD cbErrorMsgMax,
+	SWORD FAR * pcbErrorMsg);
+
+RETCODE SQL_API SQLExecDirect (HSTMT hstmt,
+	UCHAR FAR * szSqlStr,
+	SDWORD cbSqlStr);
+
+RETCODE SQL_API SQLExecute (HSTMT hstmt);
+
+RETCODE SQL_API SQLFetch (HSTMT hstmt);
+
+RETCODE SQL_API SQLFreeConnect (HDBC hdbc);
+
+RETCODE SQL_API SQLFreeEnv (HENV henv);
+
+RETCODE SQL_API SQLFreeStmt (HSTMT hstmt,
+	UWORD fOption);
+
+RETCODE SQL_API SQLGetCursorName (HSTMT hstmt,
+	UCHAR FAR * szCursor,
+	SWORD cbCursorMax,
+	SWORD FAR * pcbCursor);
+
+RETCODE SQL_API SQLNumResultCols (HSTMT hstmt,
+	SWORD FAR * pccol);
+
+RETCODE SQL_API SQLPrepare (HSTMT hstmt,
+	UCHAR FAR * szSqlStr,
+	SDWORD cbSqlStr);
+
+RETCODE SQL_API SQLRowCount (HSTMT hstmt,
+	SDWORD FAR * pcrow);
+
+RETCODE SQL_API SQLSetCursorName (HSTMT hstmt,
+	UCHAR FAR * szCursor,
+	SWORD cbCursor);
+
+RETCODE SQL_API SQLTransact (HENV henv,
+	HDBC hdbc,
+	UWORD fType);
+
+RETCODE SQL_API SQLSetParam (HSTMT hstmt,
+	UWORD ipar,
+	SWORD fCType,
+	SWORD fSqlType,
+	UDWORD cbColDef,
+	SWORD ibScale,
+	PTR rgbValue,
+	SDWORD FAR * pcbValue);
 
 #ifdef __cplusplus
 }
-
-#endif
 #endif
+#endif  
diff --git a/src/interfaces/odbc/isqlext.h b/src/interfaces/odbc/isqlext.h
index 3ff4f02b9c68e3f50c9748d9a001000f7aff5170..b14b15af198a14eeee0e20db81633ebc843fff22 100644
--- a/src/interfaces/odbc/isqlext.h
+++ b/src/interfaces/odbc/isqlext.h
@@ -2,339 +2,339 @@
 * missing function prototypes and appropriate #defines. It is designed
 * to be a drop in replacement for isqlext.h from iodbc.
 */
-#ifndef _INTRINSIC_SQLEXT_H
-#define _INTRINSIC_SQLEXT_H
+#ifndef	_INTRINSIC_SQLEXT_H
+# define _INTRINSIC_SQLEXT_H
 
-#include "isql.h"
+# include "isql.h"
 
-#define SQL_STILL_EXECUTING		2
-#define SQL_NEED_DATA			99
+# define SQL_STILL_EXECUTING 		2
+# define SQL_NEED_DATA			99
 
 /* extend SQL datatypes */
-#define SQL_DATE				9
-#define SQL_TIME				10
-#define SQL_TIMESTAMP			11
-#define SQL_LONGVARCHAR			(-1)
-#define SQL_BINARY				(-2)
-#define SQL_VARBINARY			(-3)
-#define SQL_LONGVARBINARY		(-4)
-#define SQL_BIGINT				(-5)
-#define SQL_TINYINT				(-6)
-#define SQL_BIT					(-7)	/* conflict with SQL3 ??? */
-#define SQL_TYPE_DRIVER_START	(-80)
+# define SQL_DATE			9
+# define SQL_TIME			10
+# define SQL_TIMESTAMP			11
+# define SQL_LONGVARCHAR 		(-1)
+# define SQL_BINARY			(-2)
+# define SQL_VARBINARY			(-3)
+# define SQL_LONGVARBINARY		(-4)
+# define SQL_BIGINT			(-5)
+# define SQL_TINYINT 			(-6)
+# define SQL_BIT 			(-7)	/* conflict with SQL3 ??? */
+# define SQL_TYPE_DRIVER_START		(-80)
 
 /* C to SQL datatype mapping */
-#define SQL_C_DATE				SQL_DATE
-#define SQL_C_TIME				SQL_TIME
-#define SQL_C_TIMESTAMP			SQL_TIMESTAMP
-#define SQL_C_BINARY			SQL_BINARY
-#define SQL_C_BIT				SQL_BIT
-#define SQL_C_TINYINT			SQL_TINYINT
-
-#define SQL_SIGNED_OFFSET		(-20)
-#define SQL_UNSIGNED_OFFSET		(-22)
-
-#define SQL_C_SLONG				(SQL_C_LONG + SQL_SIGNED_OFFSET)
-#define SQL_C_SSHORT			(SQL_C_SHORT + SQL_SIGNED_OFFSET)
-#define SQL_C_STINYINT			(SQL_TINYINT + SQL_SIGNED_OFFSET)
-#define SQL_C_ULONG				(SQL_C_LONG + SQL_UNSIGNED_OFFSET)
-#define SQL_C_USHORT			(SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
-#define SQL_C_UTINYINT			(SQL_TINYINT + SQL_UNSIGNED_OFFSET)
-#define SQL_C_BOOKMARK			SQL_C_ULONG
-
-#if defined(SQL_TYPE_MIN)
-#undef	SQL_TYPE_MIN
-#define SQL_TYPE_MIN			SQL_BIT
-/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
- *	SQL_TYPE_MIN need to be defined as SQL_TINYINT
+# define SQL_C_DATE			SQL_DATE
+# define SQL_C_TIME			SQL_TIME
+# define SQL_C_TIMESTAMP 		SQL_TIMESTAMP
+# define SQL_C_BINARY			SQL_BINARY
+# define SQL_C_BIT			SQL_BIT
+# define SQL_C_TINYINT			SQL_TINYINT
+
+# define SQL_SIGNED_OFFSET		(-20)
+# define SQL_UNSIGNED_OFFSET		(-22)
+
+# define SQL_C_SLONG			(SQL_C_LONG  + SQL_SIGNED_OFFSET)
+# define SQL_C_SSHORT			(SQL_C_SHORT + SQL_SIGNED_OFFSET)
+# define SQL_C_STINYINT			(SQL_TINYINT + SQL_SIGNED_OFFSET)
+# define SQL_C_ULONG 			(SQL_C_LONG  + SQL_UNSIGNED_OFFSET)
+# define SQL_C_USHORT			(SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
+# define SQL_C_UTINYINT			(SQL_TINYINT + SQL_UNSIGNED_OFFSET)
+# define SQL_C_BOOKMARK			SQL_C_ULONG 			
+
+# if defined(SQL_TYPE_MIN)
+#   undef  SQL_TYPE_MIN  
+#   define SQL_TYPE_MIN			SQL_BIT	
+/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then, 
+ *	SQL_TYPE_MIN need to be defined as SQL_TINYINT 
  *	(i.e. -6).
  */
-#endif
+# endif
 
-#define SQL_ALL_TYPES			0
+# define SQL_ALL_TYPES			0
 
 /* SQLDriverConnect flag values */
-#define SQL_DRIVER_NOPROMPT		0
-#define SQL_DRIVER_COMPLETE		1
-#define SQL_DRIVER_PROMPT		2
-#define SQL_DRIVER_COMPLETE_REQUIRED   3
+# define SQL_DRIVER_NOPROMPT		0
+# define SQL_DRIVER_COMPLETE		1
+# define SQL_DRIVER_PROMPT		2
+# define SQL_DRIVER_COMPLETE_REQUIRED	3
 
 /* SQLSetParam extensions */
-#define SQL_DEFAULT_PARAM		(-5)
-#define SQL_IGNORE				(-6)
+# define SQL_DEFAULT_PARAM		(-5)
+# define SQL_IGNORE			(-6)
 
 /* function number for SQLGetFunctions and _iodbcdm_getproc */
-#define SQL_API_SQLALLOCCONNECT		1
-#define SQL_API_SQLALLOCENV			2
-#define SQL_API_SQLALLOCSTMT		3
-#define SQL_API_SQLBINDCOL			4
-#define SQL_API_SQLCANCEL			5
-#define SQL_API_SQLCOLATTRIBUTES	6
-#define SQL_API_SQLCONNECT			7
-#define SQL_API_SQLDESCRIBECOL		8
-#define SQL_API_SQLDISCONNECT		9
-#define SQL_API_SQLERROR			10
-#define SQL_API_SQLEXECDIRECT		11
-#define SQL_API_SQLEXECUTE			12
-#define SQL_API_SQLFETCH			13
-#define SQL_API_SQLFREECONNECT		14
-#define SQL_API_SQLFREEENV			15
-#define SQL_API_SQLFREESTMT			16
-#define SQL_API_SQLGETCURSORNAME	17
-#define SQL_API_SQLNUMRESULTCOLS	18
-#define SQL_API_SQLPREPARE			19
-#define SQL_API_SQLROWCOUNT			20
-#define SQL_API_SQLSETCURSORNAME	21
-#define SQL_API_SQLSETPARAM			22
-#define SQL_API_SQLTRANSACT			23
-
-#define SQL_NUM_FUNCTIONS			23
-
-#define SQL_EXT_API_START			40
-
-#define SQL_API_SQLCOLUMNS			40
-
-#define SQL_API_SQLDRIVERCONNECT	41
-#define SQL_API_SQLGETCONNECTOPTION 42
-#define SQL_API_SQLGETDATA			43
-#define SQL_API_SQLGETFUNCTIONS		44
-#define SQL_API_SQLGETINFO			45
-#define SQL_API_SQLGETSTMTOPTION	46
-#define SQL_API_SQLGETTYPEINFO		47
-#define SQL_API_SQLPARAMDATA		48
-#define SQL_API_SQLPUTDATA			49
-#define SQL_API_SQLSETCONNECTOPTION 50
-#define SQL_API_SQLSETSTMTOPTION	51
-#define SQL_API_SQLSPECIALCOLUMNS	52
-#define SQL_API_SQLSTATISTICS		53
-#define SQL_API_SQLTABLES			54
-
-#define SQL_API_SQLBROWSECONNECT	55
-#define SQL_API_SQLCOLUMNPRIVILEGES 56
-#define SQL_API_SQLDATASOURCES		57
-#define SQL_API_SQLDESCRIBEPARAM	58
-#define SQL_API_SQLEXTENDEDFETCH	59
-#define SQL_API_SQLFOREIGNKEYS		60
-#define SQL_API_SQLMORERESULTS		61
-#define SQL_API_SQLNATIVESQL		62
-#define SQL_API_SQLNUMPARAMS		63
-#define SQL_API_SQLPARAMOPTIONS		64
-#define SQL_API_SQLPRIMARYKEYS		65
-#define SQL_API_SQLPROCEDURECOLUMNS 66
-#define SQL_API_SQLPROCEDURES		67
-#define SQL_API_SQLSETPOS			68
-#define SQL_API_SQLSETSCROLLOPTIONS 69
-#define SQL_API_SQLTABLEPRIVILEGES	70
-
-#define SQL_API_SQLDRIVERS			71
-#define SQL_API_SQLBINDPARAMETER	72
-#define SQL_EXT_API_LAST	   		SQL_API_SQLBINDPARAMETER
-#define SQL_NUM_EXTENSIONS			(SQL_EXT_API_LAST - SQL_EXT_API_START + 1)
-
-#define SQL_API_ALL_FUNCTIONS		0
+# define SQL_API_SQLALLOCCONNECT	1   
+# define SQL_API_SQLALLOCENV		2
+# define SQL_API_SQLALLOCSTMT		3
+# define SQL_API_SQLBINDCOL		4
+# define SQL_API_SQLCANCEL		5
+# define SQL_API_SQLCOLATTRIBUTES	6
+# define SQL_API_SQLCONNECT		7
+# define SQL_API_SQLDESCRIBECOL		8
+# define SQL_API_SQLDISCONNECT		9
+# define SQL_API_SQLERROR		10
+# define SQL_API_SQLEXECDIRECT		11
+# define SQL_API_SQLEXECUTE		12
+# define SQL_API_SQLFETCH		13
+# define SQL_API_SQLFREECONNECT		14
+# define SQL_API_SQLFREEENV		15
+# define SQL_API_SQLFREESTMT		16 
+# define SQL_API_SQLGETCURSORNAME	17
+# define SQL_API_SQLNUMRESULTCOLS	18
+# define SQL_API_SQLPREPARE		19
+# define SQL_API_SQLROWCOUNT		20
+# define SQL_API_SQLSETCURSORNAME	21
+# define SQL_API_SQLSETPARAM		22
+# define SQL_API_SQLTRANSACT		23
+
+# define SQL_NUM_FUNCTIONS		23
+
+# define SQL_EXT_API_START		40
+
+# define SQL_API_SQLCOLUMNS		40
+
+# define SQL_API_SQLDRIVERCONNECT	41
+# define SQL_API_SQLGETCONNECTOPTION	42
+# define SQL_API_SQLGETDATA		43
+# define SQL_API_SQLGETFUNCTIONS	44
+# define SQL_API_SQLGETINFO		45
+# define SQL_API_SQLGETSTMTOPTION	46
+# define SQL_API_SQLGETTYPEINFO		47
+# define SQL_API_SQLPARAMDATA		48
+# define SQL_API_SQLPUTDATA		49
+# define SQL_API_SQLSETCONNECTOPTION	50
+# define SQL_API_SQLSETSTMTOPTION	51
+# define SQL_API_SQLSPECIALCOLUMNS	52
+# define SQL_API_SQLSTATISTICS		53
+# define SQL_API_SQLTABLES		54
+
+# define SQL_API_SQLBROWSECONNECT	55
+# define SQL_API_SQLCOLUMNPRIVILEGES	56
+# define SQL_API_SQLDATASOURCES		57
+# define SQL_API_SQLDESCRIBEPARAM	58
+# define SQL_API_SQLEXTENDEDFETCH	59
+# define SQL_API_SQLFOREIGNKEYS		60
+# define SQL_API_SQLMORERESULTS		61
+# define SQL_API_SQLNATIVESQL		62
+# define SQL_API_SQLNUMPARAMS		63
+# define SQL_API_SQLPARAMOPTIONS	64
+# define SQL_API_SQLPRIMARYKEYS		65
+# define SQL_API_SQLPROCEDURECOLUMNS	66
+# define SQL_API_SQLPROCEDURES		67
+# define SQL_API_SQLSETPOS		68
+# define SQL_API_SQLSETSCROLLOPTIONS	69
+# define SQL_API_SQLTABLEPRIVILEGES	70
+
+# define SQL_API_SQLDRIVERS          	71
+# define SQL_API_SQLBINDPARAMETER	72
+# define SQL_EXT_API_LAST		SQL_API_SQLBINDPARAMETER
+#define SQL_NUM_EXTENSIONS	(SQL_EXT_API_LAST - SQL_EXT_API_START + 1)
+
+# define SQL_API_ALL_FUNCTIONS		0
 
 /* SQLGetInfo infor number */
-#define SQL_INFO_FIRST				0
-#define SQL_DRIVER_HDBC				3
-#define SQL_DRIVER_HENV				4
-#define SQL_DRIVER_HSTMT			5
-#define SQL_DRIVER_NAME				6
-#define SQL_ODBC_VER				10
-#define SQL_CURSOR_COMMIT_BEHAVIOR	23
-#define SQL_CURSOR_ROLLBACK_BEHAVIOR	24
-#define SQL_DEFAULT_TXN_ISOLATION	26
+# define SQL_INFO_FIRST			0
+# define SQL_DRIVER_HDBC		3
+# define SQL_DRIVER_HENV		4
+# define SQL_DRIVER_HSTMT		5
+# define SQL_DRIVER_NAME		6
+# define SQL_ODBC_VER			10
+# define SQL_CURSOR_COMMIT_BEHAVIOR	23
+# define SQL_CURSOR_ROLLBACK_BEHAVIOR	24
+# define SQL_DEFAULT_TXN_ISOLATION	26
 
-#define SQL_TXN_ISOLATION_OPTION	72
-#define SQL_NON_NULLABLE_COLUMNS	75
+# define SQL_TXN_ISOLATION_OPTION	72
+# define SQL_NON_NULLABLE_COLUMNS	75
 
-#define SQL_DRIVER_HLIB				76
-#define SQL_DRIVER_ODBC_VER			77
+# define SQL_DRIVER_HLIB		76
+# define SQL_DRIVER_ODBC_VER		77
 
-#define SQL_QUALIFIER_LOCATION		114
+# define SQL_QUALIFIER_LOCATION		114
 
-#define SQL_INFO_LAST				SQL_QUALIFIER_LOCATION
+# define SQL_INFO_LAST			SQL_QUALIFIER_LOCATION
 
-#define SQL_INFO_DRIVER_START		1000
+# define SQL_INFO_DRIVER_START		1000
 
 
 /* SQL_TXN_ISOLATION_OPTION masks */
-#define SQL_TXN_READ_UNCOMMITTED	0x00000001L
-#define SQL_TXN_READ_COMMITTED		0x00000002L
-#define SQL_TXN_REPEATABLE_READ		0x00000004L
-#define SQL_TXN_SERIALIZABLE		0x00000008L
-#define SQL_TXN_VERSIONING			0x00000010L
+# define SQL_TXN_READ_UNCOMMITTED	0x00000001L
+# define SQL_TXN_READ_COMMITTED		0x00000002L
+# define SQL_TXN_REPEATABLE_READ 	0x00000004L
+# define SQL_TXN_SERIALIZABLE		0x00000008L
+# define SQL_TXN_VERSIONING		0x00000010L
 
 /* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
 
-#define SQL_CB_DELETE				0x0000
-#define SQL_CB_CLOSE				0x0001
-#define SQL_CB_PRESERVE				0x0002
+# define SQL_CB_DELETE			0x0000
+# define SQL_CB_CLOSE			0x0001
+# define SQL_CB_PRESERVE		0x0002
 
 /* options for SQLGetStmtOption/SQLSetStmtOption */
-#define SQL_QUERY_TIMEOUT			0
-#define SQL_MAX_ROWS				1
-#define SQL_NOSCAN					2
-#define SQL_MAX_LENGTH				3
-#define SQL_ASYNC_ENABLE			4
-#define SQL_BIND_TYPE				5
-#define SQL_CURSOR_TYPE				6
-#define SQL_CONCURRENCY				7
-#define SQL_KEYSET_SIZE				8
-#define SQL_ROWSET_SIZE				9
-#define SQL_SIMULATE_CURSOR			10
-#define SQL_RETRIEVE_DATA			11
-#define SQL_USE_BOOKMARKS			12
-#define SQL_GET_BOOKMARK			13	/* GetStmtOption Only */
-#define SQL_ROW_NUMBER				14	/* GetStmtOption Only */
-#define SQL_STMT_OPT_MAX			SQL_ROW_NUMBER
-
-#define SQL_STMT_OPT_MIN			SQL_QUERY_TIMEOUT
+# define SQL_QUERY_TIMEOUT		0
+# define SQL_MAX_ROWS			1
+# define SQL_NOSCAN			2
+# define SQL_MAX_LENGTH			3
+# define SQL_ASYNC_ENABLE		4
+# define SQL_BIND_TYPE			5
+# define SQL_CURSOR_TYPE 		6
+# define SQL_CONCURRENCY 		7
+# define SQL_KEYSET_SIZE 		8
+# define SQL_ROWSET_SIZE 		9
+# define SQL_SIMULATE_CURSOR 		10
+# define SQL_RETRIEVE_DATA		11
+# define SQL_USE_BOOKMARKS		12
+# define SQL_GET_BOOKMARK		13	/* GetStmtOption Only */
+# define SQL_ROW_NUMBER			14	/* GetStmtOption Only */
+# define SQL_STMT_OPT_MAX		SQL_ROW_NUMBER
+
+# define SQL_STMT_OPT_MIN		SQL_QUERY_TIMEOUT
 
 /*
  * ODBC 3.0 renames the above to SQL_ATTR_ values. At this time I don't
  * know if they have also been renumbered or not, I will assume not.
  */
-#define SQL_ATTR_QUERY_TIMEOUT			0
-#define SQL_ATTR_MAX_ROWS				1
-#define SQL_ATTR_NOSCAN					2
-#define SQL_ATTR_MAX_LENGTH				3
-#define SQL_ATTR_ASYNC_ENABLE			4
-#define SQL_ATTR_BIND_TYPE				5
-#define SQL_ATTR_CURSOR_TYPE			6
-#define SQL_ATTR_CONCURRENCY			7
-#define SQL_ATTR_KEYSET_SIZE			8
-#define SQL_ATTR_ROWSET_SIZE			9
-#define SQL_ATTR_SIMULATE_CURSOR		10
-#define SQL_ATTR_RETRIEVE_DATA			11
-#define SQL_ATTR_USE_BOOKMARKS			12
-#define SQL_ATTR_GET_BOOKMARK			13		/* GetStmtOption Only */
-#define SQL_ATTR_ROW_NUMBER				14		/* GetStmtOption Only */
+# define SQL_ATTR_QUERY_TIMEOUT		0
+# define SQL_ATTR_MAX_ROWS		1
+# define SQL_ATTR_NOSCAN		2
+# define SQL_ATTR_MAX_LENGTH		3
+# define SQL_ATTR_ASYNC_ENABLE		4
+# define SQL_ATTR_BIND_TYPE		5
+# define SQL_ATTR_CURSOR_TYPE 		6
+# define SQL_ATTR_CONCURRENCY 		7
+# define SQL_ATTR_KEYSET_SIZE 		8
+# define SQL_ATTR_ROWSET_SIZE 		9
+# define SQL_ATTR_SIMULATE_CURSOR 	10
+# define SQL_ATTR_RETRIEVE_DATA		11
+# define SQL_ATTR_USE_BOOKMARKS		12
+# define SQL_ATTR_GET_BOOKMARK		13	/* GetStmtOption Only */
+# define SQL_ATTR_ROW_NUMBER		14	/* GetStmtOption Only */
 
 /* New in ODBC 3.0	*/
-#define SQL_ATTR_APP_PARAM_DESC			15
-#define SQL_ATTR_APP_ROW_DESC			16
-#define SQL_ATTR_CURSOR_SCROLLABLE		17
-#define SQL_ATTR_CURSOR_SENSITITY		18
-#define SQL_ATTR_ENABLE_AUTO_IPD		19
-#define SQL_ATTR_FETCH_BOOKMARK_PTR		20
-#define SQL_ATTR_IMP_PARAM_DESC			21
-#define SQL_ATTR_IMP_ROW_DESC			22
-#define SQL_ATTR_METADATA_ID			23
+#define SQL_ATTR_APP_PARAM_DESC		15
+#define SQL_ATTR_APP_ROW_DESC		16
+#define SQL_ATTR_CURSOR_SCROLLABLE	17
+#define SQL_ATTR_CURSOR_SENSITITY	18
+#define SQL_ATTR_ENABLE_AUTO_IPD	19
+#define SQL_ATTR_FETCH_BOOKMARK_PTR	20
+#define SQL_ATTR_IMP_PARAM_DESC		21
+#define SQL_ATTR_IMP_ROW_DESC		22
+#define SQL_ATTR_METADATA_ID		23
 #define SQL_ATTR_PARAM_BIND_OFFSET_PTR	24
-#define SQL_ATTR_PARAM_BIND_TYPE		25
+#define SQL_ATTR_PARAM_BIND_TYPE	25
 #define SQL_ATTR_PARAM_OPERATION_PTR	26
-#define SQL_ATTR_PARAM_STATUS_PTR		27
+#define SQL_ATTR_PARAM_STATUS_PTR	27
 #define SQL_ATTR_PARAMS_PROCESSED_PTR	28
-#define SQL_ATTR_PARAMSET_SIZE			29
-#define SQL_ATTR_ROW_ARRAY_SIZE			30
+#define SQL_ATTR_PARAMSET_SIZE		29
+#define SQL_ATTR_ROW_ARRAY_SIZE		30
 #define SQL_ATTR_ROW_BIND_OFFSET_PTR	31
-#define SQL_ATTR_ROW_OPERATION_PTR		32
-#define SQL_ATTR_ROW_STATUS_PTR			33
-#define SQL_ATTR_ROWS_FETCHED_PTR		34
+#define SQL_ATTR_ROW_OPERATION_PTR	32
+#define SQL_ATTR_ROW_STATUS_PTR		33
+#define SQL_ATTR_ROWS_FETCHED_PTR	34
 
-#define SQL_STMT_ATTR_MIN			SQL_ATTR_QUERY_TIMEOUT
-#define SQL_STMT_ATTR_MAX			SQL_ATTR_ROWS_FETCHED_PTR
+#define SQL_STMT_ATTR_MIN		SQL_ATTR_QUERY_TIMEOUT
+#define SQL_STMT_ATTR_MAX		SQL_ATTR_ROWS_FETCHED_PTR
 
 /* SQL_QUERY_TIMEOUT options */
-#define SQL_QUERY_TIMEOUT_DEFAULT  0UL
+# define SQL_QUERY_TIMEOUT_DEFAULT	0UL
 
 /* SQL_MAX_ROWS options */
-#define SQL_MAX_ROWS_DEFAULT	   0UL
+# define SQL_MAX_ROWS_DEFAULT		0UL
 
 /* SQL_MAX_LENGTH options */
-#define SQL_MAX_LENGTH_DEFAULT	   0UL
+# define SQL_MAX_LENGTH_DEFAULT		0UL
 
 /* SQL_CONCURRENCY options */
-#define SQL_CONCUR_READ_ONLY		1
-#define SQL_CONCUR_LOCK				2
-#define SQL_CONCUR_ROWVER			3
-#define SQL_CONCUR_VALUES			4
+# define SQL_CONCUR_READ_ONLY		1
+# define SQL_CONCUR_LOCK 		2
+# define SQL_CONCUR_ROWVER		3
+# define SQL_CONCUR_VALUES		4
 
 /* options for SQLSetConnectOption/SQLGetConnectOption */
-#define SQL_ACCESS_MODE				101
-#define SQL_AUTOCOMMIT				102
-#define SQL_LOGIN_TIMEOUT			103
-#define SQL_OPT_TRACE				104
-#define SQL_OPT_TRACEFILE			105
-#define SQL_TRANSLATE_DLL			106
-#define SQL_TRANSLATE_OPTION		107
-#define SQL_TXN_ISOLATION			108
-#define SQL_CURRENT_QUALIFIER		109
-#define SQL_ODBC_CURSORS			110
-#define SQL_QUIET_MODE				111
-#define SQL_PACKET_SIZE				112
-#define SQL_CONN_OPT_MAX			SQL_PACKET_SIZE
-#define SQL_CONNECT_OPT_DRVR_START	1000
-
-#define SQL_CONN_OPT_MIN			SQL_ACCESS_MODE
+# define SQL_ACCESS_MODE 		101
+# define SQL_AUTOCOMMIT			102
+# define SQL_LOGIN_TIMEOUT		103
+# define SQL_OPT_TRACE			104
+# define SQL_OPT_TRACEFILE		105
+# define SQL_TRANSLATE_DLL		106
+# define SQL_TRANSLATE_OPTION		107
+# define SQL_TXN_ISOLATION		108
+# define SQL_CURRENT_QUALIFIER		109
+# define SQL_ODBC_CURSORS		110
+# define SQL_QUIET_MODE			111
+# define SQL_PACKET_SIZE 		112
+# define SQL_CONN_OPT_MAX		SQL_PACKET_SIZE
+# define SQL_CONNECT_OPT_DRVR_START	1000
+
+# define SQL_CONN_OPT_MIN		SQL_ACCESS_MODE
 
 /* SQL_ACCESS_MODE options */
-#define SQL_MODE_READ_WRITE			0UL
-#define SQL_MODE_READ_ONLY			1UL
-#define SQL_MODE_DEFAULT			SQL_MODE_READ_WRITE
+# define SQL_MODE_READ_WRITE 		0UL
+# define SQL_MODE_READ_ONLY		1UL
+# define SQL_MODE_DEFAULT		SQL_MODE_READ_WRITE
 
 /* SQL_AUTOCOMMIT options */
-#define SQL_AUTOCOMMIT_OFF			0UL
-#define SQL_AUTOCOMMIT_ON			1UL
-#define SQL_AUTOCOMMIT_DEFAULT		SQL_AUTOCOMMIT_ON
+# define SQL_AUTOCOMMIT_OFF		0UL
+# define SQL_AUTOCOMMIT_ON		1UL
+# define SQL_AUTOCOMMIT_DEFAULT		SQL_AUTOCOMMIT_ON
 
 /* SQL_LOGIN_TIMEOUT options */
-#define SQL_LOGIN_TIMEOUT_DEFAULT	15UL
+# define SQL_LOGIN_TIMEOUT_DEFAULT	15UL
 
 /* SQL_OPT_TRACE options */
-#define SQL_OPT_TRACE_OFF			0UL
-#define SQL_OPT_TRACE_ON			1UL
-#define SQL_OPT_TRACE_DEFAULT		SQL_OPT_TRACE_OFF
-#define SQL_OPT_TRACE_FILE_DEFAULT	"odbc.log"
+# define SQL_OPT_TRACE_OFF		0UL
+# define SQL_OPT_TRACE_ON		1UL
+# define SQL_OPT_TRACE_DEFAULT		SQL_OPT_TRACE_OFF
+# define SQL_OPT_TRACE_FILE_DEFAULT	"odbc.log"
 
 /* SQL_ODBC_CURSORS options */
-#define SQL_CUR_USE_IF_NEEDED		0UL
-#define SQL_CUR_USE_ODBC			1UL
-#define SQL_CUR_USE_DRIVER			2UL
-#define SQL_CUR_DEFAULT				SQL_CUR_USE_DRIVER
+# define SQL_CUR_USE_IF_NEEDED		0UL
+# define SQL_CUR_USE_ODBC		1UL
+# define SQL_CUR_USE_DRIVER		2UL
+# define SQL_CUR_DEFAULT 		SQL_CUR_USE_DRIVER
 
 /* Column types and scopes in SQLSpecialColumns. */
-#define SQL_BEST_ROWID				1
-#define SQL_ROWVER					2
+# define SQL_BEST_ROWID			1
+# define SQL_ROWVER			2
 
-#define SQL_SCOPE_CURROW			0
-#define SQL_SCOPE_TRANSACTION		1
-#define SQL_SCOPE_SESSION			2
+# define SQL_SCOPE_CURROW		0
+# define SQL_SCOPE_TRANSACTION		1
+# define SQL_SCOPE_SESSION		2
 
 
 /* SQLExtendedFetch flag values */
-#define SQL_FETCH_NEXT				1
-#define SQL_FETCH_FIRST				2
-#define SQL_FETCH_LAST				3
-#define SQL_FETCH_PRIOR				4
-#define SQL_FETCH_ABSOLUTE			5
-#define SQL_FETCH_RELATIVE			6
-#define SQL_FETCH_BOOKMARK			8
+# define SQL_FETCH_NEXT			1
+# define SQL_FETCH_FIRST 		2
+# define SQL_FETCH_LAST			3
+# define SQL_FETCH_PRIOR		4
+# define SQL_FETCH_ABSOLUTE		5
+# define SQL_FETCH_RELATIVE		6
+# define SQL_FETCH_BOOKMARK		8
 
 /* Defines for SQLBindParameter/SQLProcedureColumns */
 #define SQL_PARAM_TYPE_UNKNOWN		0
-#define SQL_PARAM_INPUT				1
+#define SQL_PARAM_INPUT			1
 #define SQL_PARAM_INPUT_OUTPUT		2
-#define SQL_RESULT_COL				3
-#define SQL_PARAM_OUTPUT			4
-#define SQL_RETURN_VALUE			5
+#define SQL_RESULT_COL			3
+#define SQL_PARAM_OUTPUT		4
+#define SQL_RETURN_VALUE		5
 
 /* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
-#define SQL_PARAM_TYPE_DEFAULT		SQL_PARAM_INPUT_OUTPUT
-#define SQL_SETPARAM_VALUE_MAX		(-1L)
+# define SQL_PARAM_TYPE_DEFAULT		SQL_PARAM_INPUT_OUTPUT
+# define SQL_SETPARAM_VALUE_MAX		(-1L)
 
 /* SQLStatistics flag values */
-#define SQL_INDEX_UNIQUE			0
-#define SQL_INDEX_ALL				1
+# define SQL_INDEX_UNIQUE		0
+# define SQL_INDEX_ALL			1
 
-#define SQL_QUICK					0
-#define SQL_ENSURE					1
+# define SQL_QUICK			0
+# define SQL_ENSURE			1
 
 /* SQLSetScrollOption flag values */
-#define SQL_SCROLL_FORWARD_ONLY		0L
-#define SQL_SCROLL_KEYSET_DRIVEN	(-1L)
-#define SQL_SCROLL_DYNAMIC			(-2L)
-#define SQL_SCROLL_STATIC			(-3L)
+# define SQL_SCROLL_FORWARD_ONLY	0L
+# define SQL_SCROLL_KEYSET_DRIVEN	(-1L)
+# define SQL_SCROLL_DYNAMIC		(-2L)
+# define SQL_SCROLL_STATIC		(-3L) 
 
 /* Everything below has been added to the original isqlext.h that comes
  * with iodbc.
@@ -345,67 +345,58 @@
 #define DOUBLE	double
 
 /* SQL DATA TYPES */
-typedef UCHAR SQLCHAR;
-typedef SWORD SQLSMALLINT;
-typedef UWORD SQLUSMALLINT;
-typedef SDWORD SQLINTEGER;
-typedef UDWORD SQLUINTEGER;
-typedef FLOAT SQLREAL;
-typedef DOUBLE SQLDOUBLE;
-typedef DOUBLE SQLFLOAT;
-typedef SCHAR SQLSCHAR;
-typedef UDWORD BOOKMARK;
-
-#ifdef GCC						/* Because I know GCC supports 64 bit ints */
+typedef	UCHAR	SQLCHAR;
+typedef SWORD	SQLSMALLINT;
+typedef UWORD	SQLUSMALLINT;
+typedef SDWORD	SQLINTEGER;
+typedef UDWORD	SQLUINTEGER;
+typedef FLOAT	SQLREAL;
+typedef DOUBLE	SQLDOUBLE;
+typedef DOUBLE	SQLFLOAT;
+typedef SCHAR	SQLSCHAR;
+typedef UDWORD	BOOKMARK;
+
+#ifdef GCC	/* Because I know GCC supports 64 bit ints */
 
 typedef long long int ODBCINT64;
-typedef unsigned ODBCINT64 SQLUBIGINT;
-typedef ODBCINT64 SQLBIGINT;
+typedef unsigned ODBCINT64	SQLUBIGINT;
+typedef ODBCINT64		SQLBIGINT;
 
-#else							/* Used even on platforms with 64 bit ints
-								 * but not GCC */
+#else		/* Used even on platforms with 64 bit ints but not GCC */
 
-typedef struct
-{
+typedef struct {
 	SQLUINTEGER dwLowWord;
 	SQLUINTEGER dwHighWord;
 } SQLUBIGINT;
 
-typedef struct
-{
+typedef struct {
 	SQLUINTEGER dwLowWord;
-	SQLINTEGER	dwHighWord;
+	SQLINTEGER  dwHighWord;
 } SQLBIGINT;
 
-#endif	 /* GCC */
-
-typedef struct tagDATE_STRUCT
-{
-	SQLSMALLINT year;
-	SQLUSMALLINT month;
-	SQLUSMALLINT day;
-} DATE_STRUCT,
-SQL_DATE_STRUCT;
-
-typedef struct tagTIME_STRUCT
-{
-	SQLUSMALLINT hour;
-	SQLUSMALLINT minute;
-	SQLUSMALLINT second;
-} TIME_STRUCT,
-SQL_TIME_STRUCT;
-
-typedef struct tagTIMESTAMP_STRUCT
-{
-	SQLSMALLINT year;
-	SQLUSMALLINT month;
-	SQLUSMALLINT day;
-	SQLUSMALLINT hour;
-	SQLUSMALLINT minute;
-	SQLUSMALLINT second;
-	SQLUINTEGER fraction;
-} TIMESTAMP_STRUCT,
-SQL_TIMESTAMP_STRUCT;
+#endif /* GCC */
+
+typedef struct tagDATE_STRUCT {
+	SQLSMALLINT	year;
+	SQLUSMALLINT	month;
+	SQLUSMALLINT	day;
+} DATE_STRUCT,SQL_DATE_STRUCT;
+
+typedef struct tagTIME_STRUCT {
+	SQLUSMALLINT	hour;
+	SQLUSMALLINT	minute;
+	SQLUSMALLINT	second;
+} TIME_STRUCT,SQL_TIME_STRUCT;
+
+typedef struct tagTIMESTAMP_STRUCT {
+	SQLSMALLINT	year;
+	SQLUSMALLINT	month;
+	SQLUSMALLINT	day;
+	SQLUSMALLINT	hour;
+	SQLUSMALLINT	minute;
+	SQLUSMALLINT	second;
+	SQLUINTEGER	fraction;
+} TIMESTAMP_STRUCT,SQL_TIMESTAMP_STRUCT;
 
 /* postodbc doesn't use these but what the heck */
 /* Don't know what SQL_MAX_NUMERIC_LEN should be so I can't include this. It's
@@ -420,16 +411,14 @@ typedef struct tagSQL_NUMERIC_STRUCT {
 
 */
 
-typedef struct tagSQLGUID
-{
-	DWORD		Data1;
-	WORD		Data2;
-	WORD		Data3;
-	BYTE		Data4[8];
+typedef struct tagSQLGUID {
+	DWORD	Data1;
+	WORD	Data2;
+	WORD	Data3;
+	BYTE	Data4[8];
 } SQLGUID;
 
-typedef enum
-{
+typedef enum {
 	SQL_IS_YEAR = 1,
 	SQL_IS_MONTH = 2,
 	SQL_IS_DAY = 3,
@@ -445,30 +434,26 @@ typedef enum
 	SQL_IS_MINUTE_TO_SECOND = 13
 } SQLINTERVAL;
 
-typedef struct tagSQL_YEAR_MONTH
-{
-	SQLUINTEGER year;
-	SQLUINTEGER month;
+typedef struct tagSQL_YEAR_MONTH {
+	SQLUINTEGER	year;
+	SQLUINTEGER	month;
 } SQL_YEAR_MONTH_STRUCT;
 
-typedef struct tagSQL_DAY_SECOND
-{
-	SQLUINTEGER day;
-	SQLUINTEGER hour;
-	SQLUINTEGER minute;
-	SQLUINTEGER second;
-	SQLUINTEGER fraction;
+typedef struct tagSQL_DAY_SECOND {
+	SQLUINTEGER	day;
+	SQLUINTEGER	hour;
+	SQLUINTEGER	minute;
+	SQLUINTEGER	second;
+	SQLUINTEGER	fraction;
 } SQL_DAY_SECOND_STRUCT;
 
-typedef struct tagSQL_INTERVAL_STRUCT
-{
-	SQLINTERVAL interval_type;
-	SQLSMALLINT interval_sign;
-	union
-	{
-		SQL_YEAR_MONTH_STRUCT year_month;
-		SQL_DAY_SECOND_STRUCT day_second;
-	}			intval;
+typedef struct tagSQL_INTERVAL_STRUCT {
+	SQLINTERVAL	interval_type;
+	SQLSMALLINT	interval_sign;
+	union {
+		SQL_YEAR_MONTH_STRUCT	year_month;
+		SQL_DAY_SECOND_STRUCT	day_second;
+	} intval;
 } SQL_INTERVAL_STRUCT;
 
 #define SQL_MAX_OPTION_STRING_LENGTH	256
@@ -496,24 +481,24 @@ typedef struct tagSQL_INTERVAL_STRUCT
 #define SQL_CODE_HOUR_TO_SECOND
 #define SQL_CODE_MINUTE_TO_SECOND
 */
-#define SQL_INTERVAL_YEAR				(-80)
-#define SQL_INTERVAL_MONTH				(-81)
-#define SQL_INTERVAL_YEAR_TO_MONTH		(-82)
-#define SQL_INTERVAL_DAY				(-83)
-#define SQL_INTERVAL_HOUR				(-84)
-#define SQL_INTERVAL_MINUTE				(-85)
-#define SQL_INTERVAL_SECOND				(-86)
-#define SQL_INTERVAL_DAY_TO_HOUR		(-87)
-#define SQL_INTERVAL_DAY_TO_MINUTE		(-88)
-#define SQL_INTERVAL_DAY_TO_SECOND		(-89)
-#define SQL_INTERVAL_HOUR_TO_MINUTE		(-90)
-#define SQL_INTERVAL_HOUR_TO_SECOND		(-91)
+#define SQL_INTERVAL_YEAR		(-80)
+#define SQL_INTERVAL_MONTH		(-81)
+#define SQL_INTERVAL_YEAR_TO_MONTH	(-82)
+#define SQL_INTERVAL_DAY		(-83)
+#define SQL_INTERVAL_HOUR		(-84)
+#define SQL_INTERVAL_MINUTE		(-85)
+#define SQL_INTERVAL_SECOND		(-86)
+#define SQL_INTERVAL_DAY_TO_HOUR	(-87)
+#define SQL_INTERVAL_DAY_TO_MINUTE	(-88)
+#define SQL_INTERVAL_DAY_TO_SECOND	(-89)
+#define SQL_INTERVAL_HOUR_TO_MINUTE	(-90)
+#define SQL_INTERVAL_HOUR_TO_SECOND	(-91)
 #define SQL_INTERVAL_MINUTE_TO_SECOND	(-92)
 
-#define SQL_UNICODE						(-95)
-#define SQL_UNICODE_VARCHAR				(-96)
-#define SQL_UNICODE_LONGVARCHAR			(-97)
-#define SQL_UNICODE_CHAR				SQL_UNICODE
+#define SQL_UNICODE			(-95)
+#define SQL_UNICODE_VARCHAR		(-96)
+#define SQL_UNICODE_LONGVARCHAR		(-97)
+#define SQL_UNICODE_CHAR		SQL_UNICODE
 
 /* C to SQL data types */
 /*
@@ -522,23 +507,23 @@ typedef struct tagSQL_INTERVAL_STRUCT
 #define SQL_C_TYPE_TIMESTAMP	SQL_TYPE_TIMESTAMP
 #define SQL_C_GUID		SQLGUID
 */
-#define SQL_C_INTERVAL_MONTH			SQL_INTERVAL_MONTH
-#define SQL_C_INTERVAL_YEAR				SQL_INTERVAL_YEAR
+#define SQL_C_INTERVAL_MONTH		SQL_INTERVAL_MONTH
+#define SQL_C_INTERVAL_YEAR		SQL_INTERVAL_YEAR
 #define SQL_C_INTERVAL_YEAR_TO_MONTH	SQL_INTERVAL_YEAR_TO_MONTH
-#define SQL_C_INTERVAL_DAY				SQL_INTERVAL_DAY
-#define SQL_C_INTERVAL_HOUR				SQL_INTERVAL_HOUR
-#define SQL_C_INTERVAL_MINUTE			SQL_INTERVAL_MINUTE
-#define SQL_C_INTERVAL_SECOND			SQL_INTERVAL_SECOND
-#define SQL_C_INTERVAL_DAY_TO_HOUR		SQL_INTERVAL_DAY_TO_HOUR
+#define SQL_C_INTERVAL_DAY		SQL_INTERVAL_DAY
+#define SQL_C_INTERVAL_HOUR		SQL_INTERVAL_HOUR
+#define SQL_C_INTERVAL_MINUTE		SQL_INTERVAL_MINUTE
+#define SQL_C_INTERVAL_SECOND		SQL_INTERVAL_SECOND
+#define SQL_C_INTERVAL_DAY_TO_HOUR	SQL_INTERVAL_DAY_TO_HOUR
 #define SQL_C_INTERVAL_DAY_TO_MINUTE	SQL_INTERVAL_DAY_TO_MINUTE
 #define SQL_C_INTERVAL_DAY_TO_SECOND	SQL_INTERVAL_DAY_TO_SECOND
 #define SQL_C_INTERVAL_HOUR_TO_MINUTE	SQL_INTERVAL_HOUR_TO_MINUTE
 #define SQL_C_INTERVAL_HOUR_TO_SECOND	SQL_INTERVAL_HOUR_TO_SECOND
-#define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND
-#define SQL_C_NUMERIC					SQL_NUMERIC
-#define SQL_C_VARBOOKMARK				SQL_C_BINARY
-#define SQL_C_SBIGINT					(SQL_BIGINT + SQL_SIGNED_OFFSET)
-#define SQL_C_UBIGINT					(SQL_BIGINT + SQL_UNSIGNED_OFFSET)
+#define SQL_C_INTERVAL_MINUTE_TO_SECOND	SQL_INTERVAL_MINUTE_TO_SECOND
+#define SQL_C_NUMERIC		SQL_NUMERIC
+#define SQL_C_VARBOOKMARK	SQL_C_BINARY
+#define SQL_C_SBIGINT		(SQL_BIGINT + SQL_SIGNED_OFFSET)
+#define SQL_C_UBIGINT		(SQL_BIGINT + SQL_UNSIGNED_OFFSET)
 
 #define SQL_TRUE	1UL
 #define SQL_FALSE	0UL
@@ -547,31 +532,31 @@ typedef struct tagSQL_INTERVAL_STRUCT
 #define SQL_NO_TOTAL			(-4)
 
 /* SQLBindParameter */
-#define SQL_LEN_DATA_AT_EXEC_OFFSET		(-100)
+#define SQL_LEN_DATA_AT_EXEC_OFFSET	(-100)
 #define SQL_LEN_DATA_AT_EXEC(length)	(-length+SQL_LEN_DATA_AT_EXEC_OFFSET)
 
-#define SQL_LEN_BINARY_ATTR_OFFSET		(-100)
-#define SQL_LEN_BINARY_ATTR(length)		(-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
+#define SQL_LEN_BINARY_ATTR_OFFSET	(-100)
+#define SQL_LEN_BINARY_ATTR(length)	(-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
 
 /* SQLExtendedFetch - row status */
-#define SQL_ROW_SUCCESS			0
-#define SQL_ROW_DELETED			1
-#define SQL_ROW_UPDATED			2
-#define SQL_ROW_NOROW			3
-#define SQL_ROW_ADDED			4
-#define SQL_ROW_ERROR			5
+#define SQL_ROW_SUCCESS		0
+#define SQL_ROW_DELETED		1
+#define SQL_ROW_UPDATED		2
+#define SQL_ROW_NOROW		3
+#define SQL_ROW_ADDED		4
+#define SQL_ROW_ERROR		5
 
 /* SQLForeignKeys - rule flags */
-#define SQL_CASCADE				0
-#define SQL_RESTRICT			1
-#define SQL_SET_NULL			2
-#define SQL_NO_ACTION			3		/* ODBC 3.0 */
-#define SQL_SET_DEFAULT			4
+#define SQL_CASCADE		0
+#define SQL_RESTRICT		1
+#define SQL_SET_NULL		2
+#define SQL_NO_ACTION		3	/* ODBC 3.0 */
+#define SQL_SET_DEFAULT		4
 
 /* SQLForeignKeys - Deferrability (ODBC 3.0) */
 #define SQL_INITIALLY_DEFERRED	5
-#define SQL_INITIALLY_IMMEDIATE 6
-#define SQL_NOT_DEFFERABLE		2
+#define SQL_INITIALLY_IMMEDIATE	6
+#define SQL_NOT_DEFFERABLE	2
 
 /* Constants not in isqlext.h but needed by the driver. I have no idea
 * if these correspond correctly with those from Microsoft or not. I don't
@@ -581,113 +566,113 @@ typedef struct tagSQL_INTERVAL_STRUCT
 */
 
 /*
- *	SQLGetInfo
+ *  SQLGetInfo
  */
 #define SQL_ACTIVE_CONNECTIONS			0
 #define SQL_ACTIVE_STATEMENTS			1
 #define SQL_DATA_SOURCE_NAME			2
-#define SQL_DRIVER_VER					7
-#define SQL_FETCH_DIRECTION				8
-#define SQL_ODBC_API_CONFORMANCE		9
-#define SQL_ROW_UPDATES					11
-#define SQL_ODBC_SAG_CLI_CONFORMANCE	12
-#define SQL_SERVER_NAME					13
+#define SQL_DRIVER_VER				7 
+#define SQL_FETCH_DIRECTION			8
+#define SQL_ODBC_API_CONFORMANCE		9 
+#define SQL_ROW_UPDATES				11 
+#define SQL_ODBC_SAG_CLI_CONFORMANCE		12 
+#define SQL_SERVER_NAME				13
 #define SQL_SEARCH_PATTERN_ESCAPE		14
-#define SQL_ODBC_SQL_CONFORMANCE		15
-#define SQL_DBMS_NAME					17
-#define SQL_DBMS_VER					18
+#define SQL_ODBC_SQL_CONFORMANCE		15 
+#define SQL_DBMS_NAME				17
+#define SQL_DBMS_VER				18
 #define SQL_ACCESSIBLE_TABLES			19
 #define SQL_ACCESSIBLE_PROCEDURES		20
-#define SQL_PROCEDURES					21
-#define SQL_CONCAT_NULL_BEHAVIOR		22
+#define SQL_PROCEDURES				21 
+#define SQL_CONCAT_NULL_BEHAVIOR		22 
 #define SQL_DATA_SOURCE_READ_ONLY		25
-#define SQL_EXPRESSIONS_IN_ORDERBY		27
-#define SQL_IDENTIFIER_CASE				28
+#define SQL_EXPRESSIONS_IN_ORDERBY		27 
+#define SQL_IDENTIFIER_CASE			28
 #define SQL_IDENTIFIER_QUOTE_CHAR		29
 #define SQL_MAX_COLUMN_NAME_LEN			30
 #define SQL_MAX_CURSOR_NAME_LEN			31
 #define SQL_MAX_OWNER_NAME_LEN			32
-#define SQL_MAX_PROCEDURE_NAME_LEN		33
+#define SQL_MAX_PROCEDURE_NAME_LEN		33 
 #define SQL_MAX_QUALIFIER_NAME_LEN		34
 #define SQL_MAX_TABLE_NAME_LEN			35
-#define SQL_MULT_RESULT_SETS			36
-#define SQL_MULTIPLE_ACTIVE_TXN			37
-#define SQL_OUTER_JOINS					38
-#define SQL_OWNER_TERM					39
-#define SQL_PROCEDURE_TERM				40
-#define SQL_QUALIFIER_NAME_SEPARATOR	41
-#define SQL_QUALIFIER_TERM				42
+#define SQL_MULT_RESULT_SETS			36 
+#define SQL_MULTIPLE_ACTIVE_TXN			37 
+#define SQL_OUTER_JOINS				38 
+#define SQL_OWNER_TERM				39 
+#define SQL_PROCEDURE_TERM			40 
+#define SQL_QUALIFIER_NAME_SEPARATOR		41 
+#define SQL_QUALIFIER_TERM			42 
 #define SQL_SCROLL_CONCURRENCY			43
-#define SQL_SCROLL_OPTIONS				44
-#define SQL_TABLE_TERM					45
-#define SQL_TXN_CAPABLE					46
-#define SQL_USER_NAME					47
-#define SQL_CONVERT_FUNCTIONS			48
-#define SQL_NUMERIC_FUNCTIONS			49
-#define SQL_STRING_FUNCTIONS			50
-#define SQL_SYSTEM_FUNCTIONS			51
-#define SQL_TIMEDATE_FUNCTIONS			52
-#define SQL_CONVERT_BIGINT				53
-#define SQL_CONVERT_BINARY				54
-#define SQL_CONVERT_BIT					55
-#define SQL_CONVERT_CHAR				56
-#define SQL_CONVERT_DATE				57
-#define SQL_CONVERT_DECIMAL				58
-#define SQL_CONVERT_DOUBLE				59
-#define SQL_CONVERT_FLOAT				60
-#define SQL_CONVERT_INTEGER				61
-#define SQL_CONVERT_LONGVARCHAR			62
-#define SQL_CONVERT_NUMERIC				63
-#define SQL_CONVERT_REAL				64
-#define SQL_CONVERT_SMALLINT			65
-#define SQL_CONVERT_TIME				66
-#define SQL_CONVERT_TIMESTAMP			67
-#define SQL_CONVERT_TINYINT				68
-#define SQL_CONVERT_VARBINARY			69
-#define SQL_CONVERT_VARCHAR				70
-#define SQL_CONVERT_LONGVARBINARY		71
+#define SQL_SCROLL_OPTIONS			44 
+#define SQL_TABLE_TERM				45 
+#define SQL_TXN_CAPABLE				46
+#define SQL_USER_NAME				47
+#define SQL_CONVERT_FUNCTIONS			48 
+#define SQL_NUMERIC_FUNCTIONS			49 
+#define SQL_STRING_FUNCTIONS			50 
+#define SQL_SYSTEM_FUNCTIONS			51 
+#define SQL_TIMEDATE_FUNCTIONS			52 
+#define SQL_CONVERT_BIGINT			53 
+#define SQL_CONVERT_BINARY			54 
+#define SQL_CONVERT_BIT				55 
+#define SQL_CONVERT_CHAR			56 
+#define SQL_CONVERT_DATE			57 
+#define SQL_CONVERT_DECIMAL			58 
+#define SQL_CONVERT_DOUBLE			59 
+#define SQL_CONVERT_FLOAT			60 
+#define SQL_CONVERT_INTEGER			61 
+#define SQL_CONVERT_LONGVARCHAR			62 
+#define SQL_CONVERT_NUMERIC			63 
+#define SQL_CONVERT_REAL			64 
+#define SQL_CONVERT_SMALLINT			65 
+#define SQL_CONVERT_TIME			66 
+#define SQL_CONVERT_TIMESTAMP			67 
+#define SQL_CONVERT_TINYINT			68 
+#define SQL_CONVERT_VARBINARY			69 
+#define SQL_CONVERT_VARCHAR			70 
+#define SQL_CONVERT_LONGVARBINARY		71 
 #define SQL_ODBC_SQL_OPT_IEF			73
-#define SQL_CORRELATION_NAME			74
-#define SQL_LOCK_TYPES					78
-#define SQL_POS_OPERATIONS				79
-#define SQL_POSITIONED_STATEMENTS		80
+#define SQL_CORRELATION_NAME			74 
+#define SQL_LOCK_TYPES				78 
+#define SQL_POS_OPERATIONS			79 
+#define SQL_POSITIONED_STATEMENTS		80 
 #define SQL_GETDATA_EXTENSIONS			81
-#define SQL_BOOKMARK_PERSISTENCE		82
-#define SQL_STATIC_SENSITIVITY			83
-#define SQL_FILE_USAGE					84
-#define SQL_NULL_COLLATION				85
-#define SQL_ALTER_TABLE					86
-#define SQL_COLUMN_ALIAS				87
-#define SQL_GROUP_BY					88
-#define SQL_KEYWORDS					89
-#define SQL_ORDER_BY_COLUMNS_IN_SELECT	90
-#define SQL_OWNER_USAGE					91
-#define SQL_QUALIFIER_USAGE				92
-#define SQL_QUOTED_IDENTIFIER_CASE		93
+#define SQL_BOOKMARK_PERSISTENCE		82 
+#define SQL_STATIC_SENSITIVITY			83 
+#define SQL_FILE_USAGE				84 
+#define SQL_NULL_COLLATION			85
+#define SQL_ALTER_TABLE				86
+#define SQL_COLUMN_ALIAS			87 
+#define SQL_GROUP_BY				88 
+#define SQL_KEYWORDS				89 
+#define SQL_ORDER_BY_COLUMNS_IN_SELECT		90
+#define SQL_OWNER_USAGE				91 
+#define SQL_QUALIFIER_USAGE			92 
+#define SQL_QUOTED_IDENTIFIER_CASE		93 
 #define SQL_SPECIAL_CHARACTERS			94
-#define SQL_SUBQUERIES					95
-#define SQL_UNION						96
+#define SQL_SUBQUERIES				95 
+#define SQL_UNION				96 
 #define SQL_MAX_COLUMNS_IN_GROUP_BY		97
 #define SQL_MAX_COLUMNS_IN_INDEX		98
 #define SQL_MAX_COLUMNS_IN_ORDER_BY		99
 #define SQL_MAX_COLUMNS_IN_SELECT		100
 #define SQL_MAX_COLUMNS_IN_TABLE		101
-#define SQL_MAX_INDEX_SIZE				102
-#define SQL_MAX_ROW_SIZE_INCLUDES_LONG	103
-#define SQL_MAX_ROW_SIZE				104
+#define SQL_MAX_INDEX_SIZE			102
+#define SQL_MAX_ROW_SIZE_INCLUDES_LONG		103 
+#define SQL_MAX_ROW_SIZE			104
 #define SQL_MAX_STATEMENT_LEN			105
 #define SQL_MAX_TABLES_IN_SELECT		106
 #define SQL_MAX_USER_NAME_LEN			107
-#define SQL_MAX_CHAR_LITERAL_LEN		108
-#define SQL_TIMEDATE_ADD_INTERVALS		109
-#define SQL_TIMEDATE_DIFF_INTERVALS		110
-#define SQL_NEED_LONG_DATA_LEN			111
-#define SQL_MAX_BINARY_LITERAL_LEN		112
-#define SQL_LIKE_ESCAPE_CLAUSE			113
-
-#define SQL_OJ_CAPABILITIES				65003
+#define SQL_MAX_CHAR_LITERAL_LEN		108 
+#define SQL_TIMEDATE_ADD_INTERVALS		109 
+#define SQL_TIMEDATE_DIFF_INTERVALS		110 
+#define SQL_NEED_LONG_DATA_LEN			111 
+#define SQL_MAX_BINARY_LITERAL_LEN		112 
+#define SQL_LIKE_ESCAPE_CLAUSE			113 
+
+#define SQL_OJ_CAPABILITIES			65003
 /* ODBC 3.0 alias */
-#define SQL_MAX_SCHEMA_NAME_LEN			SQL_MAX_OWNER_NAME_LEN
+#define SQL_MAX_SCHEMA_NAME_LEN		SQL_MAX_OWNER_NAME_LEN
 
 /* Bit Masks describing the behaviour of the GetInfo functions named above */
 /*
@@ -701,7 +686,7 @@ typedef struct tagSQL_INTERVAL_STRUCT
 */
 #define SQL_BP_CLOSE			0x00000001L
 #define SQL_BP_DELETE			0x00000002L
-#define SQL_BP_DROP				0x00000004L
+#define SQL_BP_DROP			0x00000004L
 #define SQL_BP_TRANSACTION		0x00000008L
 #define SQL_BP_UPDATE			0x00000010L
 #define SQL_BP_OTHER_HSTMT		0x00000020L
@@ -715,43 +700,43 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * is SQLUINTEGER, i.e. 4 bytes). Note that these masks are defined in
  * alphabetical order, I have no idea if this maps to MS's SDK.
  */
-#define SQL_CVT_CHAR			0x00000001L
-#define SQL_CVT_NUMERIC			0x00000002L
-#define SQL_CVT_DECIMAL			0x00000004L
-#define SQL_CVT_INTEGER			0x00000008L
-#define SQL_CVT_SMALLINT		0x00000010L
-#define SQL_CVT_FLOAT			0x00000020L
-#define SQL_CVT_REAL			0x00000040L
-#define SQL_CVT_DOUBLE			0x00000080L
-#define SQL_CVT_VARCHAR			0x00000100L
-#define SQL_CVT_LONGVARCHAR		0x00000200L
-#define SQL_CVT_BINARY			0x00000400L
-#define SQL_CVT_VARBINARY		0x00000800L
-#define SQL_CVT_BIT				0x00001000L
-#define SQL_CVT_TINYINT			0x00002000L
-#define SQL_CVT_BIGINT			0x00004000L
-#define SQL_CVT_DATE			0x00008000L
-#define SQL_CVT_TIME			0x00010000L
-#define SQL_CVT_TIMESTAMP		0x00020000L
+#define SQL_CVT_CHAR		0x00000001L
+#define SQL_CVT_NUMERIC		0x00000002L
+#define SQL_CVT_DECIMAL		0x00000004L
+#define SQL_CVT_INTEGER		0x00000008L
+#define SQL_CVT_SMALLINT	0x00000010L
+#define SQL_CVT_FLOAT		0x00000020L
+#define SQL_CVT_REAL		0x00000040L
+#define SQL_CVT_DOUBLE		0x00000080L
+#define SQL_CVT_VARCHAR		0x00000100L
+#define SQL_CVT_LONGVARCHAR	0x00000200L
+#define SQL_CVT_BINARY		0x00000400L
+#define SQL_CVT_VARBINARY	0x00000800L
+#define SQL_CVT_BIT		0x00001000L
+#define SQL_CVT_TINYINT		0x00002000L
+#define SQL_CVT_BIGINT		0x00004000L
+#define SQL_CVT_DATE		0x00008000L
+#define SQL_CVT_TIME		0x00010000L
+#define SQL_CVT_TIMESTAMP	0x00020000L
 #define SQL_CVT_LONGVARBINARY	0x00040000L
 
 
-/*	extras added in ODBC 3.0 */
-#define SQL_CVT_INTERVAL_YEAR_MONTH 0x00080000L
+/*  extras added in ODBC 3.0 */
+#define SQL_CVT_INTERVAL_YEAR_MONTH	0x00080000L
 #define SQL_CVT_INTERVAL_DAY_TIME	0x00100000L
 
 /*
- *	concat null behaviour(2 byte val)
+ *  concat null behaviour(2 byte val)
  */
-#define SQL_CB_NULL				0x0000
-#define SQL_CB_NON_NULL			0x0001
+#define SQL_CB_NULL 			0x0000
+#define SQL_CB_NON_NULL		 	0x0001
 
 /*
- *	correlation name
+ *  correlation name
  */
-#define SQL_CN_NONE				0x0000
+#define SQL_CN_NONE 			0x0000
 #define SQL_CN_DIFFERENT		0x0001
-#define SQL_CN_ANY				0x0002
+#define SQL_CN_ANY			0x0002
 
 /*
  * Fetch Direction. A SQLINTEGER bitmask enumerating the supported fetch
@@ -762,10 +747,10 @@ typedef struct tagSQL_INTERVAL_STRUCT
 #define SQL_FD_FETCH_FIRST		0x00000002L
 #define SQL_FD_FETCH_LAST		0x00000004L
 #define SQL_FD_FETCH_PRIOR		0x00000008L
-#define SQL_FD_FETCH_ABSOLUTE	0x00000010L
-#define SQL_FD_FETCH_RELATIVE	0x00000020L
+#define SQL_FD_FETCH_ABSOLUTE		0x00000010L
+#define SQL_FD_FETCH_RELATIVE		0x00000020L
 #define SQL_FD_FETCH_RESUME		0x00000040L
-#define SQL_FD_FETCH_BOOKMARK	0x00000080L
+#define SQL_FD_FETCH_BOOKMARK		0x00000080L
 
 /*
  * Conversion bitmasks for testing which function conversions are supported by
@@ -775,39 +760,39 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * is SQLUINTEGER, i.e. 4 bytes). Note that these masks are defined in
  * alphabetical order, I have no idea if this maps to MS's SDK.
  */
-#define SQL_FN_CVT_CONVERT		0x00000001L
-#define SQL_FN_CVT_CAST			0x00000002L
+#define SQL_FN_CVT_CONVERT	0x00000001L
+#define SQL_FN_CVT_CAST		0x00000002L
 
-/*
+/* 
  * File Usage. A SQLUSMALLINT indicating how a singel-tier driver treats
  * files in a data source.
  */
 #define SQL_FILE_NOT_SUPPORTED	0x0000
-#define SQL_FILE_TABLE			0x0001
-#define SQL_FILE_QUALIFIER		0x0002
-#define SQL_FILE_CATALOG		SQL_FILE_CATALOG
+#define SQL_FILE_TABLE		0x0001
+#define SQL_FILE_QUALIFIER	0x0002
+#define SQL_FILE_CATALOG	SQL_FILE_CATALOG
 
-/*
+/* 
  * GetData Extensions. A SQLUINTEGER(4 bytes) bitmask enumerating extensions
  * to SQLGetData.
  */
-#define SQL_GD_ANY_COLUMN		0x00000001L
-#define SQL_GD_ANY_ORDER		0x00000002L
-#define SQL_GD_BLOCK			0x00000004L
-#define SQL_GD_BOUND			0x00000008L
+#define SQL_GD_ANY_COLUMN	0x00000001L
+#define SQL_GD_ANY_ORDER	0x00000002L
+#define SQL_GD_BLOCK		0x00000004L
+#define SQL_GD_BOUND		0x00000008L
 
-/*
+/* 
  * Group By. A SQLUSMALLINT value specifying the relationship between the
  * columns in the GROUP BY clause and the non-aggregated columns in the
  * select list.
 */
-#define SQL_GB_NOT_SUPPORTED			0x0000
+#define SQL_GB_NOT_SUPPORTED		0x0000
 #define SQL_GB_GROUP_BY_EQUALS_SELECT	0x0001
-#define SQL_GB_GROUP_BY_CONTAINS_SELECT 0x0002
-#define SQL_GB_NO_RELATION				0x0003
+#define SQL_GB_GROUP_BY_CONTAINS_SELECT	0x0002
+#define SQL_GB_NO_RELATION		0x0003
 
 /* added in ODBC 3.0 */
-#define SQL_GB_COLLATE					0x0004
+#define SQL_GB_COLLATE			0x0004
 
 /*
  * Identifier Case. A SQLUSMALLINT indicating how identifiers are handled.
@@ -829,17 +814,17 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * Non Nullable Columns. A SQLUSMALLINT value indicating if the data source
  * supports NOT NULL in columns.
  */
-#define SQL_NNC_NULL			0x0000
-#define SQL_NNC_NON_NULL		0x0001
+#define SQL_NNC_NULL		0x0000
+#define SQL_NNC_NON_NULL	0x0001
 
 /*
  * Null Collation. A SQLUSMALLINT value specifying where NULLS are sorted in
  * a result set.
  */
-#define SQL_NC_HIGH				0x0001
-#define SQL_NC_LOW				0x0003
-#define SQL_NC_START			0x0002
-#define SQL_NC_END				0x0004
+#define SQL_NC_HIGH		0x0001
+#define SQL_NC_LOW		0x0003
+#define SQL_NC_START		0x0002
+#define SQL_NC_END		0x0004
 
 /*
  * Numeric Functions. A SQLUINTEGER bitmask enumerating the scalar numeric
@@ -876,9 +861,9 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * Outer Join Capabilites. A SQLUINTEGER bitmask enumerating the types of
  * outer joins supported by the driver and data source.
  */
-#define SQL_OJ_LEFT				0x00000001L
+#define SQL_OJ_LEFT			0x00000001L
 #define SQL_OJ_RIGHT			0x00000002L
-#define SQL_OJ_FULL				0x00000004L
+#define SQL_OJ_FULL			0x00000004L
 #define SQL_OJ_NESTED			0x00000008L
 #define SQL_OJ_NOT_ORDERED		0x00000010L
 #define SQL_OJ_INNER			0x00000020L
@@ -888,43 +873,43 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * ODBC API Conformance. A SQLSMALLINT value indicating a drivers ODBC
  * level conformance. Depreciated in 3.0.
  */
-#define SQL_OAC_NONE			0x0000
-#define SQL_OAC_LEVEL1			0x0001
-#define SQL_OAC_LEVEL2			0x0002
+#define SQL_OAC_NONE		0x0000
+#define SQL_OAC_LEVEL1		0x0001
+#define SQL_OAC_LEVEL2		0x0002
 
 /*
  * ODBC SAG CLI Conformance. A SQLSMALLINT value indicating a drivers
  * SAG CLI conformance.
  */
 #define SQL_OSCC_NOT_COMPLIANT	0x0000
-#define SQL_OSCC_COMPLIANT		0x0001
+#define SQL_OSCC_COMPLIANT	0x0001
 
 /*
  * ODBC SQL Conformance. A SQLSMALLINT value indicating a drivers SQL
  * grammar support. Depreciated in 3.0.
  */
-#define SQL_OSC_MINIMUM			0x0000
-#define SQL_OSC_CORE			0x0001
-#define SQL_OSC_EXTENDED		0x0002
+#define SQL_OSC_MINIMUM		0x0000
+#define SQL_OSC_CORE		0x0001
+#define SQL_OSC_EXTENDED	0x0002
 
-/*
+/* 
  * Owner Usage. A SQLUINTEGER bitmask.
  */
 #define SQL_OU_DML_STATEMENTS		0x00000001L
-#define SQL_OU_PROCEDURE_INVOCATION 0x00000002L
+#define SQL_OU_PROCEDURE_INVOCATION	0x00000002L
 #define SQL_OU_TABLE_DEFINITION		0x00000004L
 #define SQL_OU_INDEX_DEFINITION		0x00000008L
-#define SQL_OU_PRIVILEGE_DEFINITION 0x00000010L
+#define SQL_OU_PRIVILEGE_DEFINITION	0x00000010L
 
 /*
  * Schema Usage. A SQLUINTEGER bitmask enumerating the statements in which
  * schemas can be used. Renamed in ODBC 3.0 from SQL_OWNER_USAGE
  */
 #define SQL_SU_DML_STATEMENTS		SQL_OU_DML_STATEMENTS
-#define SQL_SU_PROCEDURE_INVOCATION SQL_OU_PROCEDURE_INVOCATION
+#define SQL_SU_PROCEDURE_INVOCATION	SQL_OU_PROCEDURE_INVOCATION
 #define SQL_SU_TABLE_DEFINITION		SQL_OU_TABLE_DEFINITION
 #define SQL_SU_INDEX_DEFINITION		SQL_OU_INDEX_DEFINITION
-#define SQL_SU_PRIVILEGE_DEFINITION SQL_OU_PRIVILEGE_DEFINITION
+#define SQL_SU_PRIVILEGE_DEFINITION	SQL_OU_PRIVILEGE_DEFINITION
 
 /*
  * Pos. Operations. A SQLINTEGER bitmask enumerating the supported operations
@@ -934,38 +919,38 @@ typedef struct tagSQL_INTERVAL_STRUCT
 #define SQL_POS_REFRESH		0x00000002L
 #define SQL_POS_UPDATE		0x00000004L
 #define SQL_POS_DELETE		0x00000008L
-#define SQL_POS_ADD			0x00000010L
+#define SQL_POS_ADD		0x00000010L
 
 /*
- *	SQLSetPos
+ *  SQLSetPos
  */
-#define SQL_ENTIRE_ROWSET	0
+#define SQL_ENTIRE_ROWSET		0
 
 #define SQL_POSITION	0
-#define SQL_REFRESH		1
-#define SQL_UPDATE		2
-#define SQL_DELETE		3
-#define SQL_ADD			4
+#define SQL_REFRESH	1
+#define SQL_UPDATE	2
+#define SQL_DELETE	3
+#define SQL_ADD		4
 
 /*
  * SQLSetPos Lock options
 */
-#define SQL_LOCK_NO_CHANGE		0
-#define SQL_LOCK_EXCLUSIVE		1
-#define SQL_LOCK_UNLOCK			2
+#define SQL_LOCK_NO_CHANGE		0 	
+#define SQL_LOCK_EXCLUSIVE		1		
+#define SQL_LOCK_UNLOCK 		2
 
-#define SQL_POSITION_TO(hstmt,irow)		\
-	SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
+#define SQL_POSITION_TO(hstmt,irow) 	\
+    SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
 #define SQL_LOCK_RECORD(hstmt,irow,fLock) \
-	SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
+    SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
 #define SQL_REFRESH_RECORD(hstmt,irow,fLock) \
-	SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
+    SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
 #define SQL_UPDATE_RECORD(hstmt,irow) \
-	SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
+    SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
 #define SQL_DELETE_RECORD(hstmt,irow) \
-	SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
+    SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
 #define SQL_ADD_RECORD(hstmt,irow) \
-	SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
+    SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
 
 /*
  * Positioned Statements. A SQLINTEGER bitmask enumerating the supported
@@ -978,48 +963,48 @@ typedef struct tagSQL_INTERVAL_STRUCT
 /* Qualifier Location. A SQLUSMALLINT value indicating the position of the
  * catalog in a qualified table name.
  */
-#define SQL_QL_START			0x0001
-#define SQL_QL_END				0x0002
+#define SQL_QL_START		0x0001
+#define SQL_QL_END		0x0002
 
-/*
+/* 
  * Qualifier Usage. A SQLUINTEGER bitmask.
  */
 #define SQL_QU_DML_STATEMENTS		0x00000001L
-#define SQL_QU_PROCEDURE_INVOCATION 0x00000002L
+#define SQL_QU_PROCEDURE_INVOCATION	0x00000002L
 #define SQL_QU_TABLE_DEFINITION		0x00000004L
 #define SQL_QU_INDEX_DEFINITION		0x00000008L
-#define SQL_QU_PRIVILEGE_DEFINITION 0x00000010L
+#define SQL_QU_PRIVILEGE_DEFINITION	0x00000010L
 
 /* The above is renamed in ODBC 3.0 to Catalog Usage. */
 #define SQL_CU_DML_STATEMENTS		SQL_QU_DML_STATEMENTS
-#define SQL_CU_PROCEDURE_INVOCATION SQL_QU_PROCEDURE_INVOCATION
+#define SQL_CU_PROCEDURE_INVOCATION	SQL_QU_PROCEDURE_INVOCATION
 #define SQL_CU_TABLE_DEFINITION		SQL_QU_TABLE_DEFINITION
 #define SQL_CU_INDEX_DEFINITION		SQL_QU_INDEX_DEFINITION
-#define SQL_CU_PRIVILEGE_DEFINITION SQL_QU_PRIVILEGE_DEFINITION
+#define SQL_CU_PRIVILEGE_DEFINITION	SQL_QU_PRIVILEGE_DEFINITION
 
 /* ODBC 3.0 renamed the above to Catalog Location. */
-#define SQL_CL_START				SQL_QL_START
-#define SQL_CL_END					SQL_QL_END
+#define SQL_CL_START		SQL_QL_START
+#define SQL_CL_END		SQL_QL_END
 
 /*
  * Scroll Concurrency. A SQLINTEGER bitmask enumerating the concurrency
  * control options supported for the cursor. Depreciated in ODBC 3.0.
  */
-#define SQL_SCCO_READ_ONLY			0x00000001L
-#define SQL_SCCO_LOCK				0x00000002L
-#define SQL_SCCO_OPT_ROWVER			0x00000004L
-#define SQL_SCCO_OPT_VALUES			0x00000008L
+#define SQL_SCCO_READ_ONLY		0x00000001L
+#define SQL_SCCO_LOCK			0x00000002L
+#define SQL_SCCO_OPT_ROWVER		0x00000004L
+#define SQL_SCCO_OPT_VALUES		0x00000008L
 
 
-/*
+/* 
  * Scroll Options. A SQLUINTEGER bitmask enumerating the scroll options
  * supported for scrollable cursors.
  */
-#define SQL_SO_FORWARD_ONLY			0x00000001L
+#define SQL_SO_FORWARD_ONLY		0x00000001L
 #define SQL_SO_KEYSET_DRIVEN		0x00000002L
-#define SQL_SO_DYNAMIC				0x00000004L
-#define SQL_SO_MIXED				0x00000008L
-#define SQL_SO_STATIC				0x00000010L
+#define SQL_SO_DYNAMIC			0x00000004L
+#define SQL_SO_MIXED			0x00000008L
+#define SQL_SO_STATIC			0x00000010L
 
 /*
  * Static Sensitity. A SQLINTEGER bitmask enumerating whether changes made
@@ -1027,139 +1012,139 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * or positioned update or delete statements can be detected by that
  * application.
  */
-#define SQL_SS_ADDITIONS			0x00000001L
-#define SQL_SS_DELETIONS			0x00000002L
-#define SQL_SS_UPDATES				0x00000004L
+#define SQL_SS_ADDITIONS		0x00000001L
+#define SQL_SS_DELETIONS		0x00000002L
+#define SQL_SS_UPDATES			0x00000004L 
 
 /*
  * String Functions. A SQLUINTEGER bitmask enumerating the scalar string
  * functions supported by the driver and associated data source.
  */
-#define SQL_FN_STR_CONCAT			0x00000001L
-#define SQL_FN_STR_INSERT			0x00000002L
-#define SQL_FN_STR_LEFT				0x00000004L
-#define SQL_FN_STR_LTRIM			0x00000008L
-#define SQL_FN_STR_LENGTH			0x00000010L
-#define SQL_FN_STR_LOCATE			0x00000020L
-#define SQL_FN_STR_LCASE			0x00000040L
-#define SQL_FN_STR_REPEAT			0x00000080L
-#define SQL_FN_STR_REPLACE			0x00000100L
-#define SQL_FN_STR_RIGHT			0x00000200L
-#define SQL_FN_STR_RTRIM			0x00000400L
+#define SQL_FN_STR_CONCAT		0x00000001L
+#define SQL_FN_STR_INSERT		0x00000002L
+#define SQL_FN_STR_LEFT			0x00000004L
+#define SQL_FN_STR_LTRIM		0x00000008L
+#define SQL_FN_STR_LENGTH		0x00000010L
+#define SQL_FN_STR_LOCATE		0x00000020L
+#define SQL_FN_STR_LCASE		0x00000040L
+#define SQL_FN_STR_REPEAT		0x00000080L
+#define SQL_FN_STR_REPLACE		0x00000100L
+#define SQL_FN_STR_RIGHT		0x00000200L
+#define SQL_FN_STR_RTRIM		0x00000400L
 #define SQL_FN_STR_SUBSTRING		0x00000800L
-#define SQL_FN_STR_UCASE			0x00001000L
-#define SQL_FN_STR_ASCII			0x00002000L
-#define SQL_FN_STR_CHAR				0x00004000L
+#define SQL_FN_STR_UCASE		0x00001000L
+#define SQL_FN_STR_ASCII		0x00002000L
+#define SQL_FN_STR_CHAR			0x00004000L
 #define SQL_FN_STR_DIFFERENCE		0x00008000L
-#define SQL_FN_STR_LOCATE_2			0x00010000L
-#define SQL_FN_STR_SOUNDEX			0x00020000L
-#define SQL_FN_STR_SPACE			0x00040000L
+#define SQL_FN_STR_LOCATE_2		0x00010000L
+#define SQL_FN_STR_SOUNDEX		0x00020000L
+#define SQL_FN_STR_SPACE		0x00040000L
 
 /* introduced in ODBC 3.0 */
 #define SQL_FN_STR_BIT_LENGTH		0x00080000L
 #define SQL_FN_STR_CHAR_LENGTH		0x00100000L
-#define SQL_FN_STR_CHARACTER_LENGTH 0x00200000L
+#define SQL_FN_STR_CHARACTER_LENGTH	0x00200000L
 #define SQL_FN_STR_OCTET_LENGTH		0x00400000L
-#define SQL_FN_STR_POSITION			0x00800000L
+#define SQL_FN_STR_POSITION		0x00800000L
 
 /*
  * Subqueries. A SQLUINTEGER bitmask enumerating the predicates that support
  * subqueries.
  */
-#define SQL_SQ_COMPARISON			0x00000001L
-#define SQL_SQ_EXISTS				0x00000002L
-#define SQL_SQ_IN					0x00000004L
-#define SQL_SQ_QUANTIFIED			0x00000008L
+#define SQL_SQ_COMPARISON		0x00000001L
+#define SQL_SQ_EXISTS			0x00000002L
+#define SQL_SQ_IN			0x00000004L
+#define SQL_SQ_QUANTIFIED		0x00000008L
 #define SQL_SQ_CORRELATED_SUBQUERIES	0x00000010L
 
 /*
  * System Functions. A SQLUINTEGER bitmask enumerating the scalar system
  * functions supported by the driver and associated data source.
  */
-#define SQL_FN_SYS_USERNAME			0x00000001L
-#define SQL_FN_SYS_DBNAME			0x00000002L
-#define SQL_FN_SYS_IFNULL			0x00000004L
+#define SQL_FN_SYS_USERNAME		0x00000001L 
+#define SQL_FN_SYS_DBNAME		0x00000002L
+#define SQL_FN_SYS_IFNULL		0x00000004L
 
 /*
  * Time-Date add and diff intervals. A SQLUINTEGER bitmask enumerating the
  * timestamp intervals supported by the driver and associated data source
- *	for the TIMESTAMPADD and TIMESTAMPDIFF scalar function.
+ *  for the TIMESTAMPADD and TIMESTAMPDIFF scalar function.
  */
 #define SQL_FN_TSI_FRAC_SECOND		0x00000001L
-#define SQL_FN_TSI_SECOND			0x00000002L
-#define SQL_FN_TSI_MINUTE			0x00000004L
-#define SQL_FN_TSI_HOUR				0x00000008L
-#define SQL_FN_TSI_DAY				0x00000010L
-#define SQL_FN_TSI_WEEK				0x00000020L
-#define SQL_FN_TSI_MONTH			0x00000040L
-#define SQL_FN_TSI_QUARTER			0x00000080L
-#define SQL_FN_TSI_YEAR				0x00000100L
+#define SQL_FN_TSI_SECOND		0x00000002L
+#define SQL_FN_TSI_MINUTE		0x00000004L
+#define SQL_FN_TSI_HOUR			0x00000008L
+#define SQL_FN_TSI_DAY			0x00000010L
+#define SQL_FN_TSI_WEEK			0x00000020L
+#define SQL_FN_TSI_MONTH		0x00000040L
+#define SQL_FN_TSI_QUARTER		0x00000080L
+#define SQL_FN_TSI_YEAR			0x00000100L
 
 /*
  * Time/Date functions. A SQLUINTEGER bitmask enumerating the scalar date
  * and time functions supported by the driver and associated data source.
  */
-#define SQL_FN_TD_NOW				0x00000001L
-#define SQL_FN_TD_CURDATE			0x00000002L
+#define SQL_FN_TD_NOW			0x00000001L
+#define SQL_FN_TD_CURDATE		0x00000002L
 #define SQL_FN_TD_DAYOFMONTH		0x00000004L
-#define SQL_FN_TD_DAYOFWEEK			0x00000008L
-#define SQL_FN_TD_DAYOFYEAR			0x00000010L
-#define SQL_FN_TD_MONTH				0x00000020L
-#define SQL_FN_TD_QUARTER			0x00000040L
-#define SQL_FN_TD_WEEK				0x00000080L
-#define SQL_FN_TD_YEAR				0x00000100L
-#define SQL_FN_TD_CURTIME			0x00000200L
-#define SQL_FN_TD_HOUR				0x00000400L
-#define SQL_FN_TD_MINUTE			0x00000800L
-#define SQL_FN_TD_SECOND			0x00001000L
+#define SQL_FN_TD_DAYOFWEEK		0x00000008L
+#define SQL_FN_TD_DAYOFYEAR		0x00000010L
+#define SQL_FN_TD_MONTH			0x00000020L
+#define SQL_FN_TD_QUARTER		0x00000040L
+#define SQL_FN_TD_WEEK			0x00000080L
+#define SQL_FN_TD_YEAR			0x00000100L
+#define SQL_FN_TD_CURTIME		0x00000200L
+#define SQL_FN_TD_HOUR			0x00000400L
+#define SQL_FN_TD_MINUTE		0x00000800L
+#define SQL_FN_TD_SECOND		0x00001000L
 #define SQL_FN_TD_TIMESTAMPADD		0x00002000L
 #define SQL_FN_TD_TIMESTAMPDIFF		0x00004000L
-#define SQL_FN_TD_DAYNAME			0x00008000L
-#define SQL_FN_TD_MONTHNAME			0x00010000L
+#define SQL_FN_TD_DAYNAME		0x00008000L
+#define SQL_FN_TD_MONTHNAME		0x00010000L
 
 /* Added in ODBC 3.0 */
 #define SQL_FN_TD_CURRENT_DATE		0x00020000L
 #define SQL_FN_TD_CURRENT_TIME		0x00040000L
-#define SQL_FN_TD_CURRENT_TIMESTAMP 0x00080000L
-#define SQL_FN_TD_EXTRACT			0x00100000L
+#define SQL_FN_TD_CURRENT_TIMESTAMP	0x00080000L
+#define SQL_FN_TD_EXTRACT		0x00100000L
 
 /*
  * Transaction Capable. A SQLUSMALLINT value describing the transaction
  * support in the driver or data source.
  */
-#define SQL_TC_NONE					0x0000
-#define SQL_TC_DML					0x0001
-#define SQL_TC_ALL					0x0002
-#define SQL_TC_DDL_COMMIT			0x0003
-#define SQL_TC_DDL_IGNORE			0x0004
+#define SQL_TC_NONE		0x0000
+#define SQL_TC_DML		0x0001
+#define SQL_TC_ALL		0x0002
+#define SQL_TC_DDL_COMMIT	0x0003
+#define SQL_TC_DDL_IGNORE	0x0004
 
 /*
  * Unions. A SQLUINTEGER bitmask enumerating the support for the UNION
  * clause.
  */
-#define SQL_U_UNION					0x00000001L
-#define SQL_U_UNION_ALL				0x00000002L
+#define SQL_U_UNION		0x00000001L
+#define SQL_U_UNION_ALL		0x00000002L
 
 
 /* SQLStatistics: Type, Smallint */
-#define SQL_TABLE_STAT				0
-#define SQL_INDEX_CLUSTERED			1
-#define SQL_INDEX_HASHED			2
-#define SQL_INDEX_OTHER				3
+#define SQL_TABLE_STAT		0
+#define SQL_INDEX_CLUSTERED	1
+#define SQL_INDEX_HASHED	2
+#define SQL_INDEX_OTHER		3
 
 /* SQLProcedures: Type: Smallint */
-#define SQL_PT_UNKNOWN				0
-#define SQL_PT_PROCEDURE			1
-#define SQL_PT_FUNCTION				2
+#define SQL_PT_UNKNOWN		0
+#define SQL_PT_PROCEDURE	1
+#define SQL_PT_FUNCTION		2
 
 /* SQLSpecialColumns: PSEUDO_COLUMN: Smallint */
-#define SQL_PC_UNKNOWN				0
-#define SQL_PC_PSEUDO				1
-#define SQL_PC_NOT_PSEUDO			2
+#define SQL_PC_UNKNOWN		0
+#define SQL_PC_PSEUDO		1		
+#define SQL_PC_NOT_PSEUDO	2
 
 /* SQLSet/Get/StmtOptions: ASYNC_ENABLE. A SQLUINTEGER */
 #define SQL_ASYNC_ENABLE_OFF		0UL
-#define SQL_ASYNC_ENABLE_ON			1UL
+#define SQL_ASYNC_ENABLE_ON		1UL
 #define SQL_ASYNC_ENABLE_DEFAULT	SQL_ASYNC_ENABLE_OFF
 
 /*
@@ -1168,32 +1153,32 @@ typedef struct tagSQL_INTERVAL_STRUCT
  */
 #define SQL_CONCUR_DEFAULT	SQL_CONCUR_READ_ONLY
 
-/*
+/* 
  * SQLSet/GetStmtOptions: CURSOR_SCROLLABLE. A SQLUINTEGER. Added in ODBC
  * 3.0.
  */
-#define SQL_NONSCROLLABLE				0UL
-#define SQL_SCROLLABLE					1UL
+#define SQL_NONSCROLLABLE	0UL
+#define SQL_SCROLLABLE		1UL
 #define SQL_CURSOR_SCROLLABLE_DEFAULT	SQL_NONSCROLLABLE
 
-/*
+/* 
  * SQLSet/GetStmtOptions: CURSOR_SENSITITY. A SQLUINTEGER. Added in ODBC
  * 3.0.
  */
-#define SQL_UNSPECIFIED				0UL
-#define SQL_INSENSITIVE				1UL
-#define SQL_SENSITIVIE				2UL
+#define SQL_UNSPECIFIED		0UL
+#define SQL_INSENSITIVE		1UL
+#define SQL_SENSITIVIE		2UL
 #define SQL_CURSOR_SENSITIVITY_DEFAULT	SQL_UNSPECIFIED
 
-/*
+/* 
  * SQLSet/GetStmtOptions: CURSOR_TYPE: A SQLUINTEGER value that specifies the
  * cursor type
  */
-#define SQL_CURSOR_FORWARD_ONLY		0UL
+#define	SQL_CURSOR_FORWARD_ONLY		0UL
 #define SQL_CURSOR_KEYSET_DRIVEN	1UL
-#define SQL_CURSOR_DYNAMIC			2UL
-#define SQL_CURSOR_STATIC			3UL
-#define SQL_CURSOR_DEFAULT			SQL_CURSOR_FORWARD_ONLY
+#define SQL_CURSOR_DYNAMIC		2UL
+#define SQL_CURSOR_STATIC		3UL
+#define SQL_CURSOR_DEFAULT	SQL_CURSOR_FORWARD_ONLY 
 
 /*
  * ENABLE_AUTO_IPD: A SQLUINTEGER, either SQL_TRUE or SQL_FALSE. Default
@@ -1225,23 +1210,23 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * SQLSet/GetStmtOptions: PARAM_STATUS: SQLUSMALLINT *. Added in ODBC 3.0
  *
 */
-#define SQL_PARAM_SUCCESS			0
-#define SQL_PARAM_SUCCESS_WITH_INFO 6
-#define SQL_PARAM_ERROR				5
-#define SQL_PARAM_UNUSED			7
+#define SQL_PARAM_SUCCESS		0
+#define SQL_PARAM_SUCCESS_WITH_INFO	6
+#define SQL_PARAM_ERROR			5
+#define SQL_PARAM_UNUSED		7
 #define SQL_PARAM_DIAG_UNAVAILABLE	1
 
 /*
  * SQLSet/GetStmtOptions: RETRIEVE_DATA: SQLUINTEGER value.
  */
-#define SQL_RD_OFF			0UL
-#define SQL_RD_ON			1UL
-#define SQL_RD_DEFAULT		SQL_RD_ON
+#define SQL_RD_OFF	0UL
+#define SQL_RD_ON	1UL
+#define SQL_RD_DEFAULT	SQL_RD_ON
 
 /*
  * SQLSet/GetStmtOptions: BIND_TYPE: SQLUINTEGER. sets binding orientation.
  */
-#define SQL_BIND_BY_COLUMN		0UL
+#define SQL_BIND_BY_COLUMN	0UL
 #define SQL_BIND_TYPE_DEFAULT	SQL_BIND_BY_COLUMN
 
 /*
@@ -1251,12 +1236,12 @@ typedef struct tagSQL_INTERVAL_STRUCT
 #define SQL_ROW_IGNORE		1
 
 /*
- *	SQL_ROWSET_SIZE
+ *  SQL_ROWSET_SIZE
  */
-#define SQL_ROWSET_SIZE_DEFAULT		1UL
+#define SQL_ROWSET_SIZE_DEFAULT 	1UL
 
 /*
- *	SQL_KEYSET_SIZE
+ *  SQL_KEYSET_SIZE
  */
 #define SQL_KEYSET_SIZE_DEFAULT		0UL
 
@@ -1273,32 +1258,32 @@ typedef struct tagSQL_INTERVAL_STRUCT
  * SQLSet/GetStmtOptions: USE_BOOKMARKS: SQLUINTEGER value that specifies
  * whether an application will use bookmarks with a cursor.
  */
-#define SQL_UB_OFF					0UL
-#define SQL_UB_ON					1UL
-#define SQL_UB_FIXED				SQL_UB_ON	/* Deprecated in ODBC 3.0 */
-#define SQL_UB_VARIABLE				2UL /* Added in ODBC 3.0 */
-#define SQL_UB_DEFAULT				SQL_UB_OFF
+#define SQL_UB_OFF		0UL
+#define SQL_UB_ON		1UL
+#define SQL_UB_FIXED		SQL_UB_ON	/* Deprecated in ODBC 3.0 */
+#define SQL_UB_VARIABLE		2UL	/* Added in ODBC 3.0 */
+#define SQL_UB_DEFAULT		SQL_UB_OFF
 
 /* Deprecated */
-#define SQL_DATABASE_NAME			16
-#define SQL_FD_FETCH_PREV			SQL_FD_FETCH_PRIOR
-#define SQL_FETCH_PREV				SQL_FETCH_PRIOR
-#define SQL_CONCUR_TIMESTAMP		SQL_CONCUR_ROWVER
-#define SQL_SCCO_OPT_TIMESTAMP		SQL_SCCO_OPT_ROWVER
-#define SQL_CC_DELETE				SQL_CB_DELETE
-#define SQL_CR_DELETE				SQL_CB_DELETE
-#define SQL_CC_CLOSE				SQL_CB_CLOSE
-#define SQL_CR_CLOSE				SQL_CB_CLOSE
-#define SQL_CC_PRESERVE				SQL_CB_PRESERVE
-#define SQL_CR_PRESERVE				SQL_CB_PRESERVE
-#define SQL_FETCH_RESUME			7
-#define SQL_SCROLL_FORWARD_ONLY		0L
-#define SQL_SCROLL_KEYSET_DRIVEN	(-1L)
-#define SQL_SCROLL_DYNAMIC			(-2L)
-#define SQL_SCROLL_STATIC			(-3L)
-
+#define SQL_DATABASE_NAME		16 
+#define SQL_FD_FETCH_PREV		SQL_FD_FETCH_PRIOR 
+#define SQL_FETCH_PREV			SQL_FETCH_PRIOR 
+#define SQL_CONCUR_TIMESTAMP		SQL_CONCUR_ROWVER 
+#define SQL_SCCO_OPT_TIMESTAMP		SQL_SCCO_OPT_ROWVER 
+#define SQL_CC_DELETE			SQL_CB_DELETE 
+#define SQL_CR_DELETE			SQL_CB_DELETE 
+#define SQL_CC_CLOSE			SQL_CB_CLOSE 
+#define SQL_CR_CLOSE			SQL_CB_CLOSE 
+#define SQL_CC_PRESERVE			SQL_CB_PRESERVE 
+#define SQL_CR_PRESERVE			SQL_CB_PRESERVE 
+#define SQL_FETCH_RESUME                7     
+#define SQL_SCROLL_FORWARD_ONLY         0L
+#define SQL_SCROLL_KEYSET_DRIVEN        (-1L)
+#define SQL_SCROLL_DYNAMIC              (-2L)
+#define SQL_SCROLL_STATIC               (-3L)
+ 
 /*
- *	ODBC keywords
+ *  ODBC keywords
  */
 #define SQL_ODBC_KEYWORDS \
 "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
@@ -1332,225 +1317,223 @@ typedef struct tagSQL_INTERVAL_STRUCT
 "UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\
 "VALUE,,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,YEAR"
 
-#ifdef __cplusplus
-extern		"C"
-{
-#endif
+# ifdef __cplusplus
+	extern  "C" {
+# endif
 
-	RETCODE SQL_API SQLSetConnectOption(HDBC, UWORD, UDWORD);
-	RETCODE SQL_API SQLNumResultCols(HSTMT, SWORD FAR *);
+RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
+RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
 
 /*
- *	 function prototypes previously missing from isqlext.h
+ *   function prototypes previously missing from isqlext.h
  */
-	RETCODE SQL_API SQLColumns(HSTMT hstmt,
-										   UCHAR FAR *szTableQualifier,
-										   SWORD cbTableQualifier,
-										   UCHAR FAR *szTableOwner,
-										   SWORD cbTableOwner,
-										   UCHAR FAR *szTableName,
-										   SWORD cbTableName,
-										   UCHAR FAR *szColumnName,
-										   SWORD cbColumnName);
-
-	RETCODE SQL_API SQLDriverConnect(HDBC hdbc,
-												 HWND hwnd,
-												 UCHAR FAR *szConnStrIn,
-												 SWORD cbConnStrIn,
-												 UCHAR FAR *szConnStrOut,
-												 SWORD cbConnStrOutMax,
-												 SWORD FAR *pcbConnStrOut,
-												 UWORD fDriverCompletion);
-
-	RETCODE SQL_API SQLGetConnectOption(HDBC hdbc,
-													UWORD fOption,
-													PTR pvParam);
-
-	RETCODE SQL_API SQLGetData(HSTMT hstmt,
-										   UWORD icol,
-										   SWORD fCType,
-										   PTR rgbValue,
-										   SDWORD cbValueMax,
-										   SDWORD FAR *pcbValue);
-
-	RETCODE SQL_API SQLGetFunctions(HDBC hdbc,
-												UWORD fFunction,
-												UWORD FAR *pfExists);
-
-	RETCODE SQL_API SQLGetInfo(HDBC hdbc,
-										   UWORD fInfoType,
-										   PTR rgbInfoValue,
-										   SWORD cbInfoValueMax,
-										   SWORD FAR *pcbInfoValue);
-
-	RETCODE SQL_API SQLGetStmtOption(HSTMT hstmt,
-												 UWORD fOption,
-												 PTR pvParam);
-
-	RETCODE SQL_API SQLGetTypeInfo(HSTMT hstmt,
-											   SWORD fSqlType);
-
-	RETCODE SQL_API SQLParamData(HSTMT hstmt,
-											 PTR FAR *prgbValue);
-
-	RETCODE SQL_API SQLPutData(HSTMT hstmt,
-										   PTR rgbValue,
-										   SDWORD cbValue);
-
-	RETCODE SQL_API SQLSetStmtOption(HSTMT hstmt,
-												 UWORD fOption,
-												 UDWORD vParam);
-
-	RETCODE SQL_API SQLSpecialColumns(HSTMT hstmt,
-												  UWORD fColType,
-											 UCHAR FAR *szTableQualifier,
-												  SWORD cbTableQualifier,
-												  UCHAR FAR *szTableOwner,
-												  SWORD cbTableOwner,
-												  UCHAR FAR *szTableName,
-												  SWORD cbTableName,
-												  UWORD fScope,
-												  UWORD fNullable);
-
-	RETCODE SQL_API SQLStatistics(HSTMT hstmt,
-											  UCHAR FAR *szTableQualifier,
-											  SWORD cbTableQualifier,
-											  UCHAR FAR *szTableOwner,
-											  SWORD cbTableOwner,
-											  UCHAR FAR *szTableName,
-											  SWORD cbTableName,
-											  UWORD fUnique,
-											  UWORD fAccuracy);
-
-	RETCODE SQL_API SQLTables(HSTMT hstmt,
-										  UCHAR FAR *szTableQualifier,
-										  SWORD cbTableQualifier,
-										  UCHAR FAR *szTableOwner,
-										  SWORD cbTableOwner,
-										  UCHAR FAR *szTableName,
-										  SWORD cbTableName,
-										  UCHAR FAR *szTableType,
-										  SWORD cbTableType);
-
-	RETCODE SQL_API SQLBrowseConnect(HDBC hdbc,
-												 UCHAR FAR *szConnStrIn,
-												 SWORD cbConnStrIn,
-												 UCHAR FAR *szConnStrOut,
-												 SWORD cbConnStrOutMax,
-											   SWORD FAR *pcbConnStrOut);
-
-	RETCODE SQL_API SQLColumnPrivileges(HSTMT hstmt,
-											 UCHAR FAR *szTableQualifier,
-												  SWORD cbTableQualifier,
-												 UCHAR FAR *szTableOwner,
-													SWORD cbTableOwner,
-												  UCHAR FAR *szTableName,
-													SWORD cbTableName,
-												 UCHAR FAR *szColumnName,
-													SWORD cbColumnName);
-
-	RETCODE SQL_API SQLDescribeParam(HSTMT hstmt,
-												 UWORD ipar,
-												 SWORD FAR *pfSqlType,
-												 UDWORD FAR *pcbColDef,
-												 SWORD FAR *pibScale,
-												 SWORD FAR *pfNullable);
-
-	RETCODE SQL_API SQLExtendedFetch(HSTMT hstmt,
-												 UWORD fFetchType,
-												 SDWORD irow,
-												 UDWORD FAR *pcrow,
-												 UWORD FAR *rgfRowStatus);
-
-	RETCODE SQL_API SQLForeignKeys(HSTMT hstmt,
-										   UCHAR FAR *szPkTableQualifier,
-											   SWORD cbPkTableQualifier,
-											   UCHAR FAR *szPkTableOwner,
-											   SWORD cbPkTableOwner,
-											   UCHAR FAR *szPkTableName,
-											   SWORD cbPkTableName,
-										   UCHAR FAR *szFkTableQualifier,
-											   SWORD cbFkTableQualifier,
-											   UCHAR FAR *szFkTableOwner,
-											   SWORD cbFkTableOwner,
-											   UCHAR FAR *szFkTableName,
-											   SWORD cbFkTableName);
-
-	RETCODE SQL_API SQLMoreResults(HSTMT hstmt);
-
-	RETCODE SQL_API SQLNativeSql(HDBC hdbc,
-											 UCHAR FAR *szSqlStrIn,
-											 SDWORD cbSqlStrIn,
-											 UCHAR FAR *szSqlStr,
-											 SDWORD cbSqlStrMax,
-											 SDWORD FAR *pcbSqlStr);
-
-	RETCODE SQL_API SQLNumParams(HSTMT hstmt,
-											 SWORD FAR *pcpar);
-
-	RETCODE SQL_API SQLParamOptions(HSTMT hstmt,
-												UDWORD crow,
-												UDWORD FAR *pirow);
-
-	RETCODE SQL_API SQLPrimaryKeys(HSTMT hstmt,
-											 UCHAR FAR *szTableQualifier,
-											   SWORD cbTableQualifier,
-											   UCHAR FAR *szTableOwner,
-											   SWORD cbTableOwner,
-											   UCHAR FAR *szTableName,
-											   SWORD cbTableName);
-
-	RETCODE SQL_API SQLProcedureColumns(HSTMT hstmt,
-											  UCHAR FAR *szProcQualifier,
-													SWORD cbProcQualifier,
-												  UCHAR FAR *szProcOwner,
-													SWORD cbProcOwner,
-													UCHAR FAR *szProcName,
-													SWORD cbProcName,
-												 UCHAR FAR *szColumnName,
-													SWORD cbColumnName);
-
-	RETCODE SQL_API SQLProcedures(HSTMT hstmt,
-											  UCHAR FAR *szProcQualifier,
-											  SWORD cbProcQualifier,
-											  UCHAR FAR *szProcOwner,
-											  SWORD cbProcOwner,
-											  UCHAR FAR *szProcName,
-											  SWORD cbProcName);
-
-	RETCODE SQL_API SQLSetPos(HSTMT hstmt,
-										  UWORD irow,
-										  UWORD fOption,
-										  UWORD fLock);
-
-	RETCODE SQL_API SQLTablePrivileges(HSTMT hstmt,
-											 UCHAR FAR *szTableQualifier,
-												   SWORD cbTableQualifier,
-												 UCHAR FAR *szTableOwner,
-												   SWORD cbTableOwner,
-												   UCHAR FAR *szTableName,
-												   SWORD cbTableName);
-
-	RETCODE SQL_API SQLBindParameter(HSTMT hstmt,
-												 UWORD ipar,
-												 SWORD fParamType,
-												 SWORD fCType,
-												 SWORD fSqlType,
-												 UDWORD cbColDef,
-												 SWORD ibScale,
-												 PTR rgbValue,
-												 SDWORD cbValueMax,
-												 SDWORD FAR *pcbValue);
-
-	RETCODE SQL_API SQLSetScrollOptions(HSTMT hstmt,
-													UWORD fConcurrency,
-													SDWORD crowKeyset,
-													UWORD crowRowset);
-
-
-#ifdef __cplusplus
-}
-
-#endif
+RETCODE SQL_API SQLColumns (HSTMT hstmt, 
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName,
+	UCHAR FAR * szColumnName,
+	SWORD cbColumnName);
+
+RETCODE SQL_API SQLDriverConnect (HDBC hdbc,
+	HWND hwnd,
+	UCHAR FAR * szConnStrIn,
+	SWORD cbConnStrIn,
+	UCHAR FAR * szConnStrOut,
+	SWORD cbConnStrOutMax,
+	SWORD FAR * pcbConnStrOut,
+	UWORD fDriverCompletion);
+
+RETCODE SQL_API SQLGetConnectOption (HDBC hdbc,
+	UWORD fOption,
+	PTR pvParam);
+
+RETCODE SQL_API SQLGetData (HSTMT hstmt,
+	UWORD icol,
+	SWORD fCType,
+	PTR rgbValue,
+	SDWORD cbValueMax,
+	SDWORD FAR * pcbValue);
+
+RETCODE SQL_API SQLGetFunctions (HDBC hdbc,
+	UWORD fFunction,
+	UWORD FAR * pfExists);
+
+RETCODE SQL_API SQLGetInfo (HDBC hdbc,
+	UWORD fInfoType,
+	PTR rgbInfoValue,
+	SWORD cbInfoValueMax,
+	SWORD FAR * pcbInfoValue);
+
+RETCODE SQL_API SQLGetStmtOption (HSTMT hstmt,
+	UWORD fOption,
+	PTR pvParam);
+
+RETCODE SQL_API SQLGetTypeInfo (HSTMT hstmt,
+	SWORD fSqlType);
+
+RETCODE SQL_API SQLParamData (HSTMT hstmt,
+	PTR FAR * prgbValue);
+
+RETCODE SQL_API SQLPutData (HSTMT hstmt,
+	PTR rgbValue,
+	SDWORD cbValue);
+
+RETCODE SQL_API SQLSetStmtOption (HSTMT hstmt,
+	UWORD fOption,
+	UDWORD vParam);
+
+RETCODE SQL_API SQLSpecialColumns (HSTMT hstmt,
+	UWORD fColType,
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName,
+	UWORD fScope,
+	UWORD fNullable);
+
+RETCODE SQL_API SQLStatistics (HSTMT hstmt,
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName,
+	UWORD fUnique,
+	UWORD fAccuracy);
+
+RETCODE SQL_API SQLTables (HSTMT hstmt,
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName,
+	UCHAR FAR * szTableType,
+	SWORD cbTableType);
+
+RETCODE SQL_API SQLBrowseConnect (HDBC hdbc,
+	UCHAR FAR * szConnStrIn,
+	SWORD cbConnStrIn,
+	UCHAR FAR * szConnStrOut, 
+	SWORD cbConnStrOutMax,
+	SWORD FAR * pcbConnStrOut);
+
+RETCODE SQL_API SQLColumnPrivileges (HSTMT hstmt,
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName,
+	UCHAR FAR * szColumnName,
+	SWORD cbColumnName);
+
+RETCODE SQL_API SQLDescribeParam (HSTMT hstmt,
+	UWORD ipar,
+	SWORD FAR * pfSqlType,
+	UDWORD FAR * pcbColDef,
+	SWORD FAR * pibScale,
+	SWORD FAR * pfNullable);
+
+RETCODE SQL_API SQLExtendedFetch (HSTMT hstmt,
+	UWORD fFetchType,
+	SDWORD irow,
+	UDWORD FAR * pcrow,
+	UWORD FAR * rgfRowStatus);
+
+RETCODE SQL_API SQLForeignKeys (HSTMT hstmt,
+	UCHAR FAR * szPkTableQualifier,
+	SWORD cbPkTableQualifier,
+	UCHAR FAR * szPkTableOwner,
+	SWORD cbPkTableOwner,
+	UCHAR FAR * szPkTableName,
+	SWORD cbPkTableName,
+	UCHAR FAR * szFkTableQualifier,
+	SWORD cbFkTableQualifier,
+	UCHAR FAR * szFkTableOwner,
+	SWORD cbFkTableOwner,
+	UCHAR FAR * szFkTableName,
+	SWORD cbFkTableName);
+
+RETCODE SQL_API SQLMoreResults (HSTMT hstmt);
+
+RETCODE SQL_API SQLNativeSql (HDBC hdbc,
+	UCHAR FAR * szSqlStrIn,
+	SDWORD cbSqlStrIn,
+	UCHAR FAR * szSqlStr,
+	SDWORD cbSqlStrMax,
+	SDWORD FAR * pcbSqlStr);
+
+RETCODE SQL_API SQLNumParams (HSTMT hstmt,
+	SWORD FAR * pcpar);
+
+RETCODE SQL_API SQLParamOptions (HSTMT hstmt,
+	UDWORD crow,
+	UDWORD FAR * pirow);
+
+RETCODE SQL_API SQLPrimaryKeys (HSTMT hstmt,
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName);
+
+RETCODE SQL_API SQLProcedureColumns (HSTMT hstmt,
+	UCHAR FAR * szProcQualifier,
+	SWORD cbProcQualifier,
+	UCHAR FAR * szProcOwner,
+	SWORD cbProcOwner,
+	UCHAR FAR * szProcName,
+	SWORD cbProcName,
+	UCHAR FAR * szColumnName,
+	SWORD cbColumnName);
+
+RETCODE SQL_API SQLProcedures (HSTMT hstmt,
+	UCHAR FAR * szProcQualifier,
+	SWORD cbProcQualifier,
+	UCHAR FAR * szProcOwner,
+	SWORD cbProcOwner,
+	UCHAR FAR * szProcName,
+	SWORD cbProcName);
+
+RETCODE SQL_API SQLSetPos (HSTMT hstmt,
+	UWORD irow,
+	UWORD fOption,
+	UWORD fLock);
+
+RETCODE SQL_API SQLTablePrivileges (HSTMT hstmt,
+	UCHAR FAR * szTableQualifier,
+	SWORD cbTableQualifier,
+	UCHAR FAR * szTableOwner,
+	SWORD cbTableOwner,
+	UCHAR FAR * szTableName,
+	SWORD cbTableName);
+
+RETCODE SQL_API SQLBindParameter (HSTMT hstmt,
+	UWORD ipar,
+	SWORD fParamType,
+	SWORD fCType,
+	SWORD fSqlType,
+	UDWORD cbColDef,
+	SWORD ibScale,
+	PTR rgbValue,
+	SDWORD cbValueMax,
+	SDWORD FAR * pcbValue);
+
+RETCODE SQL_API SQLSetScrollOptions (HSTMT hstmt,
+	UWORD fConcurrency,
+	SDWORD crowKeyset,
+	UWORD crowRowset);
+
+
+# ifdef __cplusplus
+	}
+# endif
 
 #endif
diff --git a/src/interfaces/odbc/lobj.c b/src/interfaces/odbc/lobj.c
index 90258c75ccb8cd94b44f8313f58d2735d4a0749a..8d98ee33e4fd62ffc706157c873af3cec636f605 100644
--- a/src/interfaces/odbc/lobj.c
+++ b/src/interfaces/odbc/lobj.c
@@ -1,13 +1,14 @@
-/* Module:			lobj.c
+
+/* Module:          lobj.c
  *
- * Description:		This module contains routines related to manipulating
- *					large objects.
+ * Description:     This module contains routines related to manipulating
+ *                  large objects.
  *
- * Classes:			none
+ * Classes:         none
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -18,16 +19,15 @@
 Oid
 lo_creat(ConnectionClass *conn, int mode)
 {
-	LO_ARG		argv[1];
-	int			retval,
-				result_len;
+LO_ARG argv[1];
+int retval, result_len;
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = mode;
 
-	if (!CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1))
-		return 0;				/* invalid oid */
+	if ( ! CC_send_function(conn, LO_CREAT, &retval, &result_len, 1, argv, 1))
+		return 0;	/* invalid oid */
 	else
 		return retval;
 
@@ -37,9 +37,9 @@ lo_creat(ConnectionClass *conn, int mode)
 int
 lo_open(ConnectionClass *conn, int lobjId, int mode)
 {
-	int			fd;
-	int			result_len;
-	LO_ARG		argv[2];
+int fd;
+int result_len;
+LO_ARG argv[2];
 
 
 	argv[0].isint = 1;
@@ -50,7 +50,7 @@ lo_open(ConnectionClass *conn, int lobjId, int mode)
 	argv[1].len = 4;
 	argv[1].u.integer = mode;
 
-	if (!CC_send_function(conn, LO_OPEN, &fd, &result_len, 1, argv, 2))
+	if ( ! CC_send_function(conn, LO_OPEN, &fd, &result_len, 1, argv, 2))
 		return -1;
 
 	if (fd >= 0 && lo_lseek(conn, fd, 0L, SEEK_SET) < 0)
@@ -59,31 +59,31 @@ lo_open(ConnectionClass *conn, int lobjId, int mode)
 	return fd;
 }
 
-int
+int 
 lo_close(ConnectionClass *conn, int fd)
 {
-	LO_ARG		argv[1];
-	int			retval,
-				result_len;
+LO_ARG argv[1];
+int retval, result_len;
 
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = fd;
 
-	if (!CC_send_function(conn, LO_CLOSE, &retval, &result_len, 1, argv, 1))
+	if ( ! CC_send_function(conn, LO_CLOSE, &retval, &result_len, 1, argv, 1))
 		return -1;
 
 	else
 		return retval;
+
 }
 
 
 int
 lo_read(ConnectionClass *conn, int fd, char *buf, int len)
 {
-	LO_ARG		argv[2];
-	int			result_len;
+LO_ARG argv[2];
+int result_len;
 
 
 	argv[0].isint = 1;
@@ -94,7 +94,7 @@ lo_read(ConnectionClass *conn, int fd, char *buf, int len)
 	argv[1].len = 4;
 	argv[1].u.integer = len;
 
-	if (!CC_send_function(conn, LO_READ, (int *) buf, &result_len, 0, argv, 2))
+	if ( ! CC_send_function(conn, LO_READ, (int *) buf, &result_len, 0, argv, 2))
 		return -1;
 
 	else
@@ -104,9 +104,8 @@ lo_read(ConnectionClass *conn, int fd, char *buf, int len)
 int
 lo_write(ConnectionClass *conn, int fd, char *buf, int len)
 {
-	LO_ARG		argv[2];
-	int			retval,
-				result_len;
+LO_ARG argv[2];
+int retval, result_len;
 
 
 	if (len <= 0)
@@ -120,7 +119,7 @@ lo_write(ConnectionClass *conn, int fd, char *buf, int len)
 	argv[1].len = len;
 	argv[1].u.ptr = (char *) buf;
 
-	if (!CC_send_function(conn, LO_WRITE, &retval, &result_len, 1, argv, 2))
+	if ( ! CC_send_function(conn, LO_WRITE, &retval, &result_len, 1, argv, 2))
 		return -1;
 
 	else
@@ -130,9 +129,8 @@ lo_write(ConnectionClass *conn, int fd, char *buf, int len)
 int
 lo_lseek(ConnectionClass *conn, int fd, int offset, int whence)
 {
-	LO_ARG		argv[3];
-	int			retval,
-				result_len;
+LO_ARG argv[3];
+int retval, result_len;
 
 
 	argv[0].isint = 1;
@@ -147,7 +145,7 @@ lo_lseek(ConnectionClass *conn, int fd, int offset, int whence)
 	argv[2].len = 4;
 	argv[2].u.integer = whence;
 
-	if (!CC_send_function(conn, LO_LSEEK, &retval, &result_len, 1, argv, 3))
+	if ( ! CC_send_function(conn, LO_LSEEK, &retval, &result_len, 1, argv, 3))
 		return -1;
 
 	else
@@ -157,37 +155,43 @@ lo_lseek(ConnectionClass *conn, int fd, int offset, int whence)
 int
 lo_tell(ConnectionClass *conn, int fd)
 {
-	LO_ARG		argv[1];
-	int			retval,
-				result_len;
+LO_ARG argv[1];
+int retval, result_len;
 
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = fd;
 
-	if (!CC_send_function(conn, LO_TELL, &retval, &result_len, 1, argv, 1))
+	if ( ! CC_send_function(conn, LO_TELL, &retval, &result_len, 1, argv, 1))
 		return -1;
 
 	else
 		return retval;
 }
 
-int
+int 
 lo_unlink(ConnectionClass *conn, Oid lobjId)
 {
-	LO_ARG		argv[1];
-	int			retval,
-				result_len;
+LO_ARG argv[1];
+int retval, result_len;
 
 
 	argv[0].isint = 1;
 	argv[0].len = 4;
 	argv[0].u.integer = lobjId;
 
-	if (!CC_send_function(conn, LO_UNLINK, &retval, &result_len, 1, argv, 1))
+	if ( ! CC_send_function(conn, LO_UNLINK, &retval, &result_len, 1, argv, 1))
 		return -1;
 
 	else
 		return retval;
 }
+
+
+
+
+
+
+
+
diff --git a/src/interfaces/odbc/lobj.h b/src/interfaces/odbc/lobj.h
index fa28542b0ad68ba9e6eecaccc0e4ff5fbc9cf94c..8c4a3075d15ed3f6a0c9fee38daf7535c54dd163 100644
--- a/src/interfaces/odbc/lobj.h
+++ b/src/interfaces/odbc/lobj.h
@@ -1,9 +1,9 @@
 
-/* File:			lobj.h
+/* File:            lobj.h
  *
- * Description:		See "lobj.c"
+ * Description:     See "lobj.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -13,15 +13,14 @@
 
 #include "psqlodbc.h"
 
-struct lo_arg
-{
-	int			isint;
-	int			len;
+struct lo_arg {
+	int		isint;
+	int		len;
 	union
 	{
-		int			integer;
-		char	   *ptr;
-	}			u;
+		int		integer;
+		char	*ptr;
+	} u;
 };
 
 #define LO_CREAT		957
@@ -36,13 +35,14 @@ struct lo_arg
 #define INV_WRITE		0x00020000
 #define INV_READ		0x00040000
 
-Oid			lo_creat(ConnectionClass *conn, int mode);
-int			lo_open(ConnectionClass *conn, int lobjId, int mode);
-int			lo_close(ConnectionClass *conn, int fd);
-int			lo_read(ConnectionClass *conn, int fd, char *buf, int len);
-int			lo_write(ConnectionClass *conn, int fd, char *buf, int len);
-int			lo_lseek(ConnectionClass *conn, int fd, int offset, int len);
-int			lo_tell(ConnectionClass *conn, int fd);
-int			lo_unlink(ConnectionClass *conn, Oid lobjId);
+Oid lo_creat(ConnectionClass *conn, int mode);
+int lo_open(ConnectionClass *conn, int lobjId, int mode);
+int lo_close(ConnectionClass *conn, int fd);
+int lo_read(ConnectionClass *conn, int fd, char *buf, int len);
+int lo_write(ConnectionClass *conn, int fd, char *buf, int len);
+int lo_lseek(ConnectionClass *conn, int fd, int offset, int len);
+int lo_tell(ConnectionClass *conn, int fd);
+int lo_unlink(ConnectionClass *conn, Oid lobjId);
 
 #endif
+
diff --git a/src/interfaces/odbc/misc.c b/src/interfaces/odbc/misc.c
index ffdd18b3ced6633ceabdab9c362163f47574e25f..5d0a19c375e5dd9d39395480d42a5c16978496b0 100644
--- a/src/interfaces/odbc/misc.c
+++ b/src/interfaces/odbc/misc.c
@@ -1,13 +1,14 @@
-/* Module:			misc.c
+
+/* Module:          misc.c
  *
- * Description:		This module contains miscellaneous routines
- *					such as for debugging/logging and string functions.
+ * Description:     This module contains miscellaneous routines
+ *                  such as for debugging/logging and string functions.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -24,54 +25,49 @@
 #include <sys/types.h>
 #include <unistd.h>
 #else
-#include <process.h>			/* Byron: is this where Windows keeps def.
-								 * of getpid ? */
+#include <process.h>	/* Byron: is this where Windows keeps def. of getpid ? */
 #endif
 
 extern GLOBAL_VALUES globals;
-void		generate_filename(char *, char *, char *);
+void generate_filename(char*,char*,char*);
 
 void
-generate_filename(char *dirname, char *prefix, char *filename)
+generate_filename(char* dirname,char* prefix,char* filename)
 {
-	int			pid = 0;
-
+	int pid = 0;
 #ifndef WIN32
 	struct passwd *ptr = 0;
-
 	ptr = getpwuid(getuid());
 #endif
 	pid = getpid();
-	if (dirname == 0 || filename == 0)
+	if(dirname == 0 || filename == 0)
 		return;
 
-	strcpy(filename, dirname);
-	strcat(filename, DIRSEPARATOR);
-	if (prefix != 0)
-		strcat(filename, prefix);
+	strcpy(filename,dirname);
+	strcat(filename,DIRSEPARATOR);
+	if(prefix != 0)
+		strcat(filename,prefix);
 #ifndef WIN32
-	strcat(filename, ptr->pw_name);
+	strcat(filename,ptr->pw_name);
 #endif
-	sprintf(filename, "%s%u%s", filename, pid, ".log");
+	sprintf(filename,"%s%u%s",filename,pid,".log");
 	return;
 }
 
 #ifdef MY_LOG
 
 void
-mylog(char *fmt,...)
+mylog(char * fmt, ...)
 {
-	va_list		args;
-	char		filebuf[80];
-	FILE	   *LOGFP = globals.mylogFP;
+	va_list args;
+	char filebuf[80];
+	FILE* LOGFP = globals.mylogFP;
 
-	if (globals.debug)
-	{
+	if ( globals.debug) {
 		va_start(args, fmt);
 
-		if (!LOGFP)
-		{
-			generate_filename(MYLOGDIR, MYLOGFILE, filebuf);
+		if (! LOGFP) {
+			generate_filename(MYLOGDIR,MYLOGFILE,filebuf);
 			LOGFP = fopen(filebuf, PG_BINARY_W);
 			globals.mylogFP = LOGFP;
 			setbuf(LOGFP, NULL);
@@ -83,26 +79,23 @@ mylog(char *fmt,...)
 		va_end(args);
 	}
 }
-
 #endif
 
 
 #ifdef Q_LOG
 
 void
-qlog(char *fmt,...)
+qlog(char * fmt, ...)
 {
-	va_list		args;
-	char		filebuf[80];
-	FILE	   *LOGFP = globals.qlogFP;
+	va_list args;
+	char filebuf[80];
+	FILE* LOGFP = globals.qlogFP;
 
-	if (globals.commlog)
-	{
+	if ( globals.commlog) {
 		va_start(args, fmt);
 
-		if (!LOGFP)
-		{
-			generate_filename(QLOGDIR, QLOGFILE, filebuf);
+		if (! LOGFP) {
+			generate_filename(QLOGDIR,QLOGFILE,filebuf);
 			LOGFP = fopen(filebuf, PG_BINARY_W);
 			globals.qlogFP = LOGFP;
 			setbuf(LOGFP, NULL);
@@ -114,10 +107,9 @@ qlog(char *fmt,...)
 		va_end(args);
 	}
 }
-
 #endif
 
-/*	Undefine these because windows.h will redefine and cause a warning */
+/*  Undefine these because windows.h will redefine and cause a warning */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -144,8 +136,7 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
 	if (dst_len <= 0)
 		return STRCPY_FAIL;
 
-	if (src_len == SQL_NULL_DATA)
-	{
+	if (src_len == SQL_NULL_DATA) {
 		dst[0] = '\0';
 		return STRCPY_NULL;
 	}
@@ -155,17 +146,14 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
 	if (src_len <= 0)
 		return STRCPY_FAIL;
 
-	else
-	{
-		if (src_len < dst_len)
-		{
+	else {
+		if (src_len < dst_len) {
 			memcpy(dst, src, src_len);
 			dst[src_len] = '\0';
 		}
-		else
-		{
-			memcpy(dst, src, dst_len - 1);
-			dst[dst_len - 1] = '\0';	/* truncated */
+		else {
+			memcpy(dst, src, dst_len-1);
+			dst[dst_len-1] = '\0';	/* truncated */
 			return STRCPY_TRUNCATED;
 		}
 	}
@@ -177,28 +165,28 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
 /* the destination string if src has len characters or more. */
 /* instead, I want it to copy up to len-1 characters and always */
 /* terminate the destination string. */
-char *
-strncpy_null(char *dst, const char *src, int len)
+char *strncpy_null(char *dst, const char *src, int len)
 {
-	int			i;
+int i;
 
 
-	if (NULL != dst)
-	{
-		/* Just in case, check for special lengths */
-		if (len == SQL_NULL_DATA)
-		{
+	if (NULL != dst) {
+
+		/*  Just in case, check for special lengths */
+		if (len == SQL_NULL_DATA) {
 			dst[0] = '\0';
 			return NULL;
 		}
 		else if (len == SQL_NTS)
 			len = strlen(src) + 1;
 
-		for (i = 0; src[i] && i < len - 1; i++)
+		for(i = 0; src[i] && i < len - 1; i++) {
 			dst[i] = src[i];
+		}
 
-		if (len > 0)
+		if(len > 0) {
 			dst[i] = '\0';
+		}
 	}
 	return dst;
 }
@@ -209,24 +197,22 @@ strncpy_null(char *dst, const char *src, int len)
 char *
 make_string(char *s, int len, char *buf)
 {
-	int			length;
-	char	   *str;
+int length;
+char *str;
 
-	if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0)))
-	{
+	if(s && (len > 0 || (len == SQL_NTS && strlen(s) > 0))) {
 		length = (len > 0) ? len : strlen(s);
 
-		if (buf)
-		{
-			strncpy_null(buf, s, length + 1);
+		if (buf) {
+			strncpy_null(buf, s, length+1);
 			return buf;
 		}
 
 		str = malloc(length + 1);
-		if (!str)
+		if ( ! str)
 			return NULL;
 
-		strncpy_null(str, s, length + 1);
+		strncpy_null(str, s, length+1);
 		return str;
 	}
 
@@ -240,11 +226,11 @@ make_string(char *s, int len, char *buf)
 char *
 my_strcat(char *buf, char *fmt, char *s, int len)
 {
-	if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0)))
-	{
-		int			length = (len > 0) ? len : strlen(s);
 
-		int			pos = strlen(buf);
+	if (s && (len > 0 || (len == SQL_NTS && strlen(s) > 0))) {
+		int length = (len > 0) ? len : strlen(s);
+
+		int pos = strlen(buf);
 
 		sprintf(&buf[pos], fmt, length, s);
 		return buf;
@@ -252,26 +238,24 @@ my_strcat(char *buf, char *fmt, char *s, int len)
 	return NULL;
 }
 
-void
-remove_newlines(char *string)
+void remove_newlines(char *string)
 {
 	unsigned int i;
 
-	for (i = 0; i < strlen(string); i++)
-	{
-		if ((string[i] == '\n') ||
-			(string[i] == '\r'))
+	for(i=0; i < strlen(string); i++) {
+		if((string[i] == '\n') ||
+		   (string[i] == '\r')) {
 			string[i] = ' ';
+		}
 	}
 }
 
 char *
 trim(char *s)
 {
-	int			i;
+	int i;
 
-	for (i = strlen(s) - 1; i >= 0; i--)
-	{
+	for (i = strlen(s) - 1; i >= 0; i--) {
 		if (s[i] == ' ')
 			s[i] = '\0';
 		else
diff --git a/src/interfaces/odbc/misc.h b/src/interfaces/odbc/misc.h
index f47bf880174045b3d43240590b71afa17edd5a60..ebe56ea9d80bf429b3682991216f7d03c00e9fc3 100644
--- a/src/interfaces/odbc/misc.h
+++ b/src/interfaces/odbc/misc.h
@@ -1,9 +1,9 @@
 
-/* File:			misc.h
+/* File:            misc.h
  *
- * Description:		See "misc.c"
+ * Description:     See "misc.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -39,37 +39,35 @@
 
 
 #ifdef MY_LOG
-#define MYLOGFILE	"mylog_"
-#ifndef WIN32
-#define MYLOGDIR	"/tmp"
-#else
-#define MYLOGDIR	"c:"
-#endif
-extern void mylog(char *fmt,...);
-
+  #define MYLOGFILE	"mylog_"
+  #ifndef WIN32
+    #define MYLOGDIR	"/tmp"
+  #else
+    #define MYLOGDIR	"c:"
+  #endif
+  extern void mylog(char * fmt, ...);
 #else
-#ifndef WIN32
-#define mylog(args...)			/* GNU convention for variable arguments */
-#else
-#define mylog					/* mylog */
-#endif
+  #ifndef WIN32
+    #define mylog(args...)	/* GNU convention for variable arguments */
+  #else
+    #define mylog    /* mylog */
+  #endif
 #endif
 
 #ifdef Q_LOG
-#define QLOGFILE	"psqlodbc_"
-#ifndef WIN32
-#define QLOGDIR		"/tmp"
-#else
-#define QLOGDIR		"c:"
-#endif
-extern void qlog(char *fmt,...);
-
+  #define QLOGFILE	"psqlodbc_"
+  #ifndef WIN32
+    #define QLOGDIR		"/tmp"
+  #else
+    #define QLOGDIR		"c:"
+  #endif
+  extern void qlog(char * fmt, ...);
 #else
-#ifndef WIN32
-#define qlog(args...)			/* GNU convention for variable arguments */
-#else
-#define qlog					/* qlog */
-#endif
+  #ifndef WIN32
+    #define qlog(args...)	/* GNU convention for variable arguments */
+  #else
+    #define qlog    /* qlog */
+  #endif
 #endif
 
 #ifndef WIN32
@@ -79,21 +77,21 @@ extern void qlog(char *fmt,...);
 #endif
 
 #ifdef WIN32
-#define PG_BINARY		O_BINARY
-#define PG_BINARY_R		"rb"
-#define PG_BINARY_W		"wb"
+#define PG_BINARY	O_BINARY
+#define	PG_BINARY_R	"rb"
+#define	PG_BINARY_W	"wb"
 #else
-#define PG_BINARY		0
-#define PG_BINARY_R		"r"
-#define PG_BINARY_W		"w"
+#define	PG_BINARY	0
+#define	PG_BINARY_R	"r"
+#define	PG_BINARY_W	"w"
 #endif
 
 
-void		remove_newlines(char *string);
-char	   *strncpy_null(char *dst, const char *src, int len);
-char	   *trim(char *string);
-char	   *make_string(char *s, int len, char *buf);
-char	   *my_strcat(char *buf, char *fmt, char *s, int len);
+void remove_newlines(char *string);
+char *strncpy_null(char *dst, const char *src, int len);
+char *trim(char *string);
+char *make_string(char *s, int len, char *buf);
+char *my_strcat(char *buf, char *fmt, char *s, int len);
 
 /* defines for return value of my_strcpy */
 #define STRCPY_SUCCESS		1
@@ -101,6 +99,6 @@ char	   *my_strcat(char *buf, char *fmt, char *s, int len);
 #define STRCPY_TRUNCATED	-1
 #define STRCPY_NULL			-2
 
-int			my_strcpy(char *dst, int dst_len, char *src, int src_len);
+int my_strcpy(char *dst, int dst_len, char *src, int src_len);
 
 #endif
diff --git a/src/interfaces/odbc/options.c b/src/interfaces/odbc/options.c
index 12151f06984a01a3897c0e579906b8d91f86b997..ccc419299dd62a8b28f93491caa45f1e8d257481 100644
--- a/src/interfaces/odbc/options.c
+++ b/src/interfaces/odbc/options.c
@@ -1,14 +1,15 @@
-/* Module:			options.c
+
+/* Module:          options.c
  *
- * Description:		This module contains routines for getting/setting
- *					connection and statement options.
+ * Description:     This module contains routines for getting/setting
+ *                  connection and statement options.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	SQLSetConnectOption, SQLSetStmtOption, SQLGetConnectOption,
- *					SQLGetStmtOption
+ * API functions:   SQLSetConnectOption, SQLSetStmtOption, SQLGetConnectOption,
+ *                  SQLGetStmtOption
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -37,241 +38,207 @@
 
 extern GLOBAL_VALUES globals;
 
-RETCODE set_statement_option(ConnectionClass *conn,
-					 StatementClass *stmt,
-					 UWORD fOption,
-					 UDWORD vParam);
+RETCODE set_statement_option(ConnectionClass *conn, 
+							 StatementClass *stmt, 
+							 UWORD   fOption,
+							 UDWORD  vParam);
 
 
 
-RETCODE
-set_statement_option(ConnectionClass *conn,
-					 StatementClass *stmt,
-					 UWORD fOption,
-					 UDWORD vParam)
+RETCODE set_statement_option(ConnectionClass *conn, 
+							 StatementClass *stmt, 
+							 UWORD   fOption,
+							 UDWORD  vParam)
 {
-	static char *func = "set_statement_option";
-	char		changed = FALSE;
+static char *func="set_statement_option";
+char changed = FALSE;
 
 
-	switch (fOption)
-	{
-		case SQL_ASYNC_ENABLE:	/* ignored */
-			break;
+	switch(fOption) {
+	case SQL_ASYNC_ENABLE:/* ignored */
+		break;
 
-		case SQL_BIND_TYPE:
-			/* now support multi-column and multi-row binding */
-			if (conn)
-				conn->stmtOptions.bind_size = vParam;
-			if (stmt)
-				stmt->options.bind_size = vParam;
-			break;
+	case SQL_BIND_TYPE:		
+		/* now support multi-column and multi-row binding */
+		if (conn) conn->stmtOptions.bind_size = vParam;
+		if (stmt) stmt->options.bind_size = vParam;
+		break;
 
-		case SQL_CONCURRENCY:
+	case SQL_CONCURRENCY:
+		/*	positioned update isn't supported so cursor concurrency is read-only */
 
-			/*
-			 * positioned update isn't supported so cursor concurrency is
-			 * read-only
-			 */
+		if (conn) conn->stmtOptions.scroll_concurrency = vParam;
+		if (stmt) stmt->options.scroll_concurrency = vParam;
+		break;
 
-			if (conn)
-				conn->stmtOptions.scroll_concurrency = vParam;
-			if (stmt)
-				stmt->options.scroll_concurrency = vParam;
-			break;
+		/*
+		if (globals.lie) {
+			if (conn) conn->stmtOptions.scroll_concurrency = vParam;
+			if (stmt) stmt->options.scroll_concurrency = vParam;
+		}
+		else {
 
-			/*
-			 * if (globals.lie) { if (conn)
-			 * conn->stmtOptions.scroll_concurrency = vParam; if (stmt)
-			 * stmt->options.scroll_concurrency = vParam; } else {
-			 *
-			 * if (conn) conn->stmtOptions.scroll_concurrency =
-			 * SQL_CONCUR_READ_ONLY; if (stmt)
-			 * stmt->options.scroll_concurrency = SQL_CONCUR_READ_ONLY;
-			 *
-			 * if (vParam != SQL_CONCUR_READ_ONLY) changed = TRUE; } break;
-			 */
-
-		case SQL_CURSOR_TYPE:
-
-			/*
-			 * if declare/fetch, then type can only be forward. otherwise,
-			 * it can only be forward or static.
-			 */
-			mylog("SetStmtOption(): SQL_CURSOR_TYPE = %d\n", vParam);
-
-			if (globals.lie)
-			{
-				if (conn)
-					conn->stmtOptions.cursor_type = vParam;
-				if (stmt)
-					stmt->options.cursor_type = vParam;
-			}
-			else
-			{
-				if (globals.use_declarefetch)
-				{
-					if (conn)
-						conn->stmtOptions.cursor_type = SQL_CURSOR_FORWARD_ONLY;
-					if (stmt)
-						stmt->options.cursor_type = SQL_CURSOR_FORWARD_ONLY;
-
-					if (vParam != SQL_CURSOR_FORWARD_ONLY)
-						changed = TRUE;
-				}
-				else
-				{
-					if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC)
-					{
-						if (conn)
-							conn->stmtOptions.cursor_type = vParam;		/* valid type */
-						if (stmt)
-							stmt->options.cursor_type = vParam; /* valid type */
-					}
-					else
-					{
-						if (conn)
-							conn->stmtOptions.cursor_type = SQL_CURSOR_STATIC;
-						if (stmt)
-							stmt->options.cursor_type = SQL_CURSOR_STATIC;
-
-						changed = TRUE;
-					}
-				}
-			}
-			break;
+			if (conn) conn->stmtOptions.scroll_concurrency = SQL_CONCUR_READ_ONLY;
+			if (stmt) stmt->options.scroll_concurrency = SQL_CONCUR_READ_ONLY;
 
-		case SQL_KEYSET_SIZE:	/* ignored, but saved and returned	*/
-			mylog("SetStmtOption(): SQL_KEYSET_SIZE, vParam = %d\n", vParam);
+			if (vParam != SQL_CONCUR_READ_ONLY)
+				changed = TRUE;
+		}
+		break;
+		*/
+		
+	case SQL_CURSOR_TYPE:
+		/*	if declare/fetch, then type can only be forward.
+			otherwise, it can only be forward or static.
+		*/
+		mylog("SetStmtOption(): SQL_CURSOR_TYPE = %d\n", vParam);
 
-			if (conn)
-				conn->stmtOptions.keyset_size = vParam;
-			if (stmt)
-				stmt->options.keyset_size = vParam;
+		if (globals.lie) {
 
-			break;
+			if (conn) conn->stmtOptions.cursor_type = vParam;
+			if (stmt) stmt->options.cursor_type = vParam;
 
-			/*
-			 * if (globals.lie) stmt->keyset_size = vParam; else {
-			 * stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-			 * stmt->errormsg = "Driver does not support keyset size
-			 * option"; SC_log_error(func, "", stmt); return SQL_ERROR; }
-			 */
-
-		case SQL_MAX_LENGTH:	/* ignored, but saved */
-			mylog("SetStmtOption(): SQL_MAX_LENGTH, vParam = %d\n", vParam);
-			if (conn)
-				conn->stmtOptions.maxLength = vParam;
-			if (stmt)
-				stmt->options.maxLength = vParam;
-			break;
+		}
+		else {
+			if (globals.use_declarefetch) {
 
-		case SQL_MAX_ROWS:		/* ignored, but saved */
-			mylog("SetStmtOption(): SQL_MAX_ROWS, vParam = %d\n", vParam);
-			if (conn)
-				conn->stmtOptions.maxRows = vParam;
-			if (stmt)
-				stmt->options.maxRows = vParam;
-			break;
+				if (conn) conn->stmtOptions.cursor_type = SQL_CURSOR_FORWARD_ONLY;
+				if (stmt) stmt->options.cursor_type = SQL_CURSOR_FORWARD_ONLY;
 
-		case SQL_NOSCAN:		/* ignored */
-			mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam);
-			break;
+				if (vParam != SQL_CURSOR_FORWARD_ONLY) 
+					changed = TRUE;
+			}
+			else {
+				if (vParam == SQL_CURSOR_FORWARD_ONLY || vParam == SQL_CURSOR_STATIC) {
 
-		case SQL_QUERY_TIMEOUT:/* ignored */
-			mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
-			/* "0" returned in SQLGetStmtOption */
-			break;
+					if (conn) conn->stmtOptions.cursor_type = vParam;		/* valid type */
+					if (stmt) stmt->options.cursor_type = vParam;		/* valid type */
+				}
+				else {
 
-		case SQL_RETRIEVE_DATA:/* ignored, but saved */
-			mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
-			if (conn)
-				conn->stmtOptions.retrieve_data = vParam;
-			if (stmt)
-				stmt->options.retrieve_data = vParam;
-			break;
+					if (conn) conn->stmtOptions.cursor_type = SQL_CURSOR_STATIC;
+					if (stmt) stmt->options.cursor_type = SQL_CURSOR_STATIC;
 
-		case SQL_ROWSET_SIZE:
-			mylog("SetStmtOption(): SQL_ROWSET_SIZE, vParam = %d\n", vParam);
+					changed = TRUE;
+				}
+			}
+		}
+		break;
 
+	case SQL_KEYSET_SIZE: /* ignored, but saved and returned  */
+		mylog("SetStmtOption(): SQL_KEYSET_SIZE, vParam = %d\n", vParam);
 
-			/*
-			 * Save old rowset size for SQLExtendedFetch purposes If the
-			 * rowset_size is being changed since the last call to fetch
-			 * rows.
-			 */
+		if (conn) conn->stmtOptions.keyset_size = vParam;
+		if (stmt) stmt->options.keyset_size = vParam;
 
-			if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0)
-				stmt->save_rowset_size = stmt->options.rowset_size;
+		break;
 
-			if (vParam < 1)
-			{
-				vParam = 1;
-				changed = TRUE;
-			}
+		/*
+		if (globals.lie)
+			stmt->keyset_size = vParam;
+		else {
+			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			stmt->errormsg = "Driver does not support keyset size option";
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
+		}
+		*/
+
+	case SQL_MAX_LENGTH:/* ignored, but saved */
+		mylog("SetStmtOption(): SQL_MAX_LENGTH, vParam = %d\n", vParam);
+		if (conn) conn->stmtOptions.maxLength = vParam;
+		if (stmt) stmt->options.maxLength = vParam;
+		break;
+
+	case SQL_MAX_ROWS: /* ignored, but saved */
+		mylog("SetStmtOption(): SQL_MAX_ROWS, vParam = %d\n", vParam);
+		if (conn) conn->stmtOptions.maxRows = vParam;
+		if (stmt) stmt->options.maxRows = vParam;
+		break;
+
+	case SQL_NOSCAN: /* ignored */
+		mylog("SetStmtOption: SQL_NOSCAN, vParam = %d\n", vParam);
+		break;
+
+	case SQL_QUERY_TIMEOUT: /* ignored */
+		mylog("SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d\n", vParam);
+		/*	"0" returned in SQLGetStmtOption */
+		break;
+
+	case SQL_RETRIEVE_DATA: /* ignored, but saved */
+		mylog("SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d\n", vParam);
+		if (conn) conn->stmtOptions.retrieve_data = vParam;
+		if (stmt) stmt->options.retrieve_data = vParam;
+		break;
+
+	case SQL_ROWSET_SIZE:
+		mylog("SetStmtOption(): SQL_ROWSET_SIZE, vParam = %d\n", vParam);
+
+
+		/*	Save old rowset size for SQLExtendedFetch purposes 
+			If the rowset_size is being changed since the last call
+			to fetch rows.
+		*/
+
+		if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0 )
+			stmt->save_rowset_size = stmt->options.rowset_size;
+
+		if (vParam < 1) {
+			vParam = 1;
+			changed = TRUE;
+		}
 
-			if (conn)
-				conn->stmtOptions.rowset_size = vParam;
-			if (stmt)
-				stmt->options.rowset_size = vParam;
+		if (conn) conn->stmtOptions.rowset_size = vParam;
+		if (stmt) stmt->options.rowset_size = vParam;
 
-			break;
+		break;
 
-		case SQL_SIMULATE_CURSOR:		/* NOT SUPPORTED */
-			if (stmt)
-			{
-				stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-				stmt->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
-				SC_log_error(func, "", stmt);
-			}
-			if (conn)
-			{
-				conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-				conn->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
-				CC_log_error(func, "", conn);
-			}
-			return SQL_ERROR;
+	case SQL_SIMULATE_CURSOR: /* NOT SUPPORTED */
+		if (stmt) {
+			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			stmt->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
+			SC_log_error(func, "", stmt);
+		}
+		if (conn) {
+			conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			conn->errormsg = "Simulated positioned update/delete not supported.  Use the cursor library.";
+			CC_log_error(func, "", conn);
+		}
+		return SQL_ERROR;
 
-		case SQL_USE_BOOKMARKS:
+	case SQL_USE_BOOKMARKS:
 
-			if (stmt)
-				stmt->options.use_bookmarks = vParam;
-			if (conn)
-				conn->stmtOptions.use_bookmarks = vParam;
-			break;
+		if (stmt) stmt->options.use_bookmarks = vParam;
+		if (conn) conn->stmtOptions.use_bookmarks = vParam;
+		break;
 
-		default:
-			{
-				char		option[64];
-
-				if (stmt)
-				{
-					stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-					stmt->errormsg = "Unknown statement option (Set)";
-					sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
-					SC_log_error(func, option, stmt);
-				}
-				if (conn)
-				{
-					conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-					conn->errormsg = "Unknown statement option (Set)";
-					sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
-					CC_log_error(func, option, conn);
-				}
+    default:
+		{
+		char option[64];
 
-				return SQL_ERROR;
-			}
-	}
+		if (stmt) {
+			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			stmt->errormsg = "Unknown statement option (Set)";
+			sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+			SC_log_error(func, option, stmt);
+		}
+		if (conn) {
+			conn->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+			conn->errormsg = "Unknown statement option (Set)";
+			sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+			CC_log_error(func, option, conn);
+		}
 
-	if (changed)
-	{
-		if (stmt)
-		{
+        return SQL_ERROR;
+		}
+    }
+
+	if (changed) {
+		if (stmt) {
 			stmt->errormsg = "Requested value changed.";
 			stmt->errornumber = STMT_OPTION_VALUE_CHANGED;
 		}
-		if (conn)
-		{
+		if (conn) {
 			conn->errormsg = "Requested value changed.";
 			conn->errornumber = STMT_OPTION_VALUE_CHANGED;
 		}
@@ -284,144 +251,133 @@ set_statement_option(ConnectionClass *conn,
 
 
 /* Implements only SQL_AUTOCOMMIT */
-RETCODE SQL_API
-SQLSetConnectOption(
-					HDBC hdbc,
-					UWORD fOption,
-					UDWORD vParam)
+RETCODE SQL_API SQLSetConnectOption(
+        HDBC    hdbc,
+        UWORD   fOption,
+        UDWORD  vParam)
 {
-	static char *func = "SQLSetConnectOption";
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	char		changed = FALSE;
-	RETCODE		retval;
-	int			i;
+static char *func="SQLSetConnectOption";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+char changed = FALSE;
+RETCODE retval;
+int i;
 
 	mylog("%s: entering...\n", func);
 
-	if (!conn)
-	{
+	if ( ! conn)  {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 
-	switch (fOption)
-	{
-
-			/*
-			 * Statement Options (apply to all stmts on the connection and
-			 * become defaults for new stmts)
-			 */
-		case SQL_ASYNC_ENABLE:
-		case SQL_BIND_TYPE:
-		case SQL_CONCURRENCY:
-		case SQL_CURSOR_TYPE:
-		case SQL_KEYSET_SIZE:
-		case SQL_MAX_LENGTH:
-		case SQL_MAX_ROWS:
-		case SQL_NOSCAN:
-		case SQL_QUERY_TIMEOUT:
-		case SQL_RETRIEVE_DATA:
-		case SQL_ROWSET_SIZE:
-		case SQL_SIMULATE_CURSOR:
-		case SQL_USE_BOOKMARKS:
-
-			/* Affect all current Statements */
-			for (i = 0; i < conn->num_stmts; i++)
-			{
-				if (conn->stmts[i])
-					set_statement_option(NULL, conn->stmts[i], fOption, vParam);
-			}
-
-			/*
-			 * Become the default for all future statements on this
-			 * connection
-			 */
-			retval = set_statement_option(conn, NULL, fOption, vParam);
-
-			if (retval == SQL_SUCCESS_WITH_INFO)
-				changed = TRUE;
-			else if (retval == SQL_ERROR)
-				return SQL_ERROR;
-
-			break;
-
-			/**********************************/
-			/*****	Connection Options	*******/
-			/**********************************/
-
-		case SQL_ACCESS_MODE:	/* ignored */
-			break;
-
-		case SQL_AUTOCOMMIT:
-
-			if (CC_is_in_trans(conn))
-			{
-				conn->errormsg = "Cannot switch commit mode while a transaction is in progress";
-				conn->errornumber = CONN_TRANSACT_IN_PROGRES;
-				CC_log_error(func, "", conn);
-				return SQL_ERROR;
+	switch (fOption) {
+	/* Statement Options 
+	   (apply to all stmts on the connection and become defaults for new stmts)
+	*/
+	case SQL_ASYNC_ENABLE:
+	case SQL_BIND_TYPE:		
+	case SQL_CONCURRENCY:
+	case SQL_CURSOR_TYPE:
+	case SQL_KEYSET_SIZE: 
+	case SQL_MAX_LENGTH:
+	case SQL_MAX_ROWS:
+	case SQL_NOSCAN: 
+	case SQL_QUERY_TIMEOUT:
+	case SQL_RETRIEVE_DATA:
+	case SQL_ROWSET_SIZE:
+	case SQL_SIMULATE_CURSOR:
+	case SQL_USE_BOOKMARKS:
+
+		/*	Affect all current Statements */
+		for (i = 0; i < conn->num_stmts; i++) {
+			if ( conn->stmts[i]) {
+				set_statement_option(NULL, conn->stmts[i], fOption, vParam);
 			}
+		}
 
-			mylog("SQLSetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, vParam);
-
-			switch (vParam)
-			{
-				case SQL_AUTOCOMMIT_OFF:
-					CC_set_autocommit_off(conn);
-					break;
+		/*	Become the default for all future statements on this connection */
+		retval = set_statement_option(conn, NULL, fOption, vParam);
 
-				case SQL_AUTOCOMMIT_ON:
-					CC_set_autocommit_on(conn);
-					break;
+		if (retval == SQL_SUCCESS_WITH_INFO)
+			changed = TRUE;
+		else if (retval == SQL_ERROR)
+			return SQL_ERROR;
 
-				default:
-					conn->errormsg = "Illegal parameter value for SQL_AUTOCOMMIT";
-					conn->errornumber = CONN_INVALID_ARGUMENT_NO;
-					CC_log_error(func, "", conn);
-					return SQL_ERROR;
-			}
+		break;
 
-			break;
+	/**********************************/
+	/*****	Connection Options  *******/	
+	/**********************************/
 
-		case SQL_CURRENT_QUALIFIER:		/* ignored */
-			break;
+	case SQL_ACCESS_MODE: /* ignored */
+		break;
 
-		case SQL_LOGIN_TIMEOUT:/* ignored */
-			break;
+	case SQL_AUTOCOMMIT:
 
-		case SQL_PACKET_SIZE:	/* ignored */
-			break;
+		if (CC_is_in_trans(conn)) {
+			conn->errormsg = "Cannot switch commit mode while a transaction is in progress";
+			conn->errornumber = CONN_TRANSACT_IN_PROGRES;
+			CC_log_error(func, "", conn);
+			return SQL_ERROR;
+		}
 
-		case SQL_QUIET_MODE:	/* ignored */
-			break;
+		mylog("SQLSetConnectOption: AUTOCOMMIT: transact_status=%d, vparam=%d\n", conn->transact_status, vParam);
 
-		case SQL_TXN_ISOLATION:/* ignored */
+		switch(vParam) {
+		case SQL_AUTOCOMMIT_OFF:
+			CC_set_autocommit_off(conn);
 			break;
 
-			/* These options should be handled by driver manager */
-		case SQL_ODBC_CURSORS:
-		case SQL_OPT_TRACE:
-		case SQL_OPT_TRACEFILE:
-		case SQL_TRANSLATE_DLL:
-		case SQL_TRANSLATE_OPTION:
-			CC_log_error(func, "This connect option (Set) is only used by the Driver Manager", conn);
+		case SQL_AUTOCOMMIT_ON:
+			CC_set_autocommit_on(conn);
 			break;
 
 		default:
-			{
-				char		option[64];
+			conn->errormsg = "Illegal parameter value for SQL_AUTOCOMMIT";
+			conn->errornumber = CONN_INVALID_ARGUMENT_NO;
+			CC_log_error(func, "", conn);
+			return SQL_ERROR;
+		}
 
-				conn->errormsg = "Unknown connect option (Set)";
-				conn->errornumber = CONN_UNSUPPORTED_OPTION;
-				sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
-				CC_log_error(func, option, conn);
-				return SQL_ERROR;
-			}
-	}
+		break;
+
+	case SQL_CURRENT_QUALIFIER: /* ignored */
+		break;
+
+	case SQL_LOGIN_TIMEOUT: /* ignored */
+		break;
+
+	case SQL_PACKET_SIZE:	/* ignored */
+		break;
+
+	case SQL_QUIET_MODE:	/* ignored */
+		break;
+
+	case SQL_TXN_ISOLATION: /* ignored */
+		break;
+		
+	/*	These options should be handled by driver manager */
+	case SQL_ODBC_CURSORS:
+	case SQL_OPT_TRACE:
+	case SQL_OPT_TRACEFILE:
+	case SQL_TRANSLATE_DLL:
+	case SQL_TRANSLATE_OPTION:
+		CC_log_error(func, "This connect option (Set) is only used by the Driver Manager", conn);
+		break;
+
+	default:
+		{ 
+		char option[64];
+		conn->errormsg = "Unknown connect option (Set)";
+		conn->errornumber = CONN_UNSUPPORTED_OPTION;
+		sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+		CC_log_error(func, option, conn);
+		return SQL_ERROR;
+		}
 
-	if (changed)
-	{
+	}    
+
+	if (changed) {
 		conn->errornumber = CONN_OPTION_VALUE_CHANGED;
 		conn->errormsg = "Requested value changed.";
 		return SQL_SUCCESS_WITH_INFO;
@@ -430,94 +386,90 @@ SQLSetConnectOption(
 		return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
 /* This function just can tell you whether you are in Autcommit mode or not */
-RETCODE SQL_API
-SQLGetConnectOption(
-					HDBC hdbc,
-					UWORD fOption,
-					PTR pvParam)
+RETCODE SQL_API SQLGetConnectOption(
+        HDBC    hdbc,
+        UWORD   fOption,
+        PTR     pvParam)
 {
-	static char *func = "SQLGetConnectOption";
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
+static char *func="SQLGetConnectOption";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
 
 	mylog("%s: entering...\n", func);
 
-	if (!conn)
-	{
+	if (! conn)  {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	switch (fOption)
-	{
-		case SQL_ACCESS_MODE:	/* NOT SUPPORTED */
-			*((UDWORD *) pvParam) = SQL_MODE_READ_WRITE;
-			break;
+	switch (fOption) {
+	case SQL_ACCESS_MODE:/* NOT SUPPORTED */
+		*((UDWORD *) pvParam) = SQL_MODE_READ_WRITE;
+		break;
 
-		case SQL_AUTOCOMMIT:
-			*((UDWORD *) pvParam) = (UDWORD) (CC_is_in_autocommit(conn) ?
-								 SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
-			break;
+	case SQL_AUTOCOMMIT:
+		*((UDWORD *)pvParam) = (UDWORD)( CC_is_in_autocommit(conn) ?
+						SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF);
+		break;
 
-		case SQL_CURRENT_QUALIFIER:		/* don't use qualifiers */
-			if (pvParam)
-				strcpy(pvParam, "");
+	case SQL_CURRENT_QUALIFIER:	/* don't use qualifiers */
+		if(pvParam)
+			strcpy(pvParam, "");
 
-			break;
+		break;
 
-		case SQL_LOGIN_TIMEOUT:/* NOT SUPPORTED */
-			*((UDWORD *) pvParam) = 0;
-			break;
+	case SQL_LOGIN_TIMEOUT: /* NOT SUPPORTED */
+		*((UDWORD *) pvParam) = 0;
+		break;
 
-		case SQL_PACKET_SIZE:	/* NOT SUPPORTED */
-			*((UDWORD *) pvParam) = globals.socket_buffersize;
-			break;
+	case SQL_PACKET_SIZE: /* NOT SUPPORTED */
+		*((UDWORD *) pvParam) = globals.socket_buffersize;
+		break;
 
-		case SQL_QUIET_MODE:	/* NOT SUPPORTED */
-			*((UDWORD *) pvParam) = (UDWORD) NULL;
-			break;
+	case SQL_QUIET_MODE:/* NOT SUPPORTED */
+		*((UDWORD *) pvParam) = (UDWORD) NULL;
+		break;
 
-		case SQL_TXN_ISOLATION:/* NOT SUPPORTED */
-			*((UDWORD *) pvParam) = SQL_TXN_SERIALIZABLE;
-			break;
+	case SQL_TXN_ISOLATION:/* NOT SUPPORTED */
+		*((UDWORD *) pvParam) = SQL_TXN_SERIALIZABLE;
+		break;
 
-			/* These options should be handled by driver manager */
-		case SQL_ODBC_CURSORS:
-		case SQL_OPT_TRACE:
-		case SQL_OPT_TRACEFILE:
-		case SQL_TRANSLATE_DLL:
-		case SQL_TRANSLATE_OPTION:
-			CC_log_error(func, "This connect option (Get) is only used by the Driver Manager", conn);
-			break;
+	/*	These options should be handled by driver manager */
+	case SQL_ODBC_CURSORS:
+	case SQL_OPT_TRACE:
+	case SQL_OPT_TRACEFILE:
+	case SQL_TRANSLATE_DLL:
+	case SQL_TRANSLATE_OPTION:
+		CC_log_error(func, "This connect option (Get) is only used by the Driver Manager", conn);
+		break;
 
-		default:
-			{
-				char		option[64];
+	default:
+		{
+		char option[64];
+		conn->errormsg = "Unknown connect option (Get)";
+		conn->errornumber = CONN_UNSUPPORTED_OPTION;
+		sprintf(option, "fOption=%d", fOption);
+		CC_log_error(func, option, conn);
+		return SQL_ERROR;
+		break;
+		}
 
-				conn->errormsg = "Unknown connect option (Get)";
-				conn->errornumber = CONN_UNSUPPORTED_OPTION;
-				sprintf(option, "fOption=%d", fOption);
-				CC_log_error(func, option, conn);
-				return SQL_ERROR;
-				break;
-			}
-	}
+	}    
 
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLSetStmtOption(
-				 HSTMT hstmt,
-				 UWORD fOption,
-				 UDWORD vParam)
+RETCODE SQL_API SQLSetStmtOption(
+        HSTMT   hstmt,
+        UWORD   fOption,
+        UDWORD  vParam)
 {
-	static char *func = "SQLSetStmtOption";
-	StatementClass *stmt = (StatementClass *) hstmt;
+static char *func="SQLSetStmtOption";
+StatementClass *stmt = (StatementClass *) hstmt;
 
 	mylog("%s: entering...\n", func);
 
@@ -525,8 +477,7 @@ SQLSetStmtOption(
 	/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
 	/* and expects the driver to reduce it to the real value */
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -535,17 +486,16 @@ SQLSetStmtOption(
 }
 
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
-RETCODE SQL_API
-SQLGetStmtOption(
-				 HSTMT hstmt,
-				 UWORD fOption,
-				 PTR pvParam)
+RETCODE SQL_API SQLGetStmtOption(
+        HSTMT   hstmt,
+        UWORD   fOption,
+        PTR     pvParam)
 {
-	static char *func = "SQLGetStmtOption";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *res;
+static char *func="SQLGetStmtOption";
+StatementClass *stmt = (StatementClass *) hstmt;
+QResultClass *res;
 
 	mylog("%s: entering...\n", func);
 
@@ -553,123 +503,115 @@ SQLGetStmtOption(
 	/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
 	/* and expects the driver to reduce it to the real value */
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	switch (fOption)
-	{
-		case SQL_GET_BOOKMARK:
-		case SQL_ROW_NUMBER:
-
-			res = stmt->result;
-
-			if (stmt->manual_result || !globals.use_declarefetch)
-			{
-				/* make sure we're positioned on a valid row */
-				if ((stmt->currTuple < 0) ||
-					(stmt->currTuple >= QR_get_num_tuples(res)))
-				{
-					stmt->errormsg = "Not positioned on a valid row.";
-					stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
-					SC_log_error(func, "", stmt);
-					return SQL_ERROR;
-				}
-			}
-			else
-			{
-				if (stmt->currTuple == -1 || !res || !res->tupleField)
-				{
-					stmt->errormsg = "Not positioned on a valid row.";
-					stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
-					SC_log_error(func, "", stmt);
-					return SQL_ERROR;
-				}
-			}
+	switch(fOption) {
+	case SQL_GET_BOOKMARK:
+	case SQL_ROW_NUMBER:
+
+		res = stmt->result;
 
-			if (fOption == SQL_GET_BOOKMARK && stmt->options.use_bookmarks == SQL_UB_OFF)
-			{
-				stmt->errormsg = "Operation invalid because use bookmarks not enabled.";
-				stmt->errornumber = STMT_OPERATION_INVALID;
+		if ( stmt->manual_result || ! globals.use_declarefetch) {
+			/* make sure we're positioned on a valid row */
+			if((stmt->currTuple < 0) ||
+			   (stmt->currTuple >= QR_get_num_tuples(res))) {
+				stmt->errormsg = "Not positioned on a valid row.";
+				stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
+				SC_log_error(func, "", stmt);
+				return SQL_ERROR;
+			}
+		}
+		else {
+			if (stmt->currTuple == -1 || ! res || ! res->tupleField) {
+				stmt->errormsg = "Not positioned on a valid row.";
+				stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
 				SC_log_error(func, "", stmt);
 				return SQL_ERROR;
 			}
+		}
 
-			*((UDWORD *) pvParam) = SC_get_bookmark(stmt);
+		if (fOption == SQL_GET_BOOKMARK && stmt->options.use_bookmarks == SQL_UB_OFF) {
+			stmt->errormsg = "Operation invalid because use bookmarks not enabled.";
+			stmt->errornumber = STMT_OPERATION_INVALID;
+			SC_log_error(func, "", stmt);
+			return SQL_ERROR;
+		}
 
-			break;
+		*((UDWORD *) pvParam) = SC_get_bookmark(stmt);
+		
+		break;
 
-		case SQL_ASYNC_ENABLE:	/* NOT SUPPORTED */
-			*((SDWORD *) pvParam) = SQL_ASYNC_ENABLE_OFF;
-			break;
+	case SQL_ASYNC_ENABLE:	/* NOT SUPPORTED */
+		*((SDWORD *) pvParam) = SQL_ASYNC_ENABLE_OFF;
+		break;
 
-		case SQL_BIND_TYPE:
-			*((SDWORD *) pvParam) = stmt->options.bind_size;
-			break;
+	case SQL_BIND_TYPE:
+		*((SDWORD *) pvParam) = stmt->options.bind_size;
+		break;
 
-		case SQL_CONCURRENCY:	/* NOT REALLY SUPPORTED */
-			mylog("GetStmtOption(): SQL_CONCURRENCY\n");
-			*((SDWORD *) pvParam) = stmt->options.scroll_concurrency;
-			break;
+	case SQL_CONCURRENCY: /* NOT REALLY SUPPORTED */
+		mylog("GetStmtOption(): SQL_CONCURRENCY\n");
+		*((SDWORD *)pvParam) = stmt->options.scroll_concurrency;
+		break;
 
-		case SQL_CURSOR_TYPE:	/* PARTIAL SUPPORT */
-			mylog("GetStmtOption(): SQL_CURSOR_TYPE\n");
-			*((SDWORD *) pvParam) = stmt->options.cursor_type;
-			break;
+	case SQL_CURSOR_TYPE: /* PARTIAL SUPPORT */
+		mylog("GetStmtOption(): SQL_CURSOR_TYPE\n");
+		*((SDWORD *)pvParam) = stmt->options.cursor_type;
+		break;
 
-		case SQL_KEYSET_SIZE:	/* NOT SUPPORTED, but saved */
-			mylog("GetStmtOption(): SQL_KEYSET_SIZE\n");
-			*((SDWORD *) pvParam) = stmt->options.keyset_size;
-			break;
+	case SQL_KEYSET_SIZE: /* NOT SUPPORTED, but saved */
+		mylog("GetStmtOption(): SQL_KEYSET_SIZE\n");
+		*((SDWORD *)pvParam) = stmt->options.keyset_size;
+		break;
 
-		case SQL_MAX_LENGTH:	/* NOT SUPPORTED, but saved */
-			*((SDWORD *) pvParam) = stmt->options.maxLength;
-			break;
+	case SQL_MAX_LENGTH: /* NOT SUPPORTED, but saved */
+		*((SDWORD *)pvParam) = stmt->options.maxLength;
+		break;
 
-		case SQL_MAX_ROWS:		/* NOT SUPPORTED, but saved */
-			*((SDWORD *) pvParam) = stmt->options.maxRows;
-			mylog("GetSmtOption: MAX_ROWS, returning %d\n", stmt->options.maxRows);
-			break;
+	case SQL_MAX_ROWS: /* NOT SUPPORTED, but saved */
+		*((SDWORD *)pvParam) = stmt->options.maxRows;
+		mylog("GetSmtOption: MAX_ROWS, returning %d\n", stmt->options.maxRows);
+		break;
 
-		case SQL_NOSCAN:		/* NOT SUPPORTED */
-			*((SDWORD *) pvParam) = SQL_NOSCAN_ON;
-			break;
+	case SQL_NOSCAN:/* NOT SUPPORTED */
+		*((SDWORD *) pvParam) = SQL_NOSCAN_ON;
+		break;
 
-		case SQL_QUERY_TIMEOUT:/* NOT SUPPORTED */
-			*((SDWORD *) pvParam) = 0;
-			break;
+	case SQL_QUERY_TIMEOUT: /* NOT SUPPORTED */
+		*((SDWORD *) pvParam) = 0;
+		break;
 
-		case SQL_RETRIEVE_DATA:/* NOT SUPPORTED, but saved */
-			*((SDWORD *) pvParam) = stmt->options.retrieve_data;
-			break;
+	case SQL_RETRIEVE_DATA: /* NOT SUPPORTED, but saved */
+		*((SDWORD *) pvParam) = stmt->options.retrieve_data;
+		break;
 
-		case SQL_ROWSET_SIZE:
-			*((SDWORD *) pvParam) = stmt->options.rowset_size;
-			break;
+	case SQL_ROWSET_SIZE:
+		*((SDWORD *) pvParam) = stmt->options.rowset_size;
+		break;
 
-		case SQL_SIMULATE_CURSOR:		/* NOT SUPPORTED */
-			*((SDWORD *) pvParam) = SQL_SC_NON_UNIQUE;
-			break;
+	case SQL_SIMULATE_CURSOR:/* NOT SUPPORTED */
+		*((SDWORD *) pvParam) = SQL_SC_NON_UNIQUE;
+		break;
 
-		case SQL_USE_BOOKMARKS:
-			*((SDWORD *) pvParam) = stmt->options.use_bookmarks;
-			break;
-
-		default:
-			{
-				char		option[64];
+	case SQL_USE_BOOKMARKS:
+		*((SDWORD *) pvParam) = stmt->options.use_bookmarks;
+		break;
 
-				stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
-				stmt->errormsg = "Unknown statement option (Get)";
-				sprintf(option, "fOption=%d", fOption);
-				SC_log_error(func, option, stmt);
-				return SQL_ERROR;
-			}
+	default:
+		{
+		char option[64];
+		stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
+		stmt->errormsg = "Unknown statement option (Get)";
+		sprintf(option, "fOption=%d", fOption);
+		SC_log_error(func, option, stmt);
+		return SQL_ERROR;
+		}
 	}
 
 	return SQL_SUCCESS;
 }
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
diff --git a/src/interfaces/odbc/parse.c b/src/interfaces/odbc/parse.c
index db0b3eba862aaffad841e1be16e2d9bd3833847b..690a902ec4b937129f7123a18de5ce71fd691bbc 100644
--- a/src/interfaces/odbc/parse.c
+++ b/src/interfaces/odbc/parse.c
@@ -1,19 +1,20 @@
-/* Module:			parse.c
+
+/* Module:          parse.c
  *
- * Description:		This module contains routines related to parsing SQL statements.
- *					This can be useful for two reasons:
+ * Description:     This module contains routines related to parsing SQL statements.
+ *                  This can be useful for two reasons:
  *
- *					1. So the query does not actually have to be executed to return data about it
+ *                  1. So the query does not actually have to be executed to return data about it
  *
- *					2. To be able to return information about precision, nullability, aliases, etc.
- *					   in the functions SQLDescribeCol and SQLColAttributes.  Currently, Postgres
- *					   doesn't return any information about these things in a query.
+ *                  2. To be able to return information about precision, nullability, aliases, etc.
+ *                     in the functions SQLDescribeCol and SQLColAttributes.  Currently, Postgres
+ *                     doesn't return any information about these things in a query.
  *
- * Classes:			none
+ * Classes:         none
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -28,7 +29,7 @@
 
 #ifndef WIN32
 #ifndef HAVE_STRICMP
-#define stricmp(s1,s2)		strcasecmp(s1,s2)
+#define stricmp(s1,s2) 		strcasecmp(s1,s2)
 #define strnicmp(s1,s2,n)	strncasecmp(s1,s2,n)
 #endif
 #endif
@@ -37,17 +38,16 @@
 #define TAB_INCR	8
 #define COL_INCR	16
 
-char	   *getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric);
-void		getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k);
-char		searchColInfo(COL_INFO *col_info, FIELD_INFO *fi);
+char *getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric);
+void getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k);
+char searchColInfo(COL_INFO *col_info, FIELD_INFO *fi);
 
 char *
 getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dquote, char *numeric)
 {
-	int			i = 0;
-	int			out = 0;
-	char		qc,
-				in_escape = FALSE;
+int i = 0;
+int out = 0;
+char qc, in_escape = FALSE;
 
 	if (smax <= 1)
 		return NULL;
@@ -55,54 +55,44 @@ getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dqu
 	smax--;
 
 	/* skip leading delimiters */
-	while (isspace((unsigned char) s[i]) || s[i] == ',')
-	{
+	while (isspace((unsigned char) s[i]) || s[i] == ',') {
 		/* mylog("skipping '%c'\n", s[i]); */
 		i++;
 	}
 
-	if (s[0] == '\0')
-	{
+	if (s[0] == '\0') {
 		token[0] = '\0';
 		return NULL;
 	}
 
-	if (quote)
-		*quote = FALSE;
-	if (dquote)
-		*dquote = FALSE;
-	if (numeric)
-		*numeric = FALSE;
+	if (quote) *quote = FALSE;
+	if (dquote) *dquote = FALSE;
+	if (numeric) *numeric = FALSE;
 
 	/* get the next token */
-	while (!isspace((unsigned char) s[i]) && s[i] != ',' &&
-		   s[i] != '\0' && out != smax)
-	{
-		/* Handle quoted stuff */
-		if (out == 0 && (s[i] == '\"' || s[i] == '\''))
-		{
+	while ( ! isspace((unsigned char) s[i]) && s[i] != ',' &&
+			s[i] != '\0' && out != smax) {
+
+		/*	Handle quoted stuff */
+		if ( out == 0 && (s[i] == '\"' || s[i] == '\'')) {
 			qc = s[i];
-			if (qc == '\"')
-			{
-				if (dquote)
-					*dquote = TRUE;
+			if (qc == '\"') {
+				if (dquote) *dquote = TRUE;
 			}
-			if (qc == '\'')
-			{
-				if (quote)
-					*quote = TRUE;
+			if (qc == '\'') {
+				if (quote) *quote = TRUE;
 			}
 
-			i++;				/* dont return the quote */
-			while (s[i] != '\0' && out != smax)
-			{
-				if (s[i] == qc && !in_escape)
+			i++;		/* dont return the quote */
+			while (s[i] != '\0' && out != smax) {  
+				if (s[i] == qc && ! in_escape) {
 					break;
-				if (s[i] == '\\' && !in_escape)
+				}
+				if (s[i] == '\\' && ! in_escape) {
 					in_escape = TRUE;
-				else
-				{
-					in_escape = FALSE;
+				}
+				else {
+					in_escape = FALSE;	
 					token[out++] = s[i];
 				}
 				i++;
@@ -112,24 +102,20 @@ getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dqu
 			break;
 		}
 
-		/* Check for numeric literals */
-		if (out == 0 && isdigit((unsigned char) s[i]))
-		{
-			if (numeric)
-				*numeric = TRUE;
+		/*	Check for numeric literals */
+		if ( out == 0 && isdigit((unsigned char) s[i])) {
+			if (numeric) *numeric = TRUE;
 			token[out++] = s[i++];
-			while (isalnum((unsigned char) s[i]) || s[i] == '.')
+			while ( isalnum((unsigned char) s[i]) || s[i] == '.')
 				token[out++] = s[i++];
 
 			break;
 		}
 
-		if (ispunct((unsigned char) s[i]) && s[i] != '_')
-		{
+		if ( ispunct((unsigned char) s[i]) && s[i] != '_') {
 			mylog("got ispunct: s[%d] = '%c'\n", i, s[i]);
 
-			if (out == 0)
-			{
+			if (out == 0) {
 				token[out++] = s[i++];
 				break;
 			}
@@ -147,30 +133,25 @@ getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dqu
 
 	token[out] = '\0';
 
-	/* find the delimiter  */
-	while (isspace((unsigned char) s[i]))
+	/*	find the delimiter  */
+	while ( isspace((unsigned char) s[i]))
 		i++;
 
-	/* return the most priority delimiter */
-	if (s[i] == ',')
-	{
-		if (delim)
-			*delim = s[i];
+	/*	return the most priority delimiter */
+	if (s[i] == ',')  {
+		if (delim) *delim = s[i];
 	}
-	else if (s[i] == '\0')
-	{
-		if (delim)
-			*delim = '\0';
+	else if (s[i] == '\0') {
+		if (delim) *delim = '\0';
 	}
-	else
-	{
-		if (delim)
-			*delim = ' ';
+	else  {
+		if (delim) *delim = ' ';
 	}
 
 	/* skip trailing blanks  */
-	while (isspace((unsigned char) s[i]))
+	while ( isspace((unsigned char) s[i])) {
 		i++;
+	}
 
 	return &s[i];
 }
@@ -201,25 +182,23 @@ getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
 	if (fi->name[0] == '\0')
 		strcpy(fi->name, QR_get_value_manual(col_info->result, k, 3));
 
-	fi->type = atoi(QR_get_value_manual(col_info->result, k, 13));
-	fi->precision = atoi(QR_get_value_manual(col_info->result, k, 6));
-	fi->length = atoi(QR_get_value_manual(col_info->result, k, 7));
-	fi->nullable = atoi(QR_get_value_manual(col_info->result, k, 10));
-	fi->display_size = atoi(QR_get_value_manual(col_info->result, k, 12));
+	fi->type = atoi( QR_get_value_manual(col_info->result, k, 13));
+	fi->precision = atoi( QR_get_value_manual(col_info->result, k, 6));
+	fi->length = atoi( QR_get_value_manual(col_info->result, k, 7));
+	fi->nullable = atoi( QR_get_value_manual(col_info->result, k, 10));
+	fi->display_size = atoi( QR_get_value_manual(col_info->result, k, 12));
 }
 
 char
 searchColInfo(COL_INFO *col_info, FIELD_INFO *fi)
 {
-	int			k;
-	char	   *col;
+int k;
+char *col;
 
 
-	for (k = 0; k < QR_get_num_tuples(col_info->result); k++)
-	{
+	for (k = 0; k < QR_get_num_tuples(col_info->result); k++) {
 		col = QR_get_value_manual(col_info->result, k, 3);
-		if (!strcmp(col, fi->name))
-		{
+		if ( ! strcmp(col, fi->name)) {
 			getColInfo(col_info, fi, k);
 
 			mylog("PARSE: searchColInfo: \n");
@@ -234,37 +213,20 @@ searchColInfo(COL_INFO *col_info, FIELD_INFO *fi)
 char
 parse_statement(StatementClass *stmt)
 {
-	static char *func = "parse_statement";
-	char		token[256];
-	char		delim,
-				quote,
-				dquote,
-				numeric,
-				unquoted;
-	char	   *ptr;
-	char		in_select = FALSE,
-				in_distinct = FALSE,
-				in_on = FALSE,
-				in_from = FALSE,
-				in_where = FALSE,
-				in_table = FALSE;
-	char		in_field = FALSE,
-				in_expr = FALSE,
-				in_func = FALSE,
-				in_dot = FALSE,
-				in_as = FALSE;
-	int			j,
-				i,
-				k = 0,
-				n,
-				blevel = 0;
-	FIELD_INFO **fi;
-	TABLE_INFO **ti;
-	char		parse;
-	ConnectionClass *conn = stmt->hdbc;
-	HSTMT		hcol_stmt;
-	StatementClass *col_stmt;
-	RETCODE		result;
+static char *func="parse_statement";
+char token[256];
+char delim, quote, dquote, numeric, unquoted;
+char *ptr;
+char in_select = FALSE, in_distinct = FALSE, in_on = FALSE, in_from = FALSE, in_where = FALSE, in_table = FALSE;
+char in_field = FALSE, in_expr = FALSE, in_func = FALSE, in_dot = FALSE, in_as = FALSE;
+int j, i, k = 0, n, blevel = 0;
+FIELD_INFO **fi;
+TABLE_INFO **ti;
+char parse;
+ConnectionClass *conn = stmt->hdbc;
+HSTMT hcol_stmt;
+StatementClass *col_stmt;
+RETCODE result;
 
 
 	mylog("%s: entering...\n", func);
@@ -276,38 +238,34 @@ parse_statement(StatementClass *stmt)
 	stmt->nfld = 0;
 	stmt->ntab = 0;
 
-	while ((ptr = getNextToken(ptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL)
-	{
-		unquoted = !(quote || dquote);
+	while ((ptr = getNextToken(ptr, token, sizeof(token), &delim, &quote, &dquote, &numeric)) != NULL) {
+
+		unquoted = ! ( quote || dquote );
 
 		mylog("unquoted=%d, quote=%d, dquote=%d, numeric=%d, delim='%c', token='%s', ptr='%s'\n", unquoted, quote, dquote, numeric, delim, token, ptr);
 
-		if (unquoted && !stricmp(token, "select"))
-		{
+		if ( unquoted && ! stricmp(token, "select")) {
 			in_select = TRUE;
 
 			mylog("SELECT\n");
 			continue;
 		}
 
-		if (unquoted && in_select && !stricmp(token, "distinct"))
-		{
+		if ( unquoted && in_select && ! stricmp(token, "distinct")) {
 			in_distinct = TRUE;
 
 			mylog("DISTINCT\n");
 			continue;
 		}
 
-		if (unquoted && !stricmp(token, "into"))
-		{
+		if ( unquoted && ! stricmp(token, "into")) {
 			in_select = FALSE;
 
 			mylog("INTO\n");
 			continue;
 		}
 
-		if (unquoted && !stricmp(token, "from"))
-		{
+		if ( unquoted && ! stricmp(token, "from")) {
 			in_select = FALSE;
 			in_from = TRUE;
 
@@ -315,12 +273,12 @@ parse_statement(StatementClass *stmt)
 			continue;
 		}
 
-		if (unquoted && (!stricmp(token, "where") ||
-						 !stricmp(token, "union") ||
-						 !stricmp(token, "order") ||
-						 !stricmp(token, "group") ||
-						 !stricmp(token, "having")))
-		{
+		if ( unquoted && (! stricmp(token, "where") ||
+			! stricmp(token, "union") || 
+			! stricmp(token, "order") || 
+			! stricmp(token, "group") || 
+			! stricmp(token, "having"))) {
+
 			in_select = FALSE;
 			in_from = FALSE;
 			in_where = TRUE;
@@ -329,52 +287,44 @@ parse_statement(StatementClass *stmt)
 			break;
 		}
 
-		if (in_select)
-		{
-			if (in_distinct)
-			{
+		if (in_select) {
+
+			if ( in_distinct) {
 				mylog("in distinct\n");
 
-				if (unquoted && !stricmp(token, "on"))
-				{
+				if (unquoted && ! stricmp(token, "on")) {
 					in_on = TRUE;
 					mylog("got on\n");
 					continue;
 				}
-				if (in_on)
-				{
+				if (in_on) {
 					in_distinct = FALSE;
 					in_on = FALSE;
-					continue;	/* just skip the unique on field */
+					continue;		/*	just skip the unique on field */
 				}
 				mylog("done distinct\n");
 				in_distinct = FALSE;
 			}
 
-			if (in_expr || in_func)
-			{					/* just eat the expression */
+			if ( in_expr || in_func) {		/* just eat the expression */
 				mylog("in_expr=%d or func=%d\n", in_expr, in_func);
 				if (quote || dquote)
 					continue;
 
-				if (in_expr && blevel == 0 && delim == ',')
-				{
+				if (in_expr && blevel == 0 && delim == ',') {
 					mylog("**** in_expr and Got comma\n");
 					in_expr = FALSE;
 					in_field = FALSE;
 				}
 
-				else if (token[0] == '(')
-				{
+				else if (token[0] == '(') {
 					blevel++;
 					mylog("blevel++ = %d\n", blevel);
 				}
-				else if (token[0] == ')')
-				{
+				else if (token[0] == ')') {
 					blevel--;
 					mylog("blevel-- = %d\n", blevel);
-					if (delim == ',')
-					{
+					if (delim==',') {
 						in_func = FALSE;
 						in_expr = FALSE;
 						in_field = FALSE;
@@ -383,49 +333,43 @@ parse_statement(StatementClass *stmt)
 				continue;
 			}
 
-			if (!in_field)
-			{
-				if (!token[0])
+			if ( ! in_field) {
+
+				if ( ! token[0])
 					continue;
 
-				if (!(stmt->nfld % FLD_INCR))
-				{
+				if ( ! (stmt->nfld % FLD_INCR)) {
 					mylog("reallocing at nfld=%d\n", stmt->nfld);
 					fi = (FIELD_INFO **) realloc(fi, (stmt->nfld + FLD_INCR) * sizeof(FIELD_INFO *));
-					if (!fi)
-					{
+					if ( ! fi) {
 						stmt->parse_status = STMT_PARSE_FATAL;
 						return FALSE;
 					}
 					stmt->fi = fi;
 				}
 
-				fi[stmt->nfld] = (FIELD_INFO *) malloc(sizeof(FIELD_INFO));
-				if (fi[stmt->nfld] == NULL)
-				{
+				fi[stmt->nfld] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO));
+				if (fi[stmt->nfld] == NULL) {
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
 
-				/* Initialize the field info */
+				/*	Initialize the field info */
 				memset(fi[stmt->nfld], 0, sizeof(FIELD_INFO));
 
-				/* double quotes are for qualifiers */
+				/*	double quotes are for qualifiers */
 				if (dquote)
 					fi[stmt->nfld]->dquote = TRUE;
 
-				if (quote)
-				{
+				if (quote) {
 					fi[stmt->nfld++]->quote = TRUE;
 					continue;
 				}
-				else if (numeric)
-				{
+				else if (numeric) {
 					mylog("**** got numeric: nfld = %d\n", stmt->nfld);
 					fi[stmt->nfld]->numeric = TRUE;
 				}
-				else if (token[0] == '(')
-				{				/* expression */
+				else if (token[0] == '(') {		/* expression */
 					mylog("got EXPRESSION\n");
 					fi[stmt->nfld++]->expr = TRUE;
 					in_expr = TRUE;
@@ -433,34 +377,33 @@ parse_statement(StatementClass *stmt)
 					continue;
 				}
 
-				else
-				{
+				else {
 					strcpy(fi[stmt->nfld]->name, token);
 					fi[stmt->nfld]->dot[0] = '\0';
 				}
 				mylog("got field='%s', dot='%s'\n", fi[stmt->nfld]->name, fi[stmt->nfld]->dot);
 
-				if (delim == ',')
+				if (delim == ',') {
 					mylog("comma (1)\n");
-				else
+				}
+				else {
 					in_field = TRUE;
+				}
 				stmt->nfld++;
 				continue;
 			}
 
 			/**************************/
-			/* We are in a field now */
+			/*	We are in a field now */
 			/**************************/
-			if (in_dot)
-			{
+			if (in_dot) {
 				stmt->nfld--;
 				strcpy(fi[stmt->nfld]->dot, fi[stmt->nfld]->name);
 				strcpy(fi[stmt->nfld]->name, token);
 				stmt->nfld++;
 				in_dot = FALSE;
 
-				if (delim == ',')
-				{
+				if (delim == ',') {
 					mylog("in_dot: got comma\n");
 					in_field = FALSE;
 				}
@@ -468,8 +411,7 @@ parse_statement(StatementClass *stmt)
 				continue;
 			}
 
-			if (in_as)
-			{
+			if (in_as) {
 				stmt->nfld--;
 				strcpy(fi[stmt->nfld]->alias, token);
 				mylog("alias for field '%s' is '%s'\n", fi[stmt->nfld]->name, fi[stmt->nfld]->alias);
@@ -478,67 +420,58 @@ parse_statement(StatementClass *stmt)
 
 				stmt->nfld++;
 
-				if (delim == ',')
+				if (delim == ',') {
 					mylog("comma(2)\n");
+				}
 				continue;
 			}
 
-			/* Function */
-			if (token[0] == '(')
-			{
+			/*	Function */
+			if (token[0] == '(') {
 				in_func = TRUE;
 				blevel = 1;
-				fi[stmt->nfld - 1]->func = TRUE;
-
-				/*
-				 * name will have the function name -- maybe useful some
-				 * day
-				 */
-				mylog("**** got function = '%s'\n", fi[stmt->nfld - 1]->name);
+				fi[stmt->nfld-1]->func = TRUE;
+				/*	name will have the function name -- maybe useful some day */
+				mylog("**** got function = '%s'\n", fi[stmt->nfld-1]->name);
 				continue;
 			}
 
-			if (token[0] == '.')
-			{
-				in_dot = TRUE;
+			if (token[0] == '.') {
+				in_dot = TRUE;	
 				mylog("got dot\n");
 				continue;
 			}
 
-			if (!stricmp(token, "as"))
-			{
+			if ( ! stricmp(token, "as")) {
 				in_as = TRUE;
 				mylog("got AS\n");
 				continue;
 			}
 
-			/* otherwise, it's probably an expression */
+			/*	otherwise, it's probably an expression */
 			in_expr = TRUE;
-			fi[stmt->nfld - 1]->expr = TRUE;
-			fi[stmt->nfld - 1]->name[0] = '\0';
+			fi[stmt->nfld-1]->expr = TRUE;
+			fi[stmt->nfld-1]->name[0] = '\0';
 			mylog("*** setting expression\n");
+
 		}
 
-		if (in_from)
-		{
-			if (!in_table)
-			{
-				if (!token[0])
+		if (in_from) {
+
+			if ( ! in_table) {
+				if ( ! token[0])
 					continue;
 
-				if (!(stmt->ntab % TAB_INCR))
-				{
+				if ( ! (stmt->ntab % TAB_INCR)) {
 					ti = (TABLE_INFO **) realloc(ti, (stmt->ntab + TAB_INCR) * sizeof(TABLE_INFO *));
-					if (!ti)
-					{
+					if ( ! ti) {
 						stmt->parse_status = STMT_PARSE_FATAL;
 						return FALSE;
 					}
 					stmt->ti = ti;
 				}
 				ti[stmt->ntab] = (TABLE_INFO *) malloc(sizeof(TABLE_INFO));
-				if (ti[stmt->ntab] == NULL)
-				{
+				if (ti[stmt->ntab] == NULL) {
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
@@ -548,60 +481,57 @@ parse_statement(StatementClass *stmt)
 				strcpy(ti[stmt->ntab]->name, token);
 				mylog("got table = '%s'\n", ti[stmt->ntab]->name);
 
-				if (delim == ',')
+				if (delim == ',') {
 					mylog("more than 1 tables\n");
-				else
+				}
+				else {
 					in_table = TRUE;
+				}
 				stmt->ntab++;
 				continue;
 			}
 
-			strcpy(ti[stmt->ntab - 1]->alias, token);
-			mylog("alias for table '%s' is '%s'\n", ti[stmt->ntab - 1]->name, ti[stmt->ntab - 1]->alias);
+			strcpy(ti[stmt->ntab-1]->alias, token);
+			mylog("alias for table '%s' is '%s'\n", ti[stmt->ntab-1]->name, ti[stmt->ntab-1]->alias);
 			in_table = FALSE;
-			if (delim == ',')
+			if (delim == ',') {
 				mylog("more than 1 tables\n");
+			}
 		}
 	}
 
 
 	/*************************************************/
-	/* Resolve any possible field names with tables */
+	/*	Resolve any possible field names with tables */
 	/*************************************************/
 
 	parse = TRUE;
 
-	/* Resolve field names with tables */
-	for (i = 0; i < stmt->nfld; i++)
-	{
-		if (fi[i]->func || fi[i]->expr || fi[i]->numeric)
-		{
+	/*	Resolve field names with tables */
+	for (i = 0; i < stmt->nfld; i++) {
+
+		if (fi[i]->func || fi[i]->expr || fi[i]->numeric) {
 			fi[i]->ti = NULL;
 			fi[i]->type = -1;
 			parse = FALSE;
 			continue;
 		}
 
-		else if (fi[i]->quote)
-		{						/* handle as text */
+		else if (fi[i]->quote) {		/* handle as text */
 			fi[i]->ti = NULL;
 			fi[i]->type = PG_TYPE_TEXT;
 			fi[i]->precision = 0;
 			continue;
-		}
+		} 
 
-		/* it's a dot, resolve to table or alias */
-		else if (fi[i]->dot[0])
-		{
-			for (k = 0; k < stmt->ntab; k++)
-			{
-				if (!stricmp(ti[k]->name, fi[i]->dot))
-				{
+		/*	it's a dot, resolve to table or alias */
+		else if (fi[i]->dot[0]) {
+			for (k = 0; k < stmt->ntab; k++) {
+				if ( ! stricmp(ti[k]->name, fi[i]->dot)) {
 					fi[i]->ti = ti[k];
 					break;
 				}
-				else if (!stricmp(ti[k]->alias, fi[i]->dot))
-				{
+				else if ( ! stricmp(ti[k]->alias, fi[i]->dot)) {
 					fi[i]->ti = ti[k];
 					break;
 				}
@@ -614,45 +544,41 @@ parse_statement(StatementClass *stmt)
 	mylog("--------------------------------------------\n");
 	mylog("nfld=%d, ntab=%d\n", stmt->nfld, stmt->ntab);
 
-	for (i = 0; i < stmt->nfld; i++)
-	{
+	for (i=0; i < stmt->nfld; i++) {
 		mylog("Field %d:  expr=%d, func=%d, quote=%d, dquote=%d, numeric=%d, name='%s', alias='%s', dot='%s'\n", i, fi[i]->expr, fi[i]->func, fi[i]->quote, fi[i]->dquote, fi[i]->numeric, fi[i]->name, fi[i]->alias, fi[i]->dot);
 		if (fi[i]->ti)
-			mylog("     ----> table_name='%s', table_alias='%s'\n", fi[i]->ti->name, fi[i]->ti->alias);
+		mylog("     ----> table_name='%s', table_alias='%s'\n", fi[i]->ti->name, fi[i]->ti->alias);
 	}
 
-	for (i = 0; i < stmt->ntab; i++)
+	for (i=0; i < stmt->ntab; i++) {
 		mylog("Table %d: name='%s', alias='%s'\n", i, ti[i]->name, ti[i]->alias);
+	}
 
 
 	/******************************************************/
-	/* Now save the SQLColumns Info for the parse tables */
+	/*	Now save the SQLColumns Info for the parse tables */
 	/******************************************************/
 
 
-	/* Call SQLColumns for each table and store the result */
-	for (i = 0; i < stmt->ntab; i++)
-	{
-		/* See if already got it */
-		char		found = FALSE;
+	/*	Call SQLColumns for each table and store the result */
+	for (i = 0; i < stmt->ntab; i++) {
 
-		for (k = 0; k < conn->ntables; k++)
-		{
-			if (!stricmp(conn->col_info[k]->name, ti[i]->name))
-			{
+		/*	See if already got it */
+		char found = FALSE;
+		for (k = 0; k < conn->ntables; k++) {
+			if ( ! stricmp(conn->col_info[k]->name, ti[i]->name)) {
 				mylog("FOUND col_info table='%s'\n", ti[i]->name);
 				found = TRUE;
 				break;
 			}
 		}
+				
+		if ( ! found) {
 
-		if (!found)
-		{
 			mylog("PARSE: Getting SQLColumns for table[%d]='%s'\n", i, ti[i]->name);
 
-			result = SQLAllocStmt(stmt->hdbc, &hcol_stmt);
-			if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO))
-			{
+			result = SQLAllocStmt( stmt->hdbc, &hcol_stmt);
+			if((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
 				stmt->errormsg = "SQLAllocStmt failed in parse_statement for columns.";
 				stmt->errornumber = STMT_NO_MEMORY_ERROR;
 				stmt->parse_status = STMT_PARSE_FATAL;
@@ -662,20 +588,18 @@ parse_statement(StatementClass *stmt)
 			col_stmt = (StatementClass *) hcol_stmt;
 			col_stmt->internal = TRUE;
 
-			result = SQLColumns(hcol_stmt, "", 0, "", 0,
+			result = SQLColumns(hcol_stmt, "", 0, "", 0, 
 						ti[i]->name, (SWORD) strlen(ti[i]->name), "", 0);
-
+		
 			mylog("        Past SQLColumns\n");
-			if (result == SQL_SUCCESS)
-			{
+			if (result == SQL_SUCCESS) {
 				mylog("      Success\n");
-				if (!(conn->ntables % COL_INCR))
-				{
+				if ( ! (conn->ntables % COL_INCR)) {
+
 					mylog("PARSE: Allocing col_info at ntables=%d\n", conn->ntables);
 
 					conn->col_info = (COL_INFO **) realloc(conn->col_info, (conn->ntables + COL_INCR) * sizeof(COL_INFO *));
-					if (!conn->col_info)
-					{
+					if ( ! conn->col_info) {
 						stmt->parse_status = STMT_PARSE_FATAL;
 						return FALSE;
 					}
@@ -683,23 +607,18 @@ parse_statement(StatementClass *stmt)
 
 				mylog("PARSE: malloc at conn->col_info[%d]\n", conn->ntables);
 				conn->col_info[conn->ntables] = (COL_INFO *) malloc(sizeof(COL_INFO));
-				if (!conn->col_info[conn->ntables])
-				{
+				if ( ! conn->col_info[conn->ntables]) {
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
 
-				/*
-				 * Store the table name and the SQLColumns result
-				 * structure
-				 */
+				/*	Store the table name and the SQLColumns result structure */
 				strcpy(conn->col_info[conn->ntables]->name, ti[i]->name);
 				conn->col_info[conn->ntables]->result = col_stmt->result;
 
-				/*
-				 * The connection will now free the result structures, so
-				 * make sure that the statement doesn't free it
-				 */
+				/*	The connection will now free the result structures, so make
+					sure that the statement doesn't free it 
+				*/
 				col_stmt->result = NULL;
 
 				conn->ntables++;
@@ -707,14 +626,13 @@ parse_statement(StatementClass *stmt)
 				SQLFreeStmt(hcol_stmt, SQL_DROP);
 				mylog("Created col_info table='%s', ntables=%d\n", ti[i]->name, conn->ntables);
 			}
-			else
-			{
+			else {
 				SQLFreeStmt(hcol_stmt, SQL_DROP);
 				break;
 			}
 		}
 
-		/* Associate a table from the statement with a SQLColumn info */
+		/*	Associate a table from the statement with a SQLColumn info */
 		ti[i]->col_info = conn->col_info[k];
 		mylog("associate col_info: i=%d, k=%d\n", i, k);
 	}
@@ -723,112 +641,96 @@ parse_statement(StatementClass *stmt)
 	mylog("Done SQLColumns\n");
 
 	/******************************************************/
-	/* Now resolve the fields to point to column info	 */
+	/*	Now resolve the fields to point to column info    */
 	/******************************************************/
 
 
 
-	for (i = 0; i < stmt->nfld;)
-	{
-		/* Dont worry about functions or quotes */
-		if (fi[i]->func || fi[i]->quote || fi[i]->numeric)
-		{
+	for (i = 0; i < stmt->nfld;) {
+
+		/*	Dont worry about functions or quotes */
+		if (fi[i]->func || fi[i]->quote || fi[i]->numeric) {
 			i++;
 			continue;
 		}
 
-		/* Stars get expanded to all fields in the table */
-		else if (fi[i]->name[0] == '*')
-		{
-			char		do_all_tables;
-			int			total_cols,
-						old_size,
-						need,
-						cols;
+		/*	Stars get expanded to all fields in the table */
+		else if (fi[i]->name[0] == '*') {
+
+			char do_all_tables;
+			int total_cols, old_size, need, cols;
 
 			mylog("expanding field %d\n", i);
 
-			total_cols = 0;
+			total_cols = 0;	
 
-			if (fi[i]->ti)		/* The star represents only the qualified
-								 * table */
+			if (fi[i]->ti)	/*	The star represents only the qualified table */
 				total_cols = QR_get_num_tuples(fi[i]->ti->col_info->result);
 
-			else
-			{					/* The star represents all tables */
+			else {	/*	The star represents all tables */
 
-				/* Calculate the total number of columns after expansion */
-				for (k = 0; k < stmt->ntab; k++)
+				/*	Calculate the total number of columns after expansion */
+				for (k = 0; k < stmt->ntab; k++) {
 					total_cols += QR_get_num_tuples(ti[k]->col_info->result);
+				}
 			}
 			total_cols--;		/* makes up for the star  */
 
-			/* Allocate some more field pointers if necessary */
+			/*	Allocate some more field pointers if necessary */
 			/*------------------------------------------------------------- */
 			old_size = (stmt->nfld / FLD_INCR * FLD_INCR + FLD_INCR);
 			need = total_cols - (old_size - stmt->nfld);
 
-			mylog("k=%d, total_cols=%d, old_size=%d, need=%d\n", k, total_cols, old_size, need);
-
-			if (need > 0)
-			{
-				int			new_size = need / FLD_INCR * FLD_INCR + FLD_INCR;
+			mylog("k=%d, total_cols=%d, old_size=%d, need=%d\n", k,total_cols,old_size,need);
 
+			if (need > 0) {
+				int new_size = need / FLD_INCR * FLD_INCR + FLD_INCR;
 				mylog("need more cols: new_size = %d\n", new_size);
 				fi = (FIELD_INFO **) realloc(fi, (old_size + new_size) * sizeof(FIELD_INFO *));
-				if (!fi)
-				{
+				if ( ! fi) {
 					stmt->parse_status = STMT_PARSE_FATAL;
 					return FALSE;
 				}
 			}
 
 			/*------------------------------------------------------------- */
-
-			/*
-			 * copy any other fields (if there are any) up past the
-			 * expansion
-			 */
-			for (j = stmt->nfld - 1; j > i; j--)
-			{
+			/*	copy any other fields (if there are any) up past the expansion */
+			for (j = stmt->nfld - 1; j > i; j--) {
 				mylog("copying field %d to %d\n", j, total_cols + j);
 				fi[total_cols + j] = fi[j];
 			}
 			mylog("done copying fields\n");
 
 			/*------------------------------------------------------------- */
-			/* Set the new number of fields */
+			/*	Set the new number of fields */
 			stmt->nfld += total_cols;
 			mylog("stmt->nfld now at %d\n", stmt->nfld);
 
 
 			/*------------------------------------------------------------- */
-			/* copy the new field info */
+			/*	copy the new field info */
 
 
 			do_all_tables = (fi[i]->ti ? FALSE : TRUE);
 
-			for (k = 0; k < (do_all_tables ? stmt->ntab : 1); k++)
-			{
+			for (k = 0; k < (do_all_tables ? stmt->ntab : 1); k++) {
+
 				TABLE_INFO *the_ti = do_all_tables ? ti[k] : fi[i]->ti;
 
 				cols = QR_get_num_tuples(the_ti->col_info->result);
 
-				for (n = 0; n < cols; n++)
-				{
+				for (n = 0; n < cols; n++) {
 					mylog("creating field info: n=%d\n", n);
 					/* skip malloc (already did it for the Star) */
-					if (k > 0 || n > 0)
-					{
+					if (k > 0 || n > 0) {
 						mylog("allocating field info at %d\n", n + i);
-						fi[n + i] = (FIELD_INFO *) malloc(sizeof(FIELD_INFO));
-						if (fi[n + i] == NULL)
-						{
+						fi[n + i] = (FIELD_INFO *) malloc( sizeof(FIELD_INFO));
+						if (fi[n + i] == NULL) {
 							stmt->parse_status = STMT_PARSE_FATAL;
 							return FALSE;
 						}
 					}
-					/* Initialize the new space (or the * field) */
+					/*	Initialize the new space (or the * field) */
 					memset(fi[n + i], 0, sizeof(FIELD_INFO));
 					fi[n + i]->ti = the_ti;
 
@@ -846,27 +748,22 @@ parse_statement(StatementClass *stmt)
 			/*------------------------------------------------------------- */
 		}
 
-		/*
-		 * We either know which table the field was in because it was
-		 * qualified with a table name or alias -OR- there was only 1
-		 * table.
-		 */
-		else if (fi[i]->ti)
-		{
-			if (!searchColInfo(fi[i]->ti->col_info, fi[i]))
+		/*	We either know which table the field was in because it was qualified 
+			with a table name or alias -OR- there was only 1 table.
+		*/
+		else if (fi[i]->ti) {
+
+			if ( ! searchColInfo(fi[i]->ti->col_info, fi[i]))
 				parse = FALSE;
 
 			i++;
 		}
 
-		/* Don't know the table -- search all tables in "from" list */
-		else
-		{
+		/*	Don't know the table -- search all tables in "from" list */
+		else {
 			parse = FALSE;
-			for (k = 0; k < stmt->ntab; k++)
-			{
-				if (searchColInfo(ti[k]->col_info, fi[i]))
-				{
+			for (k = 0; k < stmt->ntab; k++) {
+				if ( searchColInfo(ti[k]->col_info, fi[i])) {
 					fi[i]->ti = ti[k];	/* now know the table */
 					parse = TRUE;
 					break;
@@ -877,7 +774,7 @@ parse_statement(StatementClass *stmt)
 	}
 
 
-	if (!parse)
+	if ( ! parse)
 		stmt->parse_status = STMT_PARSE_INCOMPLETE;
 	else
 		stmt->parse_status = STMT_PARSE_COMPLETE;
@@ -886,3 +783,4 @@ parse_statement(StatementClass *stmt)
 	mylog("done parse_statement: parse=%d, parse_status=%d\n", parse, stmt->parse_status);
 	return parse;
 }
+
diff --git a/src/interfaces/odbc/pgtypes.c b/src/interfaces/odbc/pgtypes.c
index 95d898d536842c26cd9243afc0b3f592d8c1649c..ebee8ab262f55eff03741817143a4a1e7bfd65a4 100644
--- a/src/interfaces/odbc/pgtypes.c
+++ b/src/interfaces/odbc/pgtypes.c
@@ -1,16 +1,17 @@
-/* Module:			pgtypes.c
+
+/* Module:          pgtypes.c
  *
- * Description:		This module contains routines for getting information
- *					about the supported Postgres data types.  Only the function
- *					pgtype_to_sqltype() returns an unknown condition.  All other
- *					functions return a suitable default so that even data types that
- *					are not directly supported can be used (it is handled as char data).
+ * Description:     This module contains routines for getting information
+ *                  about the supported Postgres data types.  Only the function
+ *                  pgtype_to_sqltype() returns an unknown condition.  All other
+ *                  functions return a suitable default so that even data types that
+ *                  are not directly supported can be used (it is handled as char data).
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -38,48 +39,48 @@
 
 extern GLOBAL_VALUES globals;
 
-Int4		getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
 
 
-/* these are the types we support.	all of the pgtype_ functions should */
-/* return values for each one of these.									*/
-/* Even types not directly supported are handled as character types
+/* these are the types we support.  all of the pgtype_ functions should */
+/* return values for each one of these.                                 */
+/* Even types not directly supported are handled as character types	
    so all types should work (points, etc.) */
 
 /* ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo.  Instead, all
-   the SQL TYPES are reported and mapped to a corresponding Postgres Type
+   the SQL TYPES are reported and mapped to a corresponding Postgres Type 
 */
 /*
-Int4 pgtypes_defined[]	= {
+Int4 pgtypes_defined[]  = { 
 				PG_TYPE_CHAR,
 				PG_TYPE_CHAR2,
 				PG_TYPE_CHAR4,
-				PG_TYPE_CHAR8,
+			    PG_TYPE_CHAR8,
 				PG_TYPE_CHAR16,
-				PG_TYPE_NAME,
-				PG_TYPE_VARCHAR,
-				PG_TYPE_BPCHAR,
+			    PG_TYPE_NAME,
+			    PG_TYPE_VARCHAR,
+			    PG_TYPE_BPCHAR,
 				PG_TYPE_DATE,
 				PG_TYPE_TIME,
 				PG_TYPE_DATETIME,
 				PG_TYPE_ABSTIME,
 				PG_TYPE_TIMESTAMP,
-				PG_TYPE_TEXT,
-				PG_TYPE_INT2,
-				PG_TYPE_INT4,
-				PG_TYPE_FLOAT4,
-				PG_TYPE_FLOAT8,
-				PG_TYPE_OID,
+			    PG_TYPE_TEXT,
+			    PG_TYPE_INT2,
+			    PG_TYPE_INT4,
+			    PG_TYPE_FLOAT4,
+			    PG_TYPE_FLOAT8,
+			    PG_TYPE_OID,
 				PG_TYPE_MONEY,
 				PG_TYPE_BOOL,
 				PG_TYPE_BYTEA,
 				PG_TYPE_LO,
-				0 };
+			    0 };
 */
 
 
 /*	These are NOW the SQL Types reported in SQLGetTypeInfo.  */
-Int2		sqlTypes[] = {
+Int2 sqlTypes [] = {
 	SQL_BIGINT,
 	/* SQL_BINARY, -- Commented out because VarBinary is more correct. */
 	SQL_BIT,
@@ -102,304 +103,232 @@ Int2		sqlTypes[] = {
 	0
 };
 
-Int4
-sqltype_to_pgtype(SWORD fSqlType)
+Int4 sqltype_to_pgtype(SWORD fSqlType)
 {
-	Int4		pgType;
-
-	switch (fSqlType)
-	{
-		case SQL_BINARY:
-			pgType = PG_TYPE_BYTEA;
-			break;
-
-		case SQL_CHAR:
-			pgType = PG_TYPE_BPCHAR;
-			break;
-
-		case SQL_BIT:
-			pgType = globals.bools_as_char ? PG_TYPE_CHAR : PG_TYPE_BOOL;
-			break;
-
-		case SQL_DATE:
-			pgType = PG_TYPE_DATE;
-			break;
-
-		case SQL_DOUBLE:
-		case SQL_FLOAT:
-			pgType = PG_TYPE_FLOAT8;
-			break;
-
-		case SQL_DECIMAL:
-		case SQL_NUMERIC:
-			pgType = PG_TYPE_NUMERIC;
-			break;
-
-		case SQL_BIGINT:
-			pgType = PG_TYPE_INT8;
-			break;
-
-		case SQL_INTEGER:
-			pgType = PG_TYPE_INT4;
-			break;
-
-		case SQL_LONGVARBINARY:
-			pgType = PG_TYPE_LO;
-			break;
-
-		case SQL_LONGVARCHAR:
-			pgType = globals.text_as_longvarchar ? PG_TYPE_TEXT : PG_TYPE_VARCHAR;
-			break;
-
-		case SQL_REAL:
-			pgType = PG_TYPE_FLOAT4;
-			break;
-
-		case SQL_SMALLINT:
-		case SQL_TINYINT:
-			pgType = PG_TYPE_INT2;
-			break;
-
-		case SQL_TIME:
-			pgType = PG_TYPE_TIME;
-			break;
-
-		case SQL_TIMESTAMP:
-			pgType = PG_TYPE_DATETIME;
-			break;
-
-		case SQL_VARBINARY:
-			pgType = PG_TYPE_BYTEA;
-			break;
-
-		case SQL_VARCHAR:
-			pgType = PG_TYPE_VARCHAR;
-			break;
-
-		default:
-			pgType = 0;			/* ??? */
-			break;
+Int4 pgType;
+
+	switch(fSqlType) {
+
+	case SQL_BINARY:
+		pgType = PG_TYPE_BYTEA;
+		break;
+
+	case SQL_CHAR:
+		pgType = PG_TYPE_BPCHAR;
+		break;
+
+	case SQL_BIT:
+		pgType = globals.bools_as_char ? PG_TYPE_CHAR : PG_TYPE_BOOL;
+		break;
+
+	case SQL_DATE:
+		pgType = PG_TYPE_DATE;
+		break;
+
+	case SQL_DOUBLE:
+	case SQL_FLOAT:
+		pgType = PG_TYPE_FLOAT8;
+		break;
+
+	case SQL_DECIMAL:
+	case SQL_NUMERIC:
+		pgType = PG_TYPE_NUMERIC;
+		break;
+
+	case SQL_BIGINT:
+		pgType = PG_TYPE_INT8;
+		break;
+
+	case SQL_INTEGER:
+		pgType = PG_TYPE_INT4;
+		break;
+
+	case SQL_LONGVARBINARY:
+		pgType = PG_TYPE_LO;
+		break;
+
+	case SQL_LONGVARCHAR:
+		pgType = globals.text_as_longvarchar ? PG_TYPE_TEXT : PG_TYPE_VARCHAR;
+		break;
+
+	case SQL_REAL:
+		pgType = PG_TYPE_FLOAT4;
+		break;
+
+	case SQL_SMALLINT:
+	case SQL_TINYINT:
+		pgType = PG_TYPE_INT2;
+		break;
+
+	case SQL_TIME:
+		pgType = PG_TYPE_TIME;
+		break;
+
+	case SQL_TIMESTAMP:
+		pgType = PG_TYPE_DATETIME;
+		break;
+
+	case SQL_VARBINARY:
+		pgType = PG_TYPE_BYTEA;
+		break;
+
+	case SQL_VARCHAR:
+		pgType = PG_TYPE_VARCHAR;
+		break;
+
+	default:
+	  	pgType = 0;	/* ??? */
+		break;
 	}
 
 	return pgType;
 }
 
-/*	There are two ways of calling this function:
+/*	There are two ways of calling this function:  
 	1.	When going through the supported PG types (SQLGetTypeInfo)
 	2.	When taking any type id (SQLColumns, SQLGetData)
 
 	The first type will always work because all the types defined are returned here.
-	The second type will return a default based on global parameter when it does not
-	know.	This allows for supporting
+	The second type will return a default based on global parameter when it does not 
+	know.  	This allows for supporting
 	types that are unknown.  All other pg routines in here return a suitable default.
 */
-Int2
-pgtype_to_sqltype(StatementClass *stmt, Int4 type)
+Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_CHAR:
-		case PG_TYPE_CHAR2:
-		case PG_TYPE_CHAR4:
-		case PG_TYPE_CHAR8:
-		case PG_TYPE_NAME:
-			return SQL_CHAR;
-
-		case PG_TYPE_BPCHAR:
-			return SQL_CHAR;
-
-		case PG_TYPE_VARCHAR:
-			return SQL_VARCHAR;
-
-		case PG_TYPE_TEXT:
-			return globals.text_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
-
-		case PG_TYPE_BYTEA:
-			return SQL_VARBINARY;
-		case PG_TYPE_LO:
+	switch(type) {
+	case PG_TYPE_CHAR:
+	case PG_TYPE_CHAR2:
+	case PG_TYPE_CHAR4:
+	case PG_TYPE_CHAR8:
+	case PG_TYPE_NAME:  		return SQL_CHAR;        
+
+	case PG_TYPE_BPCHAR:		return SQL_CHAR;
+
+	case PG_TYPE_VARCHAR:		return SQL_VARCHAR;
+
+	case PG_TYPE_TEXT:			return globals.text_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
+
+	case PG_TYPE_BYTEA:			return SQL_VARBINARY;
+	case PG_TYPE_LO:			return SQL_LONGVARBINARY;
+
+	case PG_TYPE_INT2:          return SQL_SMALLINT;
+
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:          return SQL_INTEGER;
+
+	/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
+	case PG_TYPE_INT8:			return SQL_CHAR;
+
+	case PG_TYPE_NUMERIC:		return SQL_NUMERIC;
+
+	case PG_TYPE_FLOAT4:        return SQL_REAL;
+	case PG_TYPE_FLOAT8:        return SQL_FLOAT;
+	case PG_TYPE_DATE:			return SQL_DATE;
+	case PG_TYPE_TIME:			return SQL_TIME;
+	case PG_TYPE_ABSTIME:		
+	case PG_TYPE_DATETIME:		
+	case PG_TYPE_TIMESTAMP:		return SQL_TIMESTAMP;
+	case PG_TYPE_MONEY:			return SQL_FLOAT;
+	case PG_TYPE_BOOL:			return globals.bools_as_char ? SQL_CHAR : SQL_BIT;
+
+	default:                
+
+		/*	first, check to see if 'type' is in list.  If not, look up with query.
+			Add oid, name to list.  If it's already in list, just return.
+		*/
+		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
 			return SQL_LONGVARBINARY;
 
-		case PG_TYPE_INT2:
-			return SQL_SMALLINT;
-
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-		case PG_TYPE_INT4:
-			return SQL_INTEGER;
-
-			/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
-		case PG_TYPE_INT8:
-			return SQL_CHAR;
-
-		case PG_TYPE_NUMERIC:
-			return SQL_NUMERIC;
-
-		case PG_TYPE_FLOAT4:
-			return SQL_REAL;
-		case PG_TYPE_FLOAT8:
-			return SQL_FLOAT;
-		case PG_TYPE_DATE:
-			return SQL_DATE;
-		case PG_TYPE_TIME:
-			return SQL_TIME;
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			return SQL_TIMESTAMP;
-		case PG_TYPE_MONEY:
-			return SQL_FLOAT;
-		case PG_TYPE_BOOL:
-			return globals.bools_as_char ? SQL_CHAR : SQL_BIT;
-
-		default:
-
-			/*
-			 * first, check to see if 'type' is in list.  If not, look up
-			 * with query. Add oid, name to list.  If it's already in
-			 * list, just return.
-			 */
-			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
-												 * type is available */
-				return SQL_LONGVARBINARY;
-
-			return globals.unknowns_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
+		return globals.unknowns_as_longvarchar ? SQL_LONGVARCHAR : SQL_VARCHAR;
 	}
 }
 
-Int2
-pgtype_to_ctype(StatementClass *stmt, Int4 type)
+Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_INT8:
-			return SQL_C_CHAR;
-		case PG_TYPE_NUMERIC:
-			return SQL_C_CHAR;
-		case PG_TYPE_INT2:
-			return SQL_C_SSHORT;
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-		case PG_TYPE_INT4:
-			return SQL_C_SLONG;
-		case PG_TYPE_FLOAT4:
-			return SQL_C_FLOAT;
-		case PG_TYPE_FLOAT8:
-			return SQL_C_DOUBLE;
-		case PG_TYPE_DATE:
-			return SQL_C_DATE;
-		case PG_TYPE_TIME:
-			return SQL_C_TIME;
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			return SQL_C_TIMESTAMP;
-		case PG_TYPE_MONEY:
-			return SQL_C_FLOAT;
-		case PG_TYPE_BOOL:
-			return globals.bools_as_char ? SQL_C_CHAR : SQL_C_BIT;
-
-		case PG_TYPE_BYTEA:
-			return SQL_C_BINARY;
-		case PG_TYPE_LO:
+	switch(type) {
+	case PG_TYPE_INT8:			return SQL_C_CHAR;
+	case PG_TYPE_NUMERIC:		return SQL_C_CHAR;
+	case PG_TYPE_INT2:          return SQL_C_SSHORT;
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:          return SQL_C_SLONG;
+	case PG_TYPE_FLOAT4:        return SQL_C_FLOAT;
+	case PG_TYPE_FLOAT8:        return SQL_C_DOUBLE;
+	case PG_TYPE_DATE:			return SQL_C_DATE;
+	case PG_TYPE_TIME:			return SQL_C_TIME;
+	case PG_TYPE_ABSTIME:		
+	case PG_TYPE_DATETIME:
+	case PG_TYPE_TIMESTAMP:		return SQL_C_TIMESTAMP;
+	case PG_TYPE_MONEY:			return SQL_C_FLOAT;
+	case PG_TYPE_BOOL:			return globals.bools_as_char ? SQL_C_CHAR : SQL_C_BIT;
+
+	case PG_TYPE_BYTEA:			return SQL_C_BINARY;
+	case PG_TYPE_LO:			return SQL_C_BINARY;
+
+	default:                    
+
+		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
 			return SQL_C_BINARY;
 
-		default:
-
-			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
-												 * type is available */
-				return SQL_C_BINARY;
-
-			return SQL_C_CHAR;
+		return SQL_C_CHAR;
 	}
 }
 
-char *
-pgtype_to_name(StatementClass *stmt, Int4 type)
+char *pgtype_to_name(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-			case PG_TYPE_CHAR:return "char";
-		case PG_TYPE_CHAR2:
-			return "char2";
-		case PG_TYPE_CHAR4:
-			return "char4";
-		case PG_TYPE_CHAR8:
-			return "char8";
-		case PG_TYPE_INT8:
-			return "int8";
-		case PG_TYPE_NUMERIC:
-			return "numeric";
-		case PG_TYPE_VARCHAR:
-			return "varchar";
-		case PG_TYPE_BPCHAR:
-			return "char";
-		case PG_TYPE_TEXT:
-			return "text";
-		case PG_TYPE_NAME:
-			return "name";
-		case PG_TYPE_INT2:
-			return "int2";
-		case PG_TYPE_OID:
-			return "oid";
-		case PG_TYPE_INT4:
-			return "int4";
-		case PG_TYPE_FLOAT4:
-			return "float4";
-		case PG_TYPE_FLOAT8:
-			return "float8";
-		case PG_TYPE_DATE:
-			return "date";
-		case PG_TYPE_TIME:
-			return "time";
-		case PG_TYPE_ABSTIME:
-			return "abstime";
-		case PG_TYPE_DATETIME:
-			return "datetime";
-		case PG_TYPE_TIMESTAMP:
-			return "timestamp";
-		case PG_TYPE_MONEY:
-			return "money";
-		case PG_TYPE_BOOL:
-			return "bool";
-		case PG_TYPE_BYTEA:
-			return "bytea";
-
-		case PG_TYPE_LO:
+	switch(type) {
+	case PG_TYPE_CHAR:          return "char";
+	case PG_TYPE_CHAR2:			return "char2";
+	case PG_TYPE_CHAR4:			return "char4";
+	case PG_TYPE_CHAR8:         return "char8";
+	case PG_TYPE_INT8:			return "int8";
+	case PG_TYPE_NUMERIC:		return "numeric";
+	case PG_TYPE_VARCHAR:       return "varchar";
+	case PG_TYPE_BPCHAR:        return "char";
+	case PG_TYPE_TEXT:          return "text";
+	case PG_TYPE_NAME:          return "name";
+	case PG_TYPE_INT2:          return "int2";
+	case PG_TYPE_OID:           return "oid";
+	case PG_TYPE_INT4:          return "int4";
+	case PG_TYPE_FLOAT4:        return "float4";
+	case PG_TYPE_FLOAT8:        return "float8";
+	case PG_TYPE_DATE:			return "date";
+	case PG_TYPE_TIME:			return "time";
+	case PG_TYPE_ABSTIME:		return "abstime";
+	case PG_TYPE_DATETIME:		return "datetime";
+	case PG_TYPE_TIMESTAMP:		return "timestamp";
+	case PG_TYPE_MONEY:			return "money";
+	case PG_TYPE_BOOL:			return "bool";
+	case PG_TYPE_BYTEA:			return "bytea";
+
+	case PG_TYPE_LO:			return PG_TYPE_LO_NAME;
+
+	default:                    
+		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
 			return PG_TYPE_LO_NAME;
 
-		default:
-			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
-												 * type is available */
-				return PG_TYPE_LO_NAME;
-
-			/*
-			 * "unknown" can actually be used in alter table because it is
-			 * a real PG type!
-			 */
-			return "unknown";
-	}
+		/* "unknown" can actually be used in alter table because it is a real PG type! */
+		return "unknown";	
+	}    
 }
 
 static Int2
 getNumericScale(StatementClass *stmt, Int4 type, int col)
 {
-	Int4		atttypmod;
-	QResultClass *result;
-	ColumnInfoClass *flds;
+Int4 atttypmod;
+QResultClass *result;
+ColumnInfoClass *flds;
 
-	mylog("getNumericScale: type=%d, col=%d, unknown = %d\n", type, col);
+mylog("getNumericScale: type=%d, col=%d, unknown = %d\n", type,col);
 
 	if (col < 0)
 		return PG_NUMERIC_MAX_SCALE;
 
 	result = SC_get_Result(stmt);
 
-	/*
-	 * Manual Result Sets -- use assigned column width (i.e., from
-	 * set_tuplefield_string)
-	 */
-	if (stmt->manual_result)
-	{
+	/*	Manual Result Sets -- use assigned column width (i.e., from set_tuplefield_string) */
+	if (stmt->manual_result) {
 		flds = result->fields;
 		if (flds)
 			return flds->adtsize[col];
@@ -408,34 +337,30 @@ getNumericScale(StatementClass *stmt, Int4 type, int col)
 	}
 
 	atttypmod = QR_get_atttypmod(result, col);
-	if (atttypmod > -1)
+	if ( atttypmod > -1 )
 		return (atttypmod & 0xffff);
 	else
-		return (QR_get_display_size(result, col) ?
-				QR_get_display_size(result, col) :
-				PG_NUMERIC_MAX_SCALE);
+		return ( QR_get_display_size(result, col) ? 
+			QR_get_display_size(result, col) : 
+			PG_NUMERIC_MAX_SCALE);
 }
 
 static Int4
 getNumericPrecision(StatementClass *stmt, Int4 type, int col)
 {
-	Int4		atttypmod;
-	QResultClass *result;
-	ColumnInfoClass *flds;
+Int4 atttypmod;
+QResultClass *result;
+ColumnInfoClass *flds;
 
-	mylog("getNumericPrecision: type=%d, col=%d, unknown = %d\n", type, col);
+mylog("getNumericPrecision: type=%d, col=%d, unknown = %d\n", type,col);
 
 	if (col < 0)
 		return PG_NUMERIC_MAX_PRECISION;
 
 	result = SC_get_Result(stmt);
 
-	/*
-	 * Manual Result Sets -- use assigned column width (i.e., from
-	 * set_tuplefield_string)
-	 */
-	if (stmt->manual_result)
-	{
+	/*	Manual Result Sets -- use assigned column width (i.e., from set_tuplefield_string) */
+	if (stmt->manual_result) {
 		flds = result->fields;
 		if (flds)
 			return flds->adtsize[col];
@@ -444,62 +369,55 @@ getNumericPrecision(StatementClass *stmt, Int4 type, int col)
 	}
 
 	atttypmod = QR_get_atttypmod(result, col);
-	if (atttypmod > -1)
+	if ( atttypmod > -1 )
 		return (atttypmod >> 16) & 0xffff;
 	else
-		return (QR_get_display_size(result, col) >= 0 ?
-				QR_get_display_size(result, col) :
-				PG_NUMERIC_MAX_PRECISION);
+		return ( QR_get_display_size(result, col) >= 0 ? 
+			QR_get_display_size(result, col) : 
+			PG_NUMERIC_MAX_PRECISION );
 }
 
 Int4
 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
-	int			p = -1,
-				maxsize;
-	QResultClass *result;
-	ColumnInfoClass *flds;
-
-	mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type, col, handle_unknown_size_as);
-
-	/* Assign Maximum size based on parameters */
-	switch (type)
-	{
-		case PG_TYPE_TEXT:
-			if (globals.text_as_longvarchar)
-				maxsize = globals.max_longvarchar_size;
-			else
-				maxsize = globals.max_varchar_size;
-			break;
-
-		case PG_TYPE_VARCHAR:
-		case PG_TYPE_BPCHAR:
+int p = -1, maxsize;
+QResultClass *result;
+ColumnInfoClass *flds;
+
+mylog("getCharPrecision: type=%d, col=%d, unknown = %d\n", type,col,handle_unknown_size_as);
+
+	/*	Assign Maximum size based on parameters */
+	switch(type) {
+	case PG_TYPE_TEXT:
+		if (globals.text_as_longvarchar)
+			maxsize = globals.max_longvarchar_size;
+		else
 			maxsize = globals.max_varchar_size;
-			break;
-
-		default:
-			if (globals.unknowns_as_longvarchar)
-				maxsize = globals.max_longvarchar_size;
-			else
-				maxsize = globals.max_varchar_size;
-			break;
+		break;
+
+	case PG_TYPE_VARCHAR:
+	case PG_TYPE_BPCHAR:
+		maxsize = globals.max_varchar_size;
+		break;
+
+	default:
+		if (globals.unknowns_as_longvarchar)
+			maxsize = globals.max_longvarchar_size;
+		else
+			maxsize = globals.max_varchar_size;
+		break;
 	}
 
-	/*
-	 * Static Precision (i.e., the Maximum Precision of the datatype) This
-	 * has nothing to do with a result set.
-	 */
+	/*	Static Precision (i.e., the Maximum Precision of the datatype)
+		This has nothing to do with a result set.
+	*/
 	if (col < 0)
 		return maxsize;
 
 	result = SC_get_Result(stmt);
 
-	/*
-	 * Manual Result Sets -- use assigned column width (i.e., from
-	 * set_tuplefield_string)
-	 */
-	if (stmt->manual_result)
-	{
+	/*	Manual Result Sets -- use assigned column width (i.e., from set_tuplefield_string) */
+	if (stmt->manual_result) {
 		flds = result->fields;
 		if (flds)
 			return flds->adtsize[col];
@@ -507,12 +425,11 @@ getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_si
 			return maxsize;
 	}
 
-	/* Size is unknown -- handle according to parameter */
+	/*	Size is unknown -- handle according to parameter */
 	if (QR_get_atttypmod(result, col) > -1)
 		return QR_get_atttypmod(result, col);
 
-	if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST)
-	{
+	if (type == PG_TYPE_BPCHAR || handle_unknown_size_as == UNKNOWNS_AS_LONGEST) {
 		p = QR_get_display_size(result, col);
 		mylog("getCharPrecision: LONGEST: p = %d\n", p);
 	}
@@ -523,425 +440,351 @@ getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unknown_si
 		return p;
 }
 
-/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, PG_TYPE_NUMERIC, SQLColumns will
+/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, PG_TYPE_NUMERIC, SQLColumns will 
 	override this length with the atttypmod length from pg_attribute .
 
 	If col >= 0, then will attempt to get the info from the result set.
 	This is used for functions SQLDescribeCol and SQLColAttributes.
 */
-Int4
-pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
+Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
-	switch (type)
-	{
-		case PG_TYPE_CHAR:
-			return 1;
-		case PG_TYPE_CHAR2:
-			return 2;
-		case PG_TYPE_CHAR4:
-			return 4;
-		case PG_TYPE_CHAR8:
-			return 8;
-
-		case PG_TYPE_NAME:
-			return NAME_FIELD_SIZE;
-
-		case PG_TYPE_INT2:
-			return 5;
-
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-		case PG_TYPE_INT4:
-			return 10;
-
-		case PG_TYPE_INT8:
-			return 19;			/* signed */
-
-		case PG_TYPE_NUMERIC:
-			return getNumericPrecision(stmt, type, col);
-
-		case PG_TYPE_FLOAT4:
-		case PG_TYPE_MONEY:
-			return 7;
-
-		case PG_TYPE_FLOAT8:
-			return 15;
-
-		case PG_TYPE_DATE:
-			return 10;
-		case PG_TYPE_TIME:
-			return 8;
-
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			return 19;
-
-		case PG_TYPE_BOOL:
-			return 1;
-
-		case PG_TYPE_LO:
-			return SQL_NO_TOTAL;
 
-		default:
+	switch(type) {
 
-			if (type == stmt->hdbc->lobj_type)	/* hack until permanent
-												 * type is available */
-				return SQL_NO_TOTAL;
+	case PG_TYPE_CHAR:			return 1;
+	case PG_TYPE_CHAR2:			return 2;
+	case PG_TYPE_CHAR4:			return 4;
+	case PG_TYPE_CHAR8:       	return 8;
 
-			/* Handle Character types and unknown types */
-			return getCharPrecision(stmt, type, col, handle_unknown_size_as);
-	}
+	case PG_TYPE_NAME:			return NAME_FIELD_SIZE;
+
+	case PG_TYPE_INT2:          return 5;
+
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:          return 10;
+
+	case PG_TYPE_INT8:			return 19;   /* signed */
+
+	case PG_TYPE_NUMERIC:		return getNumericPrecision(stmt,type,col);
+
+	case PG_TYPE_FLOAT4:        
+	case PG_TYPE_MONEY:			return 7;
+
+	case PG_TYPE_FLOAT8:        return 15;
+
+	case PG_TYPE_DATE:			return 10;
+	case PG_TYPE_TIME:			return 8;
+
+	case PG_TYPE_ABSTIME:		
+	case PG_TYPE_DATETIME:		
+	case PG_TYPE_TIMESTAMP:		return 19;
+
+	case PG_TYPE_BOOL:			return 1;
+
+	case PG_TYPE_LO:			return SQL_NO_TOTAL;
+
+	default:
+
+		if (type == stmt->hdbc->lobj_type)	/* hack until permanent type is available */
+			return SQL_NO_TOTAL;
+
+		/*	Handle Character types and unknown types */
+		return getCharPrecision(stmt, type, col, handle_unknown_size_as);
+    }
 }
 
-Int4
-pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
+Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
-	switch (type)
-	{
-		case PG_TYPE_INT2:
-			return 6;
 
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-			return 10;
+	switch(type) {
+	case PG_TYPE_INT2:			return 6;
 
-		case PG_TYPE_INT4:
-			return 11;
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:			return 10;
 
-		case PG_TYPE_INT8:
-			return 20;			/* signed: 19 digits + sign */
+	case PG_TYPE_INT4:			return 11;
 
-		case PG_TYPE_NUMERIC:
-			return getNumericPrecision(stmt, type, col) + 2;
+	case PG_TYPE_INT8:			return 20;	/* signed: 19 digits + sign */
 
-		case PG_TYPE_MONEY:
-			return 15;			/* ($9,999,999.99) */
+	case PG_TYPE_NUMERIC:		return getNumericPrecision(stmt,type,col) + 2;
 
-		case PG_TYPE_FLOAT4:
-			return 13;
+	case PG_TYPE_MONEY:			return 15;	/* ($9,999,999.99) */
 
-		case PG_TYPE_FLOAT8:
-			return 22;
+	case PG_TYPE_FLOAT4:		return 13;
 
-			/* Character types use regular precision */
-		default:
-			return pgtype_precision(stmt, type, col, handle_unknown_size_as);
+	case PG_TYPE_FLOAT8:		return 22;
+	
+	/*	Character types use regular precision */
+	default:
+		return pgtype_precision(stmt, type, col, handle_unknown_size_as);
 	}
 }
 
-/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, SQLColumns will
-	override this length with the atttypmod length from pg_attribute
+/*	For PG_TYPE_VARCHAR, PG_TYPE_BPCHAR, SQLColumns will 
+	override this length with the atttypmod length from pg_attribute 
 */
-Int4
-pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
+Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as)
 {
-	switch (type)
-	{
-		case PG_TYPE_INT2:
-			return 2;
 
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-		case PG_TYPE_INT4:
-			return 4;
+	switch(type) {
 
-		case PG_TYPE_INT8:
-			return 20;			/* signed: 19 digits + sign */
+	case PG_TYPE_INT2:          return 2;
 
-		case PG_TYPE_NUMERIC:
-			return getNumericPrecision(stmt, type, col) + 2;
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:          return 4;
 
-		case PG_TYPE_FLOAT4:
-		case PG_TYPE_MONEY:
-			return 4;
+	case PG_TYPE_INT8:			return 20;	/* signed: 19 digits + sign */
 
-		case PG_TYPE_FLOAT8:
-			return 8;
+	case PG_TYPE_NUMERIC:		return getNumericPrecision(stmt,type,col) + 2;
 
-		case PG_TYPE_DATE:
-		case PG_TYPE_TIME:
-			return 6;
+	case PG_TYPE_FLOAT4:
+	case PG_TYPE_MONEY:			return 4;
 
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			return 16;
+	case PG_TYPE_FLOAT8:        return 8;
 
+	case PG_TYPE_DATE:
+	case PG_TYPE_TIME:			return 6;
 
-			/* Character types (and NUMERIC) use the default precision */
-		default:
-			return pgtype_precision(stmt, type, col, handle_unknown_size_as);
-	}
+	case PG_TYPE_ABSTIME:		
+	case PG_TYPE_DATETIME:
+	case PG_TYPE_TIMESTAMP:		return 16;
+
+
+	/*	Character types (and NUMERIC) use the default precision */
+	default:	
+		return pgtype_precision(stmt, type, col, handle_unknown_size_as);
+    }
 }
 
-Int2
-pgtype_scale(StatementClass *stmt, Int4 type, int col)
+Int2 pgtype_scale(StatementClass *stmt, Int4 type, int col)
 {
-	switch (type)
-	{
-		case PG_TYPE_INT2:
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-		case PG_TYPE_INT4:
-		case PG_TYPE_INT8:
-		case PG_TYPE_FLOAT4:
-		case PG_TYPE_FLOAT8:
-		case PG_TYPE_MONEY:
-		case PG_TYPE_BOOL:
-
-			/*
-			 * Number of digits to the right of the decimal point in
-			 * "yyyy-mm=dd hh:mm:ss[.f...]"
-			 */
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			return 0;
-
-		case PG_TYPE_NUMERIC:
-			return getNumericScale(stmt, type, col);
-
-		default:
-			return -1;
+	switch(type) {
+
+	case PG_TYPE_INT2:
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:
+	case PG_TYPE_INT8:
+	case PG_TYPE_FLOAT4:
+	case PG_TYPE_FLOAT8:
+	case PG_TYPE_MONEY:
+	case PG_TYPE_BOOL:
+
+	/*	Number of digits to the right of the decimal point in "yyyy-mm=dd hh:mm:ss[.f...]" */
+	case PG_TYPE_ABSTIME:		
+	case PG_TYPE_DATETIME:		
+	case PG_TYPE_TIMESTAMP:		return 0;
+
+	case PG_TYPE_NUMERIC:		return getNumericScale(stmt,type,col);
+
+	default:					return -1;
 	}
 }
 
 
-Int2
-pgtype_radix(StatementClass *stmt, Int4 type)
+Int2 pgtype_radix(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_INT2:
-		case PG_TYPE_OID:
-		case PG_TYPE_INT4:
-		case PG_TYPE_INT8:
-		case PG_TYPE_NUMERIC:
-		case PG_TYPE_FLOAT4:
-		case PG_TYPE_MONEY:
-		case PG_TYPE_FLOAT8:
-			return 10;
-
-		default:
-			return -1;
-	}
+    switch(type) {
+    case PG_TYPE_INT2:
+    case PG_TYPE_OID:
+    case PG_TYPE_INT4:
+	case PG_TYPE_INT8:
+	case PG_TYPE_NUMERIC:
+    case PG_TYPE_FLOAT4:
+	case PG_TYPE_MONEY:
+    case PG_TYPE_FLOAT8:        return 10;
+
+    default:                    return -1;
+    }
 }
 
-Int2
-pgtype_nullable(StatementClass *stmt, Int4 type)
+Int2 pgtype_nullable(StatementClass *stmt, Int4 type)
 {
-	return SQL_NULLABLE;		/* everything should be nullable */
+	return SQL_NULLABLE;	/* everything should be nullable */
 }
 
-Int2
-pgtype_auto_increment(StatementClass *stmt, Int4 type)
+Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_INT2:
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-		case PG_TYPE_INT4:
-		case PG_TYPE_FLOAT4:
-		case PG_TYPE_MONEY:
-		case PG_TYPE_BOOL:
-		case PG_TYPE_FLOAT8:
-		case PG_TYPE_INT8:
-		case PG_TYPE_NUMERIC:
-
-		case PG_TYPE_DATE:
-		case PG_TYPE_TIME:
-		case PG_TYPE_ABSTIME:
-		case PG_TYPE_DATETIME:
-		case PG_TYPE_TIMESTAMP:
-			return FALSE;
-
-		default:
-			return -1;
-	}
+	switch(type) {
+
+	case PG_TYPE_INT2:         
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:         
+	case PG_TYPE_FLOAT4:       
+	case PG_TYPE_MONEY:
+	case PG_TYPE_BOOL:
+	case PG_TYPE_FLOAT8:
+	case PG_TYPE_INT8:
+	case PG_TYPE_NUMERIC:
+
+	case PG_TYPE_DATE:
+	case PG_TYPE_TIME:			
+	case PG_TYPE_ABSTIME:		
+	case PG_TYPE_DATETIME:		
+	case PG_TYPE_TIMESTAMP:		return FALSE;
+
+	default:					return -1;
+	}    
 }
 
-Int2
-pgtype_case_sensitive(StatementClass *stmt, Int4 type)
+Int2 pgtype_case_sensitive(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_CHAR:
-
-		case PG_TYPE_CHAR2:
-		case PG_TYPE_CHAR4:
-		case PG_TYPE_CHAR8:
-
-		case PG_TYPE_VARCHAR:
-		case PG_TYPE_BPCHAR:
-		case PG_TYPE_TEXT:
-		case PG_TYPE_NAME:
-			return TRUE;
-
-		default:
-			return FALSE;
-	}
+    switch(type) {
+    case PG_TYPE_CHAR:          
+
+	case PG_TYPE_CHAR2:
+	case PG_TYPE_CHAR4:
+    case PG_TYPE_CHAR8:         
+
+    case PG_TYPE_VARCHAR:       
+    case PG_TYPE_BPCHAR:
+    case PG_TYPE_TEXT:
+    case PG_TYPE_NAME:          return TRUE;
+
+    default:                    return FALSE;
+    }
 }
 
-Int2
-pgtype_money(StatementClass *stmt, Int4 type)
+Int2 pgtype_money(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_MONEY:
-			return TRUE;
-		default:
-			return FALSE;
-	}
+	switch(type) {
+	case PG_TYPE_MONEY:			return TRUE;
+	default:					return FALSE;
+	}    
 }
 
-Int2
-pgtype_searchable(StatementClass *stmt, Int4 type)
+Int2 pgtype_searchable(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_CHAR:
-		case PG_TYPE_CHAR2:
-		case PG_TYPE_CHAR4:
-		case PG_TYPE_CHAR8:
-
-		case PG_TYPE_VARCHAR:
-		case PG_TYPE_BPCHAR:
-		case PG_TYPE_TEXT:
-		case PG_TYPE_NAME:
-			return SQL_SEARCHABLE;
-
-		default:
-			return SQL_ALL_EXCEPT_LIKE;
-	}
+	switch(type) {
+	case PG_TYPE_CHAR:          
+	case PG_TYPE_CHAR2:
+	case PG_TYPE_CHAR4:			
+	case PG_TYPE_CHAR8:
+
+	case PG_TYPE_VARCHAR:       
+	case PG_TYPE_BPCHAR:
+	case PG_TYPE_TEXT:
+	case PG_TYPE_NAME:          return SQL_SEARCHABLE;
+
+	default:					return SQL_ALL_EXCEPT_LIKE;
+	}    
 }
 
-Int2
-pgtype_unsigned(StatementClass *stmt, Int4 type)
+Int2 pgtype_unsigned(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-		case PG_TYPE_OID:
-		case PG_TYPE_XID:
-			return TRUE;
-
-		case PG_TYPE_INT2:
-		case PG_TYPE_INT4:
-		case PG_TYPE_INT8:
-		case PG_TYPE_NUMERIC:
-		case PG_TYPE_FLOAT4:
-		case PG_TYPE_FLOAT8:
-		case PG_TYPE_MONEY:
-			return FALSE;
-
-		default:
-			return -1;
+	switch(type) {
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:			return TRUE;
+
+	case PG_TYPE_INT2:
+	case PG_TYPE_INT4:
+	case PG_TYPE_INT8:
+	case PG_TYPE_NUMERIC:
+	case PG_TYPE_FLOAT4:
+	case PG_TYPE_FLOAT8:
+	case PG_TYPE_MONEY:			return FALSE;
+
+	default:					return -1;
 	}
 }
 
-char *
-pgtype_literal_prefix(StatementClass *stmt, Int4 type)
+char *pgtype_literal_prefix(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-			case PG_TYPE_INT2:
-			case PG_TYPE_OID:
-			case PG_TYPE_XID:
-			case PG_TYPE_INT4:
-			case PG_TYPE_INT8:
-			case PG_TYPE_NUMERIC:
-			case PG_TYPE_FLOAT4:
-			case PG_TYPE_FLOAT8:
-			case PG_TYPE_MONEY:return NULL;
-
-		default:
-			return "'";
+	switch(type) {
+
+	case PG_TYPE_INT2:
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:
+	case PG_TYPE_INT8:
+	case PG_TYPE_NUMERIC:
+	case PG_TYPE_FLOAT4:
+	case PG_TYPE_FLOAT8:        
+	case PG_TYPE_MONEY:			return NULL;
+
+	default:					return "'";
 	}
 }
 
-char *
-pgtype_literal_suffix(StatementClass *stmt, Int4 type)
+char *pgtype_literal_suffix(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-			case PG_TYPE_INT2:
-			case PG_TYPE_OID:
-			case PG_TYPE_XID:
-			case PG_TYPE_INT4:
-			case PG_TYPE_INT8:
-			case PG_TYPE_NUMERIC:
-			case PG_TYPE_FLOAT4:
-			case PG_TYPE_FLOAT8:
-			case PG_TYPE_MONEY:return NULL;
-
-		default:
-			return "'";
+	switch(type) {
+
+	case PG_TYPE_INT2:
+	case PG_TYPE_OID:
+	case PG_TYPE_XID:
+	case PG_TYPE_INT4:
+	case PG_TYPE_INT8:
+	case PG_TYPE_NUMERIC:
+	case PG_TYPE_FLOAT4:
+	case PG_TYPE_FLOAT8:        
+	case PG_TYPE_MONEY:			return NULL;
+
+	default:					return "'";
 	}
 }
 
-char *
-pgtype_create_params(StatementClass *stmt, Int4 type)
+char *pgtype_create_params(StatementClass *stmt, Int4 type)
 {
-	switch (type)
-	{
-			case PG_TYPE_CHAR:
-			case PG_TYPE_VARCHAR:return "max. length";
-		default:
-			return NULL;
+	switch(type) {
+	case PG_TYPE_CHAR:
+	case PG_TYPE_VARCHAR:		return "max. length";
+	default:					return NULL;
 	}
 }
 
 
-Int2
-sqltype_to_default_ctype(Int2 sqltype)
+Int2 sqltype_to_default_ctype(Int2 sqltype)
 {
-	/* from the table on page 623 of ODBC 2.0 Programmer's Reference */
-	/* (Appendix D) */
-	switch (sqltype)
-	{
-		case SQL_CHAR:
-		case SQL_VARCHAR:
-		case SQL_LONGVARCHAR:
-		case SQL_DECIMAL:
-		case SQL_NUMERIC:
-		case SQL_BIGINT:
-			return SQL_C_CHAR;
-
-		case SQL_BIT:
-			return SQL_C_BIT;
-
-		case SQL_TINYINT:
-			return SQL_C_STINYINT;
-
-		case SQL_SMALLINT:
-			return SQL_C_SSHORT;
-
-		case SQL_INTEGER:
-			return SQL_C_SLONG;
-
-		case SQL_REAL:
-			return SQL_C_FLOAT;
-
-		case SQL_FLOAT:
-		case SQL_DOUBLE:
-			return SQL_C_DOUBLE;
-
-		case SQL_BINARY:
-		case SQL_VARBINARY:
-		case SQL_LONGVARBINARY:
-			return SQL_C_BINARY;
+    /* from the table on page 623 of ODBC 2.0 Programmer's Reference */
+    /* (Appendix D) */
+    switch(sqltype) {
+    case SQL_CHAR: 
+    case SQL_VARCHAR:
+    case SQL_LONGVARCHAR:
+    case SQL_DECIMAL:
+    case SQL_NUMERIC:
+    case SQL_BIGINT:
+		return SQL_C_CHAR;
 
-		case SQL_DATE:
-			return SQL_C_DATE;
+    case SQL_BIT:
+		return SQL_C_BIT;
 
-		case SQL_TIME:
-			return SQL_C_TIME;
+    case SQL_TINYINT:
+		return SQL_C_STINYINT;
 
-		case SQL_TIMESTAMP:
-			return SQL_C_TIMESTAMP;
+    case SQL_SMALLINT:
+		return SQL_C_SSHORT;
 
-		default:				/* should never happen */
-			return SQL_C_CHAR;
-	}
+    case SQL_INTEGER:
+		return SQL_C_SLONG;
+
+    case SQL_REAL:
+		return SQL_C_FLOAT;
+
+    case SQL_FLOAT:
+    case SQL_DOUBLE:
+		return SQL_C_DOUBLE;
+
+    case SQL_BINARY:
+    case SQL_VARBINARY:
+    case SQL_LONGVARBINARY:
+		return SQL_C_BINARY;
+
+    case SQL_DATE:
+		return SQL_C_DATE;
+
+    case SQL_TIME:
+		return SQL_C_TIME;
+
+    case SQL_TIMESTAMP:
+		return SQL_C_TIMESTAMP;
+
+    default:			/* should never happen */
+		return SQL_C_CHAR;	
+    }
 }
+
diff --git a/src/interfaces/odbc/pgtypes.h b/src/interfaces/odbc/pgtypes.h
index 0c024dd11e38567a6ae6c793a0d06871a88c3a4d..f9c48ff64f11cca54f5a45670435a30f77fc6aac 100644
--- a/src/interfaces/odbc/pgtypes.h
+++ b/src/interfaces/odbc/pgtypes.h
@@ -1,9 +1,9 @@
 
-/* File:			pgtypes.h
+/* File:            pgtypes.h
  *
- * Description:		See "pgtypes.c"
+ * Description:     See "pgtypes.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -17,81 +17,82 @@
 
 
 #if 0
-#define PG_TYPE_LO			????/* waiting for permanent type */
+#define PG_TYPE_LO			???? 	/* waiting for permanent type */
 #endif
 
-#define PG_TYPE_BOOL		16
-#define PG_TYPE_BYTEA		17
-#define PG_TYPE_CHAR		18
-#define PG_TYPE_NAME		19
-#define PG_TYPE_INT8		20
-#define PG_TYPE_INT2		21
-#define PG_TYPE_INT2VECTOR	22
-#define PG_TYPE_INT4		23
-#define PG_TYPE_REGPROC		24
-#define PG_TYPE_TEXT		25
-#define PG_TYPE_OID			26
-#define PG_TYPE_TID			27
-#define PG_TYPE_XID			28
-#define PG_TYPE_CID			29
-#define PG_TYPE_OIDVECTOR	30
-#define PG_TYPE_SET			32
-#define PG_TYPE_CHAR2		409
-#define PG_TYPE_CHAR4		410
-#define PG_TYPE_CHAR8		411
-#define PG_TYPE_POINT		600
-#define PG_TYPE_LSEG		601
-#define PG_TYPE_PATH		602
-#define PG_TYPE_BOX			603
-#define PG_TYPE_POLYGON		604
-#define PG_TYPE_FILENAME	605
-#define PG_TYPE_FLOAT4		700
-#define PG_TYPE_FLOAT8		701
-#define PG_TYPE_ABSTIME		702
-#define PG_TYPE_RELTIME		703
-#define PG_TYPE_TINTERVAL	704
-#define PG_TYPE_UNKNOWN		705
+#define PG_TYPE_BOOL         16
+#define PG_TYPE_BYTEA        17
+#define PG_TYPE_CHAR         18
+#define PG_TYPE_NAME         19
+#define PG_TYPE_INT8         20
+#define PG_TYPE_INT2         21
+#define PG_TYPE_INT2VECTOR   22
+#define PG_TYPE_INT4         23
+#define PG_TYPE_REGPROC      24
+#define PG_TYPE_TEXT         25
+#define PG_TYPE_OID          26
+#define PG_TYPE_TID          27
+#define PG_TYPE_XID          28
+#define PG_TYPE_CID          29
+#define PG_TYPE_OIDVECTOR    30
+#define PG_TYPE_SET          32
+#define PG_TYPE_CHAR2       409
+#define PG_TYPE_CHAR4       410
+#define PG_TYPE_CHAR8       411
+#define PG_TYPE_POINT       600
+#define PG_TYPE_LSEG        601
+#define PG_TYPE_PATH        602
+#define PG_TYPE_BOX         603
+#define PG_TYPE_POLYGON     604
+#define PG_TYPE_FILENAME    605
+#define PG_TYPE_FLOAT4      700
+#define PG_TYPE_FLOAT8      701
+#define PG_TYPE_ABSTIME     702
+#define PG_TYPE_RELTIME     703
+#define PG_TYPE_TINTERVAL   704
+#define PG_TYPE_UNKNOWN     705
 #define PG_TYPE_MONEY		790
-#define PG_TYPE_OIDINT2		810
-#define PG_TYPE_OIDINT4		910
-#define PG_TYPE_OIDNAME		911
-#define PG_TYPE_BPCHAR		1042
-#define PG_TYPE_VARCHAR		1043
-#define PG_TYPE_DATE		1082
-#define PG_TYPE_TIME		1083
-#define PG_TYPE_DATETIME	1184
-#define PG_TYPE_TIMESTAMP	1296
-#define PG_TYPE_NUMERIC		1700
+#define PG_TYPE_OIDINT2     810
+#define PG_TYPE_OIDINT4     910
+#define PG_TYPE_OIDNAME     911
+#define PG_TYPE_BPCHAR     1042
+#define PG_TYPE_VARCHAR    1043
+#define PG_TYPE_DATE       1082
+#define PG_TYPE_TIME       1083
+#define PG_TYPE_DATETIME   1184
+#define PG_TYPE_TIMESTAMP  1296
+#define PG_TYPE_NUMERIC    1700
 
 /* extern Int4 pgtypes_defined[]; */
 extern Int2 sqlTypes[];
 
 /*	Defines for pgtype_precision */
-#define PG_STATIC			-1
+#define PG_STATIC		-1	
 
-Int4		sqltype_to_pgtype(Int2 fSqlType);
+Int4 sqltype_to_pgtype(Int2 fSqlType);
 
-Int2		pgtype_to_sqltype(StatementClass *stmt, Int4 type);
-Int2		pgtype_to_ctype(StatementClass *stmt, Int4 type);
-char	   *pgtype_to_name(StatementClass *stmt, Int4 type);
+Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type);
+Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type);
+char *pgtype_to_name(StatementClass *stmt, Int4 type);
 
 /*	These functions can use static numbers or result sets(col parameter) */
-Int4		pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
-Int4		pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
-Int4		pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
-
-Int2		pgtype_scale(StatementClass *stmt, Int4 type, int col);
-Int2		pgtype_radix(StatementClass *stmt, Int4 type);
-Int2		pgtype_nullable(StatementClass *stmt, Int4 type);
-Int2		pgtype_auto_increment(StatementClass *stmt, Int4 type);
-Int2		pgtype_case_sensitive(StatementClass *stmt, Int4 type);
-Int2		pgtype_money(StatementClass *stmt, Int4 type);
-Int2		pgtype_searchable(StatementClass *stmt, Int4 type);
-Int2		pgtype_unsigned(StatementClass *stmt, Int4 type);
-char	   *pgtype_literal_prefix(StatementClass *stmt, Int4 type);
-char	   *pgtype_literal_suffix(StatementClass *stmt, Int4 type);
-char	   *pgtype_create_params(StatementClass *stmt, Int4 type);
-
-Int2		sqltype_to_default_ctype(Int2 sqltype);
+Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
+
+Int2 pgtype_scale(StatementClass *stmt, Int4 type, int col);
+Int2 pgtype_radix(StatementClass *stmt, Int4 type);
+Int2 pgtype_nullable(StatementClass *stmt, Int4 type);
+Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type);
+Int2 pgtype_case_sensitive(StatementClass *stmt, Int4 type);
+Int2 pgtype_money(StatementClass *stmt, Int4 type);
+Int2 pgtype_searchable(StatementClass *stmt, Int4 type);
+Int2 pgtype_unsigned(StatementClass *stmt, Int4 type);
+char *pgtype_literal_prefix(StatementClass *stmt, Int4 type);
+char *pgtype_literal_suffix(StatementClass *stmt, Int4 type);
+char *pgtype_create_params(StatementClass *stmt, Int4 type);
+
+Int2 sqltype_to_default_ctype(Int2 sqltype);
 
 #endif
+
diff --git a/src/interfaces/odbc/psqlodbc.c b/src/interfaces/odbc/psqlodbc.c
index 60a808a47f0fd41834e9f446c1d022e405eb2fd7..dbf4029a4acf9f77c6ae0d4aa93849860f27e22e 100644
--- a/src/interfaces/odbc/psqlodbc.c
+++ b/src/interfaces/odbc/psqlodbc.c
@@ -1,14 +1,15 @@
-/* Module:			psqlodbc.c
+
+/* Module:          psqlodbc.c
  *
- * Description:		This module contains the main entry point (DllMain) for the library.
- *					It also contains functions to get and set global variables for the
- *					driver in the registry.
+ * Description:     This module contains the main entry point (DllMain) for the library.
+ *                  It also contains functions to get and set global variables for the
+ *                  driver in the registry.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -35,59 +36,57 @@ GLOBAL_VALUES globals;
 RETCODE SQL_API SQLDummyOrdinal(void);
 
 #ifdef WIN32
-HINSTANCE NEAR s_hModule;		/* Saved module handle. */
+HINSTANCE NEAR s_hModule;               /* Saved module handle. */
 
 /*	This is where the Driver Manager attaches to this Driver */
-BOOL		WINAPI
-DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
+BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) 
 {
-	WORD		wVersionRequested;
-	WSADATA		wsaData;
+WORD wVersionRequested; 
+WSADATA wsaData; 
 
-	switch (ul_reason_for_call)
-	{
-		case DLL_PROCESS_ATTACH:
-			s_hModule = hInst;	/* Save for dialog boxes */
+	switch (ul_reason_for_call) {
+	case DLL_PROCESS_ATTACH:
+		s_hModule = hInst;				/* Save for dialog boxes */
 
-			/* Load the WinSock Library */
-			wVersionRequested = MAKEWORD(1, 1);
+		/*	Load the WinSock Library */
+		wVersionRequested = MAKEWORD(1, 1); 
 
-			if (WSAStartup(wVersionRequested, &wsaData))
-				return FALSE;
+		if ( WSAStartup(wVersionRequested, &wsaData))
+			return FALSE;
 
-			/* Verify that this is the minimum version of WinSock */
-			if (LOBYTE(wsaData.wVersion) != 1 ||
-				HIBYTE(wsaData.wVersion) != 1)
-			{
-				WSACleanup();
-				return FALSE;
-			}
+		/*	Verify that this is the minimum version of WinSock */
+		if ( LOBYTE( wsaData.wVersion ) != 1 || 
+			HIBYTE( wsaData.wVersion ) != 1 ) { 
 
-			getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
-			break;
+			WSACleanup(); 
+			return FALSE;
+		}
 
-		case DLL_THREAD_ATTACH:
-			break;
+		getGlobalDefaults(DBMS_NAME, ODBCINST_INI, FALSE);
+		break;
 
-		case DLL_PROCESS_DETACH:
+	case DLL_THREAD_ATTACH:
+		break;
 
-			WSACleanup();
+	case DLL_PROCESS_DETACH:
 
-			return TRUE;
+		WSACleanup();
 
-		case DLL_THREAD_DETACH:
-			break;
+		return TRUE;
 
-		default:
-			break;
-	}
+	case DLL_THREAD_DETACH:
+		break;
 
-	return TRUE;
+	default:
+		break;
+	}
 
-	UNREFERENCED_PARAMETER(lpReserved);
+	return TRUE;                                                                
+                                                                                
+	UNREFERENCED_PARAMETER(lpReserved);                                         
 }
 
-#else							/* not WIN32 */
+#else	/* not WIN32 */
 
 #ifndef TRUE
 #define TRUE	(BOOL)1
@@ -98,7 +97,7 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
 
 #ifdef __GNUC__
 
-/* This function is called at library initialization time.	*/
+/* This function is called at library initialization time.  */
 
 static BOOL
 __attribute__((constructor))
@@ -108,7 +107,7 @@ init(void)
 	return TRUE;
 }
 
-#else							/* not __GNUC__ */
+#else /* not __GNUC__ */
 
 /* These two functions do shared library initialziation on UNIX, well at least
  * on Linux. I don't know about other systems.
@@ -126,9 +125,9 @@ _fini(void)
 	return TRUE;
 }
 
-#endif	 /* not __GNUC__ */
+#endif /* not __GNUC__ */
 
-#endif	 /* not WIN32 */
+#endif /* not WIN32 */
 
 /*	This function is used to cause the Driver Manager to
 	call functions by number rather than name, which is faster.
@@ -136,8 +135,8 @@ _fini(void)
 	Driver Manager do this.  Also, the ordinal values of the
 	functions must match the value of fFunction in SQLGetFunctions()
 */
-RETCODE SQL_API
-SQLDummyOrdinal(void)
+RETCODE SQL_API SQLDummyOrdinal(void)
 {
 	return SQL_SUCCESS;
 }
+
diff --git a/src/interfaces/odbc/psqlodbc.h b/src/interfaces/odbc/psqlodbc.h
index 7ee777ed39064f364a6b676535e741742823418e..5226bb3fdac8c53e8f0fd2c523cb04174a99a760 100644
--- a/src/interfaces/odbc/psqlodbc.h
+++ b/src/interfaces/odbc/psqlodbc.h
@@ -1,12 +1,12 @@
 
-/* File:			psqlodbc.h
+/* File:            psqlodbc.h
  *
- * Description:		This file contains defines and declarations that are related to
- *					the entire driver.
+ * Description:     This file contains defines and declarations that are related to
+ *                  the entire driver.
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
- * $Id: psqlodbc.h,v 1.36 2001/02/11 13:53:42 momjian Exp $
+ * $Id: psqlodbc.h,v 1.37 2001/02/14 05:45:46 momjian Exp $
  */
 
 #ifndef __PSQLODBC_H__
@@ -16,7 +16,7 @@
 #include "config.h"
 #endif
 
-#include <stdio.h>				/* for FILE* pointers: see GLOBAL_VALUES */
+#include <stdio.h>	/* for FILE* pointers: see GLOBAL_VALUES */
 
 #ifndef WIN32
 #define Int4 long int
@@ -25,7 +25,6 @@
 #define UInt2 unsigned short
 typedef float SFLOAT;
 typedef double SDOUBLE;
-
 #else
 #define Int4 int
 #define UInt4 unsigned int
@@ -36,13 +35,13 @@ typedef double SDOUBLE;
 typedef UInt4 Oid;
 
 /* Driver stuff */
-#define ODBCVER					0x0250
-#define DRIVER_ODBC_VER			"02.50"
+#define ODBCVER				0x0250
+#define DRIVER_ODBC_VER		"02.50"
 
-#define DRIVERNAME				"PostgreSQL ODBC"
-#define DBMS_NAME				"PostgreSQL"
+#define DRIVERNAME             "PostgreSQL ODBC"
+#define DBMS_NAME              "PostgreSQL"
 
-#define POSTGRESDRIVERVERSION	"07.01.0003"
+#define POSTGRESDRIVERVERSION  "07.01.0002"
 
 #ifdef WIN32
 #define DRIVER_FILE_NAME		"PSQLODBC.DLL"
@@ -52,53 +51,48 @@ typedef UInt4 Oid;
 
 /* Limits */
 #ifdef WIN32
-#define BLCKSZ					4096
+#define BLCKSZ                      4096
 #endif
 
-#define MAX_MESSAGE_LEN			65536	/* This puts a limit on query size
-										 * but I don't */
- /* see an easy way round this - DJP 24-1-2001 */
-#define MAX_CONNECT_STRING		4096
-#define ERROR_MSG_LENGTH		4096
-#define FETCH_MAX				100		/* default number of rows to cache
-										 * for declare/fetch */
-#define TUPLE_MALLOC_INC		100
-#define SOCK_BUFFER_SIZE		4096	/* default socket buffer size */
-#define MAX_CONNECTIONS			128		/* conns per environment
-										 * (arbitrary)	*/
-#define MAX_FIELDS				512
-#define BYTELEN					8
-#define VARHDRSZ				sizeof(Int4)
-
-#define MAX_TABLE_LEN			32
-#define MAX_COLUMN_LEN			32
-#define MAX_CURSOR_LEN			32
+#define MAX_MESSAGE_LEN				65536   /* This puts a limit on query size but I don't */
+											/* see an easy way round this - DJP 24-1-2001 */
+#define MAX_CONNECT_STRING			4096
+#define ERROR_MSG_LENGTH			4096
+#define FETCH_MAX					100		/* default number of rows to cache for declare/fetch */
+#define TUPLE_MALLOC_INC			100
+#define SOCK_BUFFER_SIZE			4096	/* default socket buffer size */
+#define MAX_CONNECTIONS				128		/* conns per environment (arbitrary)  */
+#define MAX_FIELDS					512
+#define BYTELEN						8
+#define VARHDRSZ					sizeof(Int4)
+
+#define MAX_TABLE_LEN				32
+#define MAX_COLUMN_LEN				32
+#define MAX_CURSOR_LEN				32
 
 /*	Registry length limits */
-#define LARGE_REGISTRY_LEN		4096	/* used for special cases */
-#define MEDIUM_REGISTRY_LEN		256		/* normal size for
-										 * user,database,etc. */
-#define SMALL_REGISTRY_LEN		10		/* for 1/0 settings */
+#define LARGE_REGISTRY_LEN			4096	/* used for special cases */
+#define MEDIUM_REGISTRY_LEN			256		/* normal size for user,database,etc. */
+#define SMALL_REGISTRY_LEN			10		/* for 1/0 settings */
 
 
 /*	These prefixes denote system tables */
-#define POSTGRES_SYS_PREFIX		"pg_"
-#define KEYS_TABLE				"dd_fkey"
+#define POSTGRES_SYS_PREFIX	"pg_"
+#define KEYS_TABLE			"dd_fkey"
 
 /*	Info limits */
-#define MAX_INFO_STRING			128
-#define MAX_KEYPARTS			20
-#define MAX_KEYLEN				512		/* max key of the form
-										 * "date+outlet+invoice" */
-#define MAX_ROW_SIZE			0		/* Unlimited rowsize with the
-										 * Tuple Toaster */
-#define MAX_STATEMENT_LEN		0		/* Unlimited statement size with
-										 * 7.0 */
+#define MAX_INFO_STRING		128
+#define MAX_KEYPARTS		20
+#define MAX_KEYLEN			512			/*	max key of the form "date+outlet+invoice" */
+#define MAX_ROW_SIZE		0 /* Unlimited rowsize with the Tuple Toaster */
+#define MAX_STATEMENT_LEN	0 /* Unlimited statement size with 7.0 */
 
 /* Previously, numerous query strings were defined of length MAX_STATEMENT_LEN */
 /* Now that's 0, lets use this instead. DJP 24-1-2001 */
-#define STD_STATEMENT_LEN		MAX_MESSAGE_LEN
+#define STD_STATEMENT_LEN	MAX_MESSAGE_LEN
 
+#define PG62	"6.2"		/* "Protocol" key setting to force Postgres 6.2 */
+#define PG63	"6.3"		/* "Protocol" key setting to force postgres 6.3 */
 #define PG64	"6.4"
 
 typedef struct ConnectionClass_ ConnectionClass;
@@ -118,73 +112,60 @@ typedef struct lo_arg LO_ARG;
 
 typedef struct GlobalValues_
 {
-	int			fetch_max;
-	int			socket_buffersize;
-	int			unknown_sizes;
-	int			max_varchar_size;
-	int			max_longvarchar_size;
-	char		debug;
-	char		commlog;
-	char		disable_optimizer;
-	char		ksqo;
-	char		unique_index;
-	char		onlyread;		/* readonly is reserved on Digital C++
-								 * compiler */
-	char		use_declarefetch;
-	char		text_as_longvarchar;
-	char		unknowns_as_longvarchar;
-	char		bools_as_char;
-	char		lie;
-	char		parse;
-	char		cancel_as_freestmt;
-	char		extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
-	char		conn_settings[LARGE_REGISTRY_LEN];
-
-	/*
-	 * Protocol is not used anymore, but kept in case it is useful in the
-	 * future.	bjm 2001-02-10
-	 */
-	char		protocol[SMALL_REGISTRY_LEN];
-	FILE	   *mylogFP;
-	FILE	   *qlogFP;
+	int					fetch_max;
+	int					socket_buffersize;
+	int					unknown_sizes;
+	int					max_varchar_size;
+	int					max_longvarchar_size;
+	char				debug;
+	char				commlog;
+	char				disable_optimizer;
+	char				ksqo;
+	char				unique_index;
+	char				onlyread; /* readonly is reserved on Digital C++ compiler */
+	char				use_declarefetch;
+	char				text_as_longvarchar;
+	char				unknowns_as_longvarchar;
+	char				bools_as_char;
+	char				lie;
+	char				parse;
+	char				cancel_as_freestmt;
+	char				extra_systable_prefixes[MEDIUM_REGISTRY_LEN];
+	char				conn_settings[LARGE_REGISTRY_LEN];
+	char				protocol[SMALL_REGISTRY_LEN];
+
+	FILE*				mylogFP;
+	FILE*				qlogFP;	
 } GLOBAL_VALUES;
 
-typedef struct StatementOptions_
-{
-	int			maxRows;
-	int			maxLength;
-	int			rowset_size;
-	int			keyset_size;
-	int			cursor_type;
-	int			scroll_concurrency;
-	int			retrieve_data;
-	int			bind_size;		/* size of each structure if using Row
-								 * Binding */
-	int			use_bookmarks;
+typedef struct StatementOptions_ {
+	int maxRows;
+	int maxLength;
+	int rowset_size;
+	int keyset_size;
+	int cursor_type;
+	int scroll_concurrency;
+	int retrieve_data;
+	int bind_size;		        /* size of each structure if using Row Binding */
+	int use_bookmarks;
 } StatementOptions;
 
 /*	Used to pass extra query info to send_query */
-typedef struct QueryInfo_
-{
-	int			row_size;
-	QResultClass *result_in;
-	char	   *cursor;
+typedef struct QueryInfo_ {
+	int				row_size;
+	QResultClass	*result_in;
+	char			*cursor;
 } QueryInfo;
 
 
-#define PG_TYPE_LO					-999		/* hack until permanent
-												 * type available */
-#define PG_TYPE_LO_NAME				"lo"
-#define OID_ATTNUM					-2	/* the attnum in pg_index of the
-										 * oid */
+#define PG_TYPE_LO				-999	/* hack until permanent type available */
+#define PG_TYPE_LO_NAME			"lo"
+#define OID_ATTNUM				-2		/* the attnum in pg_index of the oid */
 
 /* sizes */
-#define TEXT_FIELD_SIZE				8190		/* size of text fields
-												 * (not including null
-												 * term) */
-#define NAME_FIELD_SIZE				32	/* size of name fields */
-#define MAX_VARCHAR_SIZE			254 /* maximum size of a varchar (not
-										 * including null term) */
+#define TEXT_FIELD_SIZE			8190	/* size of text fields (not including null term) */
+#define NAME_FIELD_SIZE			32		/* size of name fields */
+#define MAX_VARCHAR_SIZE		254		/* maximum size of a varchar (not including null term) */
 
 #define PG_NUMERIC_MAX_PRECISION	1000
 #define PG_NUMERIC_MAX_SCALE		1000
diff --git a/src/interfaces/odbc/psqlodbc.rc b/src/interfaces/odbc/psqlodbc.rc
index 381c1631894b3674f6db503b4a31de694e91b2b3..503b478372a5a25f5120434bf9a433df0845d754 100644
--- a/src/interfaces/odbc/psqlodbc.rc
+++ b/src/interfaces/odbc/psqlodbc.rc
@@ -133,7 +133,7 @@ BEGIN
     PUSHBUTTON      "Defaults",IDDEFAULTS,185,205,50,15
 END
 
-DLG_OPTIONS_DS DIALOG DISCARDABLE  0, 0, 267, 125
+DLG_OPTIONS_DS DIALOG DISCARDABLE  0, 0, 267, 161
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Advanced Options (DataSource)"
 FONT 8, "MS Sans Serif"
@@ -144,16 +144,23 @@ BEGIN
                     BS_AUTOCHECKBOX | WS_TABSTOP,130,10,85,10
     CONTROL         "Show System &Tables",DS_SHOWSYSTEMTABLES,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,25,25,85,10
-    GROUPBOX        "OID Options",IDC_STATIC,39,41,180,25
+    GROUPBOX        "Protocol",IDC_STATIC,15,40,180,25
+    CONTROL         "6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP,25,
+                    50,35,10
+    CONTROL         "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+                    75,50,26,10
+    CONTROL         "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
+                    130,50,26,10
+    GROUPBOX        "OID Options",IDC_STATIC,15,70,180,25
     CONTROL         "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX | 
-                    WS_GROUP | WS_TABSTOP,62,51,59,10
+                    WS_GROUP | WS_TABSTOP,25,81,59,10
     CONTROL         "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX | 
-                    WS_GROUP | WS_TABSTOP,151,51,51,10
-    RTEXT           "Connect &Settings:",IDC_STATIC,11,73,35,25
-    EDITTEXT        DS_CONNSETTINGS,49,73,200,20,ES_MULTILINE | 
+                    WS_GROUP | WS_TABSTOP,115,81,51,10
+    RTEXT           "Connect &Settings:",IDC_STATIC,10,105,35,25
+    EDITTEXT        DS_CONNSETTINGS,50,105,200,20,ES_MULTILINE | 
                     ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
-    DEFPUSHBUTTON   "OK",IDOK,71,103,50,14,WS_GROUP
-    PUSHBUTTON      "Cancel",IDCANCEL,145,103,50,14
+    DEFPUSHBUTTON   "OK",IDOK,71,135,50,14,WS_GROUP
+    PUSHBUTTON      "Cancel",IDCANCEL,146,135,50,14
 END
 
 
@@ -184,7 +191,7 @@ BEGIN
         RIGHTMARGIN, 260
         VERTGUIDE, 55
         TOPMARGIN, 7
-        BOTTOMMARGIN, 118
+        BOTTOMMARGIN, 154
     END
 END
 #endif    // APSTUDIO_INVOKED
@@ -197,8 +204,8 @@ END
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 7,1,0,3
- PRODUCTVERSION 7,1,0,3
+ FILEVERSION 7,1,0,2
+ PRODUCTVERSION 7,1,0,2
  FILEFLAGSMASK 0x3L
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -216,14 +223,14 @@ BEGIN
             VALUE "Comments", "PostgreSQL ODBC driver\0"
             VALUE "CompanyName", "Insight Distribution Systems\0"
             VALUE "FileDescription", "PostgreSQL Driver\0"
-            VALUE "FileVersion", " 07.01.0003\0"
+            VALUE "FileVersion", " 07.01.0002\0"
             VALUE "InternalName", "psqlodbc\0"
             VALUE "LegalCopyright", "\0"
             VALUE "LegalTrademarks", "ODBC(TM) is a trademark of Microsoft Corporation.  Microsoft® is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation.\0"
             VALUE "OriginalFilename", "psqlodbc.dll\0"
             VALUE "PrivateBuild", "\0"
             VALUE "ProductName", "Microsoft Open Database Connectivity\0"
-            VALUE "ProductVersion", " 07.01.0003\0"
+            VALUE "ProductVersion", " 07.01.0002\0"
             VALUE "SpecialBuild", "\0"
         END
     END
diff --git a/src/interfaces/odbc/qresult.c b/src/interfaces/odbc/qresult.c
index 9b1e99814ff25b189396e06978e5a527df37745f..de52884ff3cd562a3550fc98539a7029c8a96c26 100644
--- a/src/interfaces/odbc/qresult.c
+++ b/src/interfaces/odbc/qresult.c
@@ -1,19 +1,20 @@
-/* Module:			qresult.c
+
+/* Module:          qresult.c
  *
- * Description:		This module contains functions related to
- *					managing result information (i.e, fetching rows from the backend,
- *					managing the tuple cache, etc.) and retrieving it.
- *					Depending on the situation, a QResultClass will hold either data
- *					from the backend or a manually built result (see "qresult.h" to
- *					see which functions/macros are for manual or backend results.
- *					For manually built results, the QResultClass simply points to
- *					TupleList and ColumnInfo structures, which actually hold the data.
+ * Description:     This module contains functions related to 
+ *                  managing result information (i.e, fetching rows from the backend,
+ *                  managing the tuple cache, etc.) and retrieving it.
+ *                  Depending on the situation, a QResultClass will hold either data
+ *                  from the backend or a manually built result (see "qresult.h" to
+ *                  see which functions/macros are for manual or backend results.
+ *                  For manually built results, the QResultClass simply points to 
+ *                  TupleList and ColumnInfo structures, which actually hold the data.
  *
- * Classes:			QResultClass (Functions prefix: "QR_")
+ * Classes:         QResultClass (Functions prefix: "QR_")
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -31,23 +32,23 @@
 
 extern GLOBAL_VALUES globals;
 
-/*	Used for building a Manual Result only */
+/*  Used for building a Manual Result only */
 /*	All info functions call this function to create the manual result set. */
-void
+void 
 QR_set_num_fields(QResultClass *self, int new_num_fields)
 {
 	mylog("in QR_set_num_fields\n");
 
-	CI_set_num_fields(self->fields, new_num_fields);
-	if (self->manual_tuples)
-		TL_Destructor(self->manual_tuples);
+    CI_set_num_fields(self->fields, new_num_fields);
+    if(self->manual_tuples) 
+        TL_Destructor(self->manual_tuples);
 
-	self->manual_tuples = TL_Constructor(new_num_fields);
+    self->manual_tuples = TL_Constructor(new_num_fields);
 
 	mylog("exit QR_set_num_fields\n");
 }
 
-void
+void 
 QR_set_position(QResultClass *self, int pos)
 {
 	self->tupleField = self->backend_tuples + ((self->base + pos) * self->num_fields);
@@ -59,7 +60,7 @@ QR_set_cache_size(QResultClass *self, int cache_size)
 	self->cache_size = cache_size;
 }
 
-void
+void 
 QR_set_rowset_size(QResultClass *self, int rowset_size)
 {
 	self->rowset_size = rowset_size;
@@ -72,29 +73,27 @@ QR_inc_base(QResultClass *self, int base_inc)
 }
 
 /************************************/
-/* CLASS QResult					*/
+/* CLASS QResult                    */
 /************************************/
 
 QResultClass *
 QR_Constructor(void)
 {
-	QResultClass *rv;
+QResultClass *rv;
 
 	mylog("in QR_Constructor\n");
 	rv = (QResultClass *) malloc(sizeof(QResultClass));
 
-	if (rv != NULL)
-	{
+	if (rv != NULL) {
 		rv->status = PGRES_EMPTY_QUERY;
 
 		/* construct the column info */
-		if (!(rv->fields = CI_Constructor()))
-		{
+		if ( ! (rv->fields = CI_Constructor())) {
 			free(rv);
 			return NULL;
 		}
-		rv->manual_tuples = NULL;
-		rv->backend_tuples = NULL;
+		rv->manual_tuples = NULL;	
+		rv->backend_tuples = NULL;	
 		rv->message = NULL;
 		rv->command = NULL;
 		rv->notice = NULL;
@@ -110,6 +109,7 @@ QR_Constructor(void)
 
 		rv->cache_size = globals.fetch_max;
 		rv->rowset_size = 1;
+
 	}
 
 	mylog("exit QR_Constructor\n");
@@ -125,32 +125,33 @@ QR_Destructor(QResultClass *self)
 	if (self->manual_tuples)
 		TL_Destructor(self->manual_tuples);
 
-	/* If conn is defined, then we may have used "backend_tuples", */
-	/* so in case we need to, free it up.  Also, close the cursor. */
+	/*	If conn is defined, then we may have used "backend_tuples", */
+	/*	so in case we need to, free it up.  Also, close the cursor. */
 	if (self->conn && self->conn->sock && CC_is_in_trans(self->conn))
 		QR_close(self);			/* close the cursor if there is one */
 
-	QR_free_memory(self);		/* safe to call anyway */
+	QR_free_memory(self);	/* safe to call anyway */
 
-	/* Should have been freed in the close() but just in case... */
+	/*	Should have been freed in the close() but just in case... */
 	if (self->cursor)
 		free(self->cursor);
 
-	/* Free up column info */
+	/*	Free up column info */
 	if (self->fields)
 		CI_Destructor(self->fields);
 
-	/* Free command info (this is from strdup()) */
+	/*	Free command info (this is from strdup()) */
 	if (self->command)
 		free(self->command);
 
-	/* Free notice info (this is from strdup()) */
+	/*	Free notice info (this is from strdup()) */
 	if (self->notice)
 		free(self->notice);
 
 	free(self);
 
 	mylog("QResult: exit DESTRUCTOR\n");
+
 }
 
 void
@@ -162,7 +163,7 @@ QR_set_command(QResultClass *self, char *msg)
 	self->command = msg ? strdup(msg) : NULL;
 }
 
-void
+void 
 QR_set_notice(QResultClass *self, char *msg)
 {
 	if (self->notice)
@@ -171,31 +172,27 @@ QR_set_notice(QResultClass *self, char *msg)
 	self->notice = msg ? strdup(msg) : NULL;
 }
 
-void
+void 
 QR_free_memory(QResultClass *self)
 {
-	register int lf,
-				row;
-	register TupleField *tuple = self->backend_tuples;
-	int			fcount = self->fcount;
-	int			num_fields = self->num_fields;
+register int lf, row;
+register TupleField *tuple = self->backend_tuples;
+int fcount = self->fcount;
+int num_fields = self->num_fields;
 
 	mylog("QResult: free memory in, fcount=%d\n", fcount);
 
-	if (self->backend_tuples)
-	{
-		for (row = 0; row < fcount; row++)
-		{
+	if ( self->backend_tuples) {
+
+		for (row = 0; row < fcount; row++) {
 			mylog("row = %d, num_fields = %d\n", row, num_fields);
-			for (lf = 0; lf < num_fields; lf++)
-			{
-				if (tuple[lf].value != NULL)
-				{
+			for (lf=0; lf < num_fields; lf++) {
+				if (tuple[lf].value != NULL) {
 					mylog("free [lf=%d] %u\n", lf, tuple[lf].value);
 					free(tuple[lf].value);
 				}
 			}
-			tuple += num_fields;/* next row */
+			tuple += num_fields;  /* next row */
 		}
 
 		free(self->backend_tuples);
@@ -211,42 +208,37 @@ QR_free_memory(QResultClass *self)
 char
 QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
 {
-	int			tuple_size;
-
-	/* If called from send_query the first time (conn != NULL),  */
-	/* then set the inTuples state, */
-	/* and read the tuples.  If conn is NULL, */
-	/* it implies that we are being called from next_tuple(), */
-	/* like to get more rows so don't call next_tuple again! */
-	if (conn != NULL)
-	{
+int tuple_size;
+
+	/*	If called from send_query the first time (conn != NULL),  */
+	/*	then set the inTuples state, */
+	/*	and read the tuples.  If conn is NULL, */
+	/*	it implies that we are being called from next_tuple(), */
+	/*	like to get more rows so don't call next_tuple again! */
+	if (conn != NULL) {
 		self->conn = conn;
 
-		mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n", (cursor == NULL) ? "" : cursor, self->cursor);
+		mylog("QR_fetch_tuples: cursor = '%s', self->cursor=%u\n",  (cursor==NULL)?"":cursor, self->cursor);
 
 		if (self->cursor)
 			free(self->cursor);
 
-		if (globals.use_declarefetch)
-		{
-			if (!cursor || cursor[0] == '\0')
-			{
+		if ( globals.use_declarefetch) {
+			if (! cursor || cursor[0] == '\0') {
 				self->status = PGRES_INTERNAL_ERROR;
 				QR_set_message(self, "Internal Error -- no cursor for fetch");
 				return FALSE;
 			}
 			self->cursor = strdup(cursor);
 		}
-
-		/* Read the field attributes. */
-		/* $$$$ Should do some error control HERE! $$$$ */
-		if (CI_read_fields(self->fields, self->conn))
-		{
+ 
+		/*	Read the field attributes. */
+		/*	$$$$ Should do some error control HERE! $$$$ */
+		if ( CI_read_fields(self->fields, self->conn)) {
 			self->status = PGRES_FIELDS_OK;
 			self->num_fields = CI_get_num_fields(self->fields);
 		}
-		else
-		{
+		else {
 			self->status = PGRES_BAD_RESPONSE;
 			QR_set_message(self, "Error reading field information");
 			return FALSE;
@@ -254,7 +246,7 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
 
 		mylog("QR_fetch_tuples: past CI_read_fields: num_fields = %d\n", self->num_fields);
 
-		if (globals.use_declarefetch)
+		if (globals.use_declarefetch) 
 			tuple_size = self->cache_size;
 		else
 			tuple_size = TUPLE_MALLOC_INC;
@@ -262,9 +254,8 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
 		/* allocate memory for the tuple cache */
 		mylog("MALLOC: tuple_size = %d, size = %d\n", tuple_size, self->num_fields * sizeof(TupleField) * tuple_size);
 		self->backend_tuples = (TupleField *) malloc(self->num_fields * sizeof(TupleField) * tuple_size);
-		if (!self->backend_tuples)
-		{
-			self->status = PGRES_FATAL_ERROR;
+		if ( ! self->backend_tuples) {
+			self->status = PGRES_FATAL_ERROR; 
 			QR_set_message(self, "Could not get memory for tuple cache.");
 			return FALSE;
 		}
@@ -272,20 +263,19 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
 		self->inTuples = TRUE;
 
 
-		/* Force a read to occur in next_tuple */
-		self->fcount = tuple_size + 1;
-		self->fetch_count = tuple_size + 1;
+		/*  Force a read to occur in next_tuple */
+		self->fcount = tuple_size+1;
+		self->fetch_count = tuple_size+1;
 		self->base = 0;
 
 		return QR_next_tuple(self);
 	}
-	else
-	{
-		/* Always have to read the field attributes. */
-		/* But we dont have to reallocate memory for them! */
+	else {
 
-		if (!CI_read_fields(NULL, self->conn))
-		{
+		/*	Always have to read the field attributes. */
+		/*	But we dont have to reallocate memory for them! */
+
+		if ( ! CI_read_fields(NULL, self->conn)) {
 			self->status = PGRES_BAD_RESPONSE;
 			QR_set_message(self, "Error reading field information");
 			return FALSE;
@@ -299,11 +289,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
 int
 QR_close(QResultClass *self)
 {
-	QResultClass *res;
+QResultClass *res;
 
-	if (globals.use_declarefetch && self->conn && self->cursor)
-	{
-		char		buf[64];
+	if (globals.use_declarefetch && self->conn && self->cursor) {
+		char buf[64];
 
 		sprintf(buf, "close %s", self->cursor);
 		mylog("QResult: closing cursor: '%s'\n", buf);
@@ -316,29 +305,27 @@ QR_close(QResultClass *self)
 		free(self->cursor);
 		self->cursor = NULL;
 
-		if (res == NULL)
-		{
+		if (res == NULL) {
 			self->status = PGRES_FATAL_ERROR;
 			QR_set_message(self, "Error closing cursor.");
 			return FALSE;
 		}
 
-		/* End the transaction if there are no cursors left on this conn */
-		if (CC_cursor_count(self->conn) == 0)
-		{
+		/*	End the transaction if there are no cursors left on this conn */
+		if (CC_cursor_count(self->conn) == 0) {
 			mylog("QResult: END transaction on conn=%u\n", self->conn);
 
 			res = CC_send_query(self->conn, "END", NULL);
 
 			CC_set_no_trans(self->conn);
 
-			if (res == NULL)
-			{
+			if (res == NULL) {
 				self->status = PGRES_FATAL_ERROR;
 				QR_set_message(self, "Error ending transaction.");
 				return FALSE;
 			}
 		}
+
 	}
 
 	return TRUE;
@@ -348,64 +335,54 @@ QR_close(QResultClass *self)
 int
 QR_next_tuple(QResultClass *self)
 {
-	int			id;
-	QResultClass *res;
-	SocketClass *sock;
-
+int id;
+QResultClass *res;
+SocketClass *sock;
 /* Speed up access */
-	int			fetch_count = self->fetch_count;
-	int			fcount = self->fcount;
-	int			fetch_size,
-				offset = 0;
-	int			end_tuple = self->rowset_size + self->base;
-	char		corrected = FALSE;
-	TupleField *the_tuples = self->backend_tuples;
-	static char msgbuffer[MAX_MESSAGE_LEN + 1];
-	char		cmdbuffer[MAX_MESSAGE_LEN + 1]; /* QR_set_command() dups
-												 * this string so dont
-												 * need static */
-	char		fetch[128];
-	QueryInfo	qi;
-
-	if (fetch_count < fcount)
-	{							/* return a row from cache */
+int fetch_count = self->fetch_count;
+int fcount = self->fcount;
+int fetch_size, offset= 0;
+int end_tuple = self->rowset_size + self->base;
+char corrected = FALSE;
+TupleField *the_tuples = self->backend_tuples;
+static char msgbuffer[MAX_MESSAGE_LEN+1];
+char cmdbuffer[MAX_MESSAGE_LEN+1];	/* QR_set_command() dups this string so dont need static */
+char fetch[128];
+QueryInfo qi;
+
+	if (fetch_count < fcount) {	/* return a row from cache */
 		mylog("next_tuple: fetch_count < fcount: returning tuple %d, fcount = %d\n", fetch_count, fcount);
-		self->tupleField = the_tuples + (fetch_count * self->num_fields);		/* next row */
+		self->tupleField = the_tuples + (fetch_count * self->num_fields); /* next row */
 		self->fetch_count++;
 		return TRUE;
 	}
-	else if (self->fcount < self->cache_size)
-	{							/* last row from cache */
-		/* We are done because we didn't even get CACHE_SIZE tuples */
-		mylog("next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d\n", fcount, fetch_count);
-		self->tupleField = NULL;
-		self->status = PGRES_END_TUPLES;
-		return -1;				/* end of tuples */
+	else if (self->fcount < self->cache_size) {   /* last row from cache */
+		  /*	We are done because we didn't even get CACHE_SIZE tuples */
+		  mylog("next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d\n", fcount, fetch_count);
+		  self->tupleField = NULL;
+		  self->status = PGRES_END_TUPLES;
+		  return -1;	/* end of tuples */
 	}
-	else
-	{
-
-		/*
-		 * See if we need to fetch another group of rows. We may be being
-		 * called from send_query(), and if so, don't send another fetch,
-		 * just fall through and read the tuples.
-		 */
+	else {	
+		/*	See if we need to fetch another group of rows.
+			We may be being called from send_query(), and
+			if so, don't send another fetch, just fall through
+			and read the tuples.
+		*/
 		self->tupleField = NULL;
 
-		if (!self->inTuples)
-		{
-			if (!globals.use_declarefetch)
-			{
+		if ( ! self->inTuples) {
+
+			if ( ! globals.use_declarefetch) {
 				mylog("next_tuple: ALL_ROWS: done, fcount = %d, fetch_count = %d\n", fcount, fetch_count);
 				self->tupleField = NULL;
 				self->status = PGRES_END_TUPLES;
-				return -1;		/* end of tuples */
+				return -1;	/* end of tuples */
 			}
 
-			if (self->base == fcount)
-			{					/* not a correction */
+			if (self->base == fcount) {		/* not a correction */
 
-				/* Determine the optimum cache size.  */
+				/*	Determine the optimum cache size.  */
 				if (globals.fetch_max % self->rowset_size == 0)
 					fetch_size = globals.fetch_max;
 				else if (self->rowset_size < globals.fetch_max)
@@ -414,10 +391,9 @@ QR_next_tuple(QResultClass *self)
 					fetch_size = self->rowset_size;
 
 				self->cache_size = fetch_size;
-				self->fetch_count = 1;
-			}
-			else
-			{					/* need to correct */
+				self->fetch_count = 1;		
+			} 
+			else {	/* need to correct */
 
 				corrected = TRUE;
 
@@ -427,13 +403,13 @@ QR_next_tuple(QResultClass *self)
 
 				offset = self->fetch_count;
 				self->fetch_count++;
+
 			}
 
 
 			self->backend_tuples = (TupleField *) realloc(self->backend_tuples, self->num_fields * sizeof(TupleField) * self->cache_size);
-			if (!self->backend_tuples)
-			{
-				self->status = PGRES_FATAL_ERROR;
+			if ( ! self->backend_tuples) {
+				self->status = PGRES_FATAL_ERROR; 
 				QR_set_message(self, "Out of memory while reading tuples.");
 				return FALSE;
 			}
@@ -441,34 +417,29 @@ QR_next_tuple(QResultClass *self)
 
 			mylog("next_tuple: sending actual fetch (%d) query '%s'\n", fetch_size, fetch);
 
-			/* don't read ahead for the next tuple (self) ! */
+			/*	don't read ahead for the next tuple (self) ! */
 			qi.row_size = self->cache_size;
 			qi.result_in = self;
 			qi.cursor = NULL;
 			res = CC_send_query(self->conn, fetch, &qi);
-			if (res == NULL)
-			{
+			if (res == NULL) {
 				self->status = PGRES_FATAL_ERROR;
 				QR_set_message(self, "Error fetching next group.");
 				return FALSE;
 			}
 			self->inTuples = TRUE;
 		}
-		else
-		{
+		else {
 			mylog("next_tuple: inTuples = true, falling through: fcount = %d, fetch_count = %d\n", self->fcount, self->fetch_count);
-
-			/*
-			 * This is a pre-fetch (fetching rows right after query but
-			 * before any real SQLFetch() calls.  This is done so the
-			 * field attributes are available.
-			 */
+			/*	This is a pre-fetch (fetching rows right after query
+				but before any real SQLFetch() calls.  This is done
+				so the field attributes are available.
+			*/
 			self->fetch_count = 0;
 		}
 	}
 
-	if (!corrected)
-	{
+	if ( ! corrected) {
 		self->base = 0;
 		self->fcount = 0;
 	}
@@ -477,96 +448,88 @@ QR_next_tuple(QResultClass *self)
 	sock = CC_get_socket(self->conn);
 	self->tupleField = NULL;
 
-	for (;;)
-	{
+	for ( ; ;) {
+
 		id = SOCK_get_char(sock);
 
-		switch (id)
-		{
-			case 'T':			/* Tuples within tuples cannot be handled */
-				self->status = PGRES_BAD_RESPONSE;
-				QR_set_message(self, "Tuples within tuples cannot be handled");
-				return FALSE;
-			case 'B':			/* Tuples in binary format */
-			case 'D':			/* Tuples in ASCII format  */
-
-				if (!globals.use_declarefetch && self->fcount > 0 && !(self->fcount % TUPLE_MALLOC_INC))
-				{
-					size_t		old_size = self->fcount * self->num_fields * sizeof(TupleField);
-
-					mylog("REALLOC: old_size = %d\n", old_size);
-
-					self->backend_tuples = (TupleField *) realloc(self->backend_tuples, old_size + (self->num_fields * sizeof(TupleField) * TUPLE_MALLOC_INC));
-					if (!self->backend_tuples)
-					{
-						self->status = PGRES_FATAL_ERROR;
-						QR_set_message(self, "Out of memory while reading tuples.");
-						return FALSE;
-					}
-				}
+		switch (id) {
+		case 'T': /* Tuples within tuples cannot be handled */
+			self->status = PGRES_BAD_RESPONSE;
+			QR_set_message(self, "Tuples within tuples cannot be handled");
+			return FALSE;
+		case 'B': /* Tuples in binary format */
+		case 'D': /* Tuples in ASCII format  */
 
-				if (!QR_read_tuple(self, (char) (id == 0)))
-				{
-					self->status = PGRES_BAD_RESPONSE;
-					QR_set_message(self, "Error reading the tuple");
+			if ( ! globals.use_declarefetch && self->fcount > 0 && ! (self->fcount % TUPLE_MALLOC_INC)) {
+				size_t old_size = self->fcount * self->num_fields * sizeof(TupleField);
+				mylog("REALLOC: old_size = %d\n", old_size);
+
+				self->backend_tuples = (TupleField *) realloc(self->backend_tuples, old_size + (self->num_fields * sizeof(TupleField) * TUPLE_MALLOC_INC));
+				if ( ! self->backend_tuples) {
+					self->status = PGRES_FATAL_ERROR; 
+					QR_set_message(self, "Out of memory while reading tuples.");
 					return FALSE;
 				}
+			}
 
-				self->fcount++;
-				break;			/* continue reading */
+			if ( ! QR_read_tuple(self, (char) (id == 0))) {
+				self->status = PGRES_BAD_RESPONSE;
+				QR_set_message(self, "Error reading the tuple");
+				return FALSE;
+			}
+			
+			self->fcount++;
+			break;	/* continue reading */
 
 
-			case 'C':			/* End of tuple list */
-				SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
-				QR_set_command(self, cmdbuffer);
+		case 'C': /* End of tuple list */
+			SOCK_get_string(sock, cmdbuffer, MAX_MESSAGE_LEN);
+			QR_set_command(self, cmdbuffer);
 
-				mylog("end of tuple list -- setting inUse to false: this = %u\n", self);
+			mylog("end of tuple list -- setting inUse to false: this = %u\n", self);
 
-				self->inTuples = FALSE;
-				if (self->fcount > 0)
-				{
-					qlog("    [ fetched %d rows ]\n", self->fcount);
-					mylog("_next_tuple: 'C' fetch_max && fcount = %d\n", self->fcount);
+			self->inTuples = FALSE;
+			if (self->fcount > 0) {
 
-					/* set to first row */
-					self->tupleField = self->backend_tuples + (offset * self->num_fields);
-					return TRUE;
-				}
-				else
-				{				/* We are surely done here (we read 0
-								 * tuples) */
-					qlog("    [ fetched 0 rows ]\n");
-					mylog("_next_tuple: 'C': DONE (fcount == 0)\n");
-					return -1;	/* end of tuples */
-				}
+				qlog("    [ fetched %d rows ]\n", self->fcount);
+				mylog("_next_tuple: 'C' fetch_max && fcount = %d\n", self->fcount);
 
-			case 'E':			/* Error */
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-				QR_set_message(self, msgbuffer);
-				self->status = PGRES_FATAL_ERROR;
+				/*  set to first row */
+				self->tupleField = self->backend_tuples + (offset * self->num_fields);
+				return TRUE;
+			} 
+			else { /*	We are surely done here (we read 0 tuples) */
+				qlog("    [ fetched 0 rows ]\n");
+				mylog("_next_tuple: 'C': DONE (fcount == 0)\n");
+				return -1;	/* end of tuples */
+			}
 
-				if (!strncmp(msgbuffer, "FATAL", 5))
-					CC_set_no_trans(self->conn);
+		case 'E': /* Error */
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			QR_set_message(self, msgbuffer);
+			self->status = PGRES_FATAL_ERROR;
 
-				qlog("ERROR from backend in next_tuple: '%s'\n", msgbuffer);
+			if ( ! strncmp(msgbuffer, "FATAL", 5))
+				CC_set_no_trans(self->conn);
 
-				return FALSE;
+			qlog("ERROR from backend in next_tuple: '%s'\n", msgbuffer);
 
-			case 'N':			/* Notice */
-				SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
-				QR_set_message(self, msgbuffer);
-				self->status = PGRES_NONFATAL_ERROR;
-				qlog("NOTICE from backend in next_tuple: '%s'\n", msgbuffer);
-				continue;
-
-			default:			/* this should only happen if the backend
-								 * dumped core */
-				mylog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
-				qlog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
-				QR_set_message(self, "Unexpected result from backend. It probably crashed");
-				self->status = PGRES_FATAL_ERROR;
-				CC_set_no_trans(self->conn);
-				return FALSE;
+			return FALSE;
+
+		case 'N': /* Notice */
+			SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
+			QR_set_message(self, msgbuffer);
+			self->status = PGRES_NONFATAL_ERROR;
+			qlog("NOTICE from backend in next_tuple: '%s'\n", msgbuffer);
+			continue;
+
+		default: /* this should only happen if the backend dumped core */
+			mylog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
+			qlog("QR_next_tuple: Unexpected result from backend: id = '%c' (%d)\n", id, id);
+			QR_set_message(self, "Unexpected result from backend. It probably crashed");
+			self->status = PGRES_FATAL_ERROR;
+			CC_set_no_trans(self->conn);
+			return FALSE;
 		}
 	}
 	return TRUE;
@@ -575,18 +538,17 @@ QR_next_tuple(QResultClass *self)
 char
 QR_read_tuple(QResultClass *self, char binary)
 {
-	Int2		field_lf;
-	TupleField *this_tuplefield;
-	char		bmp,
-				bitmap[MAX_FIELDS];		/* Max. len of the bitmap */
-	Int2		bitmaplen;		/* len of the bitmap in bytes */
-	Int2		bitmap_pos;
-	Int2		bitcnt;
-	Int4		len;
-	char	   *buffer;
-	int			num_fields = self->num_fields;	/* speed up access */
-	SocketClass *sock = CC_get_socket(self->conn);
-	ColumnInfoClass *flds;
+Int2 field_lf;
+TupleField *this_tuplefield;
+char bmp, bitmap[MAX_FIELDS];        /* Max. len of the bitmap */
+Int2 bitmaplen;                       /* len of the bitmap in bytes */
+Int2 bitmap_pos;
+Int2 bitcnt;
+Int4 len;
+char *buffer;
+int num_fields = self->num_fields;	/* speed up access */
+SocketClass *sock = CC_get_socket(self->conn);
+ColumnInfoClass *flds;
 
 
 	/* set the current row to read the fields into */
@@ -597,36 +559,31 @@ QR_read_tuple(QResultClass *self, char binary)
 		bitmaplen++;
 
 	/*
-	 * At first the server sends a bitmap that indicates which database
-	 * fields are null
-	 */
+		At first the server sends a bitmap that indicates which
+		database fields are null
+	*/
 	SOCK_get_n_char(sock, bitmap, bitmaplen);
 
 	bitmap_pos = 0;
 	bitcnt = 0;
 	bmp = bitmap[bitmap_pos];
 
-	for (field_lf = 0; field_lf < num_fields; field_lf++)
-	{
+	for(field_lf = 0; field_lf < num_fields; field_lf++) {
 		/* Check if the current field is NULL */
-		if (!(bmp & 0200))
-		{
+		if(!(bmp & 0200)) {
 			/* YES, it is NULL ! */
 			this_tuplefield[field_lf].len = 0;
 			this_tuplefield[field_lf].value = 0;
-		}
-		else
-		{
-
+		} else {
 			/*
-			 * NO, the field is not null. so get at first the length of
-			 * the field (four bytes)
-			 */
+			NO, the field is not null. so get at first the
+			length of the field (four bytes)
+			*/
 			len = SOCK_get_int(sock, VARHDRSZ);
 			if (!binary)
 				len -= VARHDRSZ;
 
-			buffer = (char *) malloc(len + 1);
+			buffer = (char *)malloc(len+1);
 			SOCK_get_n_char(sock, buffer, len);
 			buffer[len] = '\0';
 
@@ -635,31 +592,27 @@ QR_read_tuple(QResultClass *self, char binary)
 			this_tuplefield[field_lf].len = len;
 			this_tuplefield[field_lf].value = buffer;
 
-			/*
-			 * This can be used to set the longest length of the column
-			 * for any row in the tuple cache.	It would not be accurate
-			 * for varchar and text fields to use this since a tuple cache
-			 * is only 100 rows. Bpchar can be handled since the strlen of
-			 * all rows is fixed, assuming there are not 100 nulls in a
-			 * row!
-			 */
+			/*	This can be used to set the longest length of the column for any
+				row in the tuple cache.  It would not be accurate for varchar and
+				text fields to use this since a tuple cache is only 100 rows.
+				Bpchar can be handled since the strlen of all rows is fixed,
+				assuming there are not 100 nulls in a row!
+			*/
 
 			flds = self->fields;
 			if (flds->display_size[field_lf] < len)
 				flds->display_size[field_lf] = len;
 		}
-
 		/*
-		 * Now adjust for the next bit to be scanned in the next loop.
-		 */
+		Now adjust for the next bit to be scanned in the
+		next loop.
+		*/
 		bitcnt++;
-		if (BYTELEN == bitcnt)
-		{
+		if (BYTELEN == bitcnt) {
 			bitmap_pos++;
 			bmp = bitmap[bitmap_pos];
 			bitcnt = 0;
-		}
-		else
+		} else
 			bmp <<= 1;
 	}
 	self->currTuple++;
diff --git a/src/interfaces/odbc/qresult.h b/src/interfaces/odbc/qresult.h
index 77a70e52bdcf8fe64a61bd8413ff1d3739b36175..93f11cee1f4ac5243e1b46748392b6657a9e264b 100644
--- a/src/interfaces/odbc/qresult.h
+++ b/src/interfaces/odbc/qresult.h
@@ -1,9 +1,9 @@
 
-/* File:			qresult.h
+/* File:            qresult.h
  *
- * Description:		See "qresult.c"
+ * Description:     See "qresult.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -17,75 +17,68 @@
 #include "psqlodbc.h"
 #include "tuple.h"
 
-enum QueryResultCode_
-{
-	PGRES_EMPTY_QUERY = 0,
-	PGRES_COMMAND_OK,			/* a query command that doesn't return */
-	/* anything was executed properly by the backend */
-	PGRES_TUPLES_OK,			/* a query command that returns tuples */
-	/* was executed properly by the backend, PGresult */
-	/* contains the resulttuples */
-	PGRES_COPY_OUT,
-	PGRES_COPY_IN,
-	PGRES_BAD_RESPONSE,			/* an unexpected response was recv'd from
-								 * the backend */
-	PGRES_NONFATAL_ERROR,
-	PGRES_FATAL_ERROR,
-	PGRES_FIELDS_OK,			/* field information from a query was
-								 * successful */
-	PGRES_END_TUPLES,
-	PGRES_INTERNAL_ERROR
+enum QueryResultCode_ {
+  PGRES_EMPTY_QUERY = 0,
+  PGRES_COMMAND_OK,  /* a query command that doesn't return */
+                    /* anything was executed properly by the backend */
+  PGRES_TUPLES_OK,  /* a query command that returns tuples */
+                   /* was executed properly by the backend, PGresult */
+                   /* contains the resulttuples */
+  PGRES_COPY_OUT,
+  PGRES_COPY_IN,
+  PGRES_BAD_RESPONSE, /* an unexpected response was recv'd from the backend */
+  PGRES_NONFATAL_ERROR,
+  PGRES_FATAL_ERROR,
+  PGRES_FIELDS_OK,	/* field information from a query was successful */
+  PGRES_END_TUPLES,
+  PGRES_INTERNAL_ERROR
 };
 typedef enum QueryResultCode_ QueryResultCode;
 
 
-struct QResultClass_
-{
-	ColumnInfoClass *fields;	/* the Column information */
-	TupleListClass *manual_tuples;		/* manual result tuple list */
-	ConnectionClass *conn;		/* the connection this result is using
-								 * (backend) */
+struct QResultClass_ {
+    ColumnInfoClass *fields;			/* the Column information */
+    TupleListClass *manual_tuples;		/* manual result tuple list */
+	ConnectionClass *conn;				/* the connection this result is using (backend) */
 
-	/* Stuff for declare/fetch tuples */
-	int			fetch_count;	/* logical rows read so far */
-	int			fcount;			/* actual rows read in the fetch */
-	int			currTuple;
-	int			base;
+	/*	Stuff for declare/fetch tuples */
+	int fetch_count;					/* logical rows read so far */
+	int fcount;							/* actual rows read in the fetch */
+	int currTuple;
+	int base;
 
-	int			num_fields;		/* number of fields in the result */
-	int			cache_size;
-	int			rowset_size;
+	int num_fields;						/* number of fields in the result */
+	int cache_size;
+	int rowset_size;
 
-	QueryResultCode status;
+    QueryResultCode status;
 
-	char	   *message;
-	char	   *cursor;			/* The name of the cursor for select
-								 * statements */
-	char	   *command;
-	char	   *notice;
+    char *message;
+	char *cursor;						/* The name of the cursor for select statements */
+	char *command;
+	char *notice;
 
-	TupleField *backend_tuples; /* data from the backend (the tuple cache) */
-	TupleField *tupleField;		/* current backend tuple being retrieved */
+	TupleField *backend_tuples;			/* data from the backend (the tuple cache) */
+	TupleField *tupleField;				/* current backend tuple being retrieved */
 
-	char		inTuples;		/* is a fetch of rows from the backend in
-								 * progress? */
+	char inTuples;						/* is a fetch of rows from the backend in progress? */
 };
 
 #define QR_get_fields(self)				(self->fields)
 
 
 /*	These functions are for retrieving data from the qresult */
-#define QR_get_value_manual(self, tupleno, fieldno) (TL_get_fieldval(self->manual_tuples, tupleno, fieldno))
-#define QR_get_value_backend(self, fieldno)			(self->tupleField[fieldno].value)
+#define QR_get_value_manual(self, tupleno, fieldno)	(TL_get_fieldval(self->manual_tuples, tupleno, fieldno))
+#define QR_get_value_backend(self, fieldno)			(self->tupleField[fieldno].value) 
 #define QR_get_value_backend_row(self, tupleno, fieldno) ((self->backend_tuples + (tupleno * self->num_fields))[fieldno].value)
 
 /*	These functions are used by both manual and backend results */
 #define QR_NumResultCols(self)				(CI_get_num_fields(self->fields))
 #define QR_get_fieldname(self, fieldno_)	(CI_get_fieldname(self->fields, fieldno_))
-#define QR_get_fieldsize(self, fieldno_)	(CI_get_fieldsize(self->fields, fieldno_))
-#define QR_get_display_size(self, fieldno_) (CI_get_display_size(self->fields, fieldno_))
-#define QR_get_atttypmod(self, fieldno_)	(CI_get_atttypmod(self->fields, fieldno_))
-#define QR_get_field_type(self, fieldno_)	(CI_get_oid(self->fields, fieldno_))
+#define QR_get_fieldsize(self, fieldno_)	(CI_get_fieldsize(self->fields, fieldno_))    
+#define QR_get_display_size(self, fieldno_)	(CI_get_display_size(self->fields, fieldno_))    
+#define QR_get_atttypmod(self, fieldno_)	(CI_get_atttypmod(self->fields, fieldno_))    
+#define QR_get_field_type(self, fieldno_)   (CI_get_oid(self->fields, fieldno_))
 
 /*	These functions are used only for manual result sets */
 #define QR_get_num_tuples(self)				(self->manual_tuples ? TL_get_num_tuples(self->manual_tuples) : self->fcount)
@@ -106,20 +99,20 @@ struct QResultClass_
 
 /*	Core Functions */
 QResultClass *QR_Constructor(void);
-void		QR_Destructor(QResultClass *self);
-char		QR_read_tuple(QResultClass *self, char binary);
-int			QR_next_tuple(QResultClass *self);
-int			QR_close(QResultClass *self);
-char		QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor);
-void		QR_free_memory(QResultClass *self);
-void		QR_set_command(QResultClass *self, char *msg);
-void		QR_set_notice(QResultClass *self, char *msg);
-
-void		QR_set_num_fields(QResultClass *self, int new_num_fields);	/* manual result only */
-
-void		QR_inc_base(QResultClass *self, int base_inc);
-void		QR_set_cache_size(QResultClass *self, int cache_size);
-void		QR_set_rowset_size(QResultClass *self, int rowset_size);
-void		QR_set_position(QResultClass *self, int pos);
-
+void QR_Destructor(QResultClass *self);
+char QR_read_tuple(QResultClass *self, char binary);
+int QR_next_tuple(QResultClass *self);
+int QR_close(QResultClass *self);
+char QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor);
+void QR_free_memory(QResultClass *self);
+void QR_set_command(QResultClass *self, char *msg);
+void QR_set_notice(QResultClass *self, char *msg);
+
+void QR_set_num_fields(QResultClass *self, int new_num_fields); /* manual result only */
+
+void QR_inc_base(QResultClass *self, int base_inc);
+void QR_set_cache_size(QResultClass *self, int cache_size);
+void QR_set_rowset_size(QResultClass *self, int rowset_size);
+void QR_set_position(QResultClass *self, int pos);
+ 
 #endif
diff --git a/src/interfaces/odbc/resource.h b/src/interfaces/odbc/resource.h
index 6538556a511047f1ea72ea1e17765183fbefd249..c823241d7e41c87d76f6d90aead7d95ab049e525 100644
--- a/src/interfaces/odbc/resource.h
+++ b/src/interfaces/odbc/resource.h
@@ -1,60 +1,62 @@
 /* {{NO_DEPENDENCIES}} */
-/*	Microsoft Developer Studio generated include file. */
-/*	Used by psqlodbc.rc */
-/*	*/
-#define IDS_BADDSN						1
-#define IDS_MSGTITLE					2
-#define DLG_OPTIONS_DRV					102
-#define DLG_OPTIONS_DS					103
-#define IDC_DSNAME						400
-#define IDC_DSNAMETEXT					401
-#define IDC_DESC						404
-#define IDC_SERVER						407
-#define IDC_DATABASE					408
-#define DLG_CONFIG						1001
-#define IDC_PORT						1002
-#define IDC_USER						1006
-#define IDC_PASSWORD					1009
-#define DS_READONLY						1011
-#define DS_SHOWOIDCOLUMN				1012
-#define DS_FAKEOIDINDEX					1013
-#define DRV_COMMLOG						1014
-#define IDC_DATASOURCE					1018
-#define DRV_OPTIMIZER					1019
-#define DS_CONNSETTINGS					1020
-#define IDC_DRIVER						1021
-#define DRV_CONNSETTINGS				1031
-#define DRV_UNIQUEINDEX					1032
-#define DRV_UNKNOWN_MAX					1035
-#define DRV_UNKNOWN_DONTKNOW			1036
-#define DRV_READONLY					1037
-#define IDC_DESCTEXT					1039
-#define DRV_MSG_LABEL					1040
-#define DRV_UNKNOWN_LONGEST				1041
-#define DRV_TEXT_LONGVARCHAR			1043
-#define DRV_UNKNOWNS_LONGVARCHAR		1044
-#define DRV_CACHE_SIZE					1045
-#define DRV_VARCHAR_SIZE				1046
-#define DRV_LONGVARCHAR_SIZE			1047
-#define IDDEFAULTS						1048
-#define DRV_USEDECLAREFETCH				1049
-#define DRV_BOOLS_CHAR					1050
-#define DS_SHOWSYSTEMTABLES				1051
-#define DRV_EXTRASYSTABLEPREFIXES		1051
-#define DS_ROWVERSIONING				1052
-#define DRV_PARSE						1052
-#define DRV_CANCELASFREESTMT			1053
-#define IDC_OPTIONS						1054
-#define DRV_KSQO						1055
-#define DS_PG64							1057
+/* Microsoft Developer Studio generated include file. */
+/* Used by psqlodbc.rc */
+
+#define IDS_BADDSN                      1
+#define IDS_MSGTITLE                    2
+#define DLG_OPTIONS_DRV                 102
+#define DLG_OPTIONS_DS                  103
+#define IDC_DSNAME                      400
+#define IDC_DSNAMETEXT                  401
+#define IDC_DESC                        404
+#define IDC_SERVER                      407
+#define IDC_DATABASE                    408
+#define DLG_CONFIG                      1001
+#define IDC_PORT                        1002
+#define IDC_USER                        1006
+#define IDC_PASSWORD                    1009
+#define DS_READONLY                     1011
+#define DS_SHOWOIDCOLUMN                1012
+#define DS_FAKEOIDINDEX                 1013
+#define DRV_COMMLOG                     1014
+#define DS_PG62                         1016
+#define IDC_DATASOURCE                  1018
+#define DRV_OPTIMIZER                   1019
+#define DS_CONNSETTINGS                 1020
+#define IDC_DRIVER                      1021
+#define DRV_CONNSETTINGS                1031
+#define DRV_UNIQUEINDEX                 1032
+#define DRV_UNKNOWN_MAX                 1035
+#define DRV_UNKNOWN_DONTKNOW            1036
+#define DRV_READONLY                    1037
+#define IDC_DESCTEXT                    1039
+#define DRV_MSG_LABEL                   1040
+#define DRV_UNKNOWN_LONGEST             1041
+#define DRV_TEXT_LONGVARCHAR            1043
+#define DRV_UNKNOWNS_LONGVARCHAR        1044
+#define DRV_CACHE_SIZE                  1045
+#define DRV_VARCHAR_SIZE                1046
+#define DRV_LONGVARCHAR_SIZE            1047
+#define IDDEFAULTS                      1048
+#define DRV_USEDECLAREFETCH             1049
+#define DRV_BOOLS_CHAR                  1050
+#define DS_SHOWSYSTEMTABLES             1051
+#define DRV_EXTRASYSTABLEPREFIXES       1051
+#define DS_ROWVERSIONING                1052
+#define DRV_PARSE                       1052
+#define DRV_CANCELASFREESTMT            1053
+#define IDC_OPTIONS                     1054
+#define DRV_KSQO                        1055
+#define DS_PG64                         1057
+#define DS_PG63                         1058
+
+/* Next default values for new objects */
 
-/*	Next default values for new objects */
-/*	 */
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE		104
-#define _APS_NEXT_COMMAND_VALUE			40001
-#define _APS_NEXT_CONTROL_VALUE			1060
-#define _APS_NEXT_SYMED_VALUE			101
+#define _APS_NEXT_RESOURCE_VALUE        104
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1060
+#define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
diff --git a/src/interfaces/odbc/results.c b/src/interfaces/odbc/results.c
index 7f873804f4c3503c310b02e14a0c9980f9930e27..8ef3936a8a62177407c541bf7c762ff134afac18 100644
--- a/src/interfaces/odbc/results.c
+++ b/src/interfaces/odbc/results.c
@@ -1,16 +1,17 @@
-/* Module:			results.c
+
+/* Module:          results.c
  *
- * Description:		This module contains functions related to
- *					retrieving result information through the ODBC API.
+ * Description:     This module contains functions related to 
+ *                  retrieving result information through the ODBC API.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	SQLRowCount, SQLNumResultCols, SQLDescribeCol, SQLColAttributes,
- *					SQLGetData, SQLFetch, SQLExtendedFetch,
- *					SQLMoreResults(NI), SQLSetPos, SQLSetScrollOptions(NI),
- *					SQLSetCursorName, SQLGetCursorName
+ * API functions:   SQLRowCount, SQLNumResultCols, SQLDescribeCol, SQLColAttributes,
+ *                  SQLGetData, SQLFetch, SQLExtendedFetch, 
+ *                  SQLMoreResults(NI), SQLSetPos, SQLSetScrollOptions(NI),
+ *                  SQLSetCursorName, SQLGetCursorName
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -27,7 +28,7 @@
 #include "bind.h"
 #include "qresult.h"
 #include "convert.h"
-#include "pgtypes.h"
+#include "pgtypes.h" 
 
 #include <stdio.h>
 
@@ -43,119 +44,103 @@ extern GLOBAL_VALUES globals;
 
 
 
-RETCODE SQL_API
-SQLRowCount(
-			HSTMT hstmt,
-			SDWORD FAR *pcrow)
+RETCODE SQL_API SQLRowCount(
+        HSTMT      hstmt,
+        SDWORD FAR *pcrow)
 {
-	static char *func = "SQLRowCount";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *res;
-	char	   *msg,
-			   *ptr;
-
-	if (!stmt)
-	{
+static char *func="SQLRowCount";
+StatementClass *stmt = (StatementClass *) hstmt;
+QResultClass *res;
+char *msg, *ptr;
+
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
-	if (stmt->manual_result)
-	{
+	if (stmt->manual_result) {
 		if (pcrow)
 			*pcrow = -1;
 		return SQL_SUCCESS;
 	}
 
-	if (stmt->statement_type == STMT_TYPE_SELECT)
-	{
-		if (stmt->status == STMT_FINISHED)
-		{
+	if(stmt->statement_type == STMT_TYPE_SELECT) {
+		if (stmt->status == STMT_FINISHED) {
 			res = SC_get_Result(stmt);
 
-			if (res && pcrow)
-			{
+			if(res && pcrow) {
 				*pcrow = globals.use_declarefetch ? -1 : QR_get_num_tuples(res);
 				return SQL_SUCCESS;
 			}
 		}
-	}
-	else
-	{
+	} else {
+
 		res = SC_get_Result(stmt);
-		if (res && pcrow)
-		{
+		if (res && pcrow) {
 			msg = QR_get_command(res);
 			mylog("*** msg = '%s'\n", msg);
-			trim(msg);			/* get rid of trailing spaces */
+			trim(msg);	/*	get rid of trailing spaces */
 			ptr = strrchr(msg, ' ');
-			if (ptr)
-			{
-				*pcrow = atoi(ptr + 1);
+			if (ptr) {
+				*pcrow = atoi(ptr+1);
 				mylog("**** SQLRowCount(): THE ROWS: *pcrow = %d\n", *pcrow);
 			}
-			else
-			{
+			else {
 				*pcrow = -1;
 
 				mylog("**** SQLRowCount(): NO ROWS: *pcrow = %d\n", *pcrow);
 			}
 
-			return SQL_SUCCESS;
+		return SQL_SUCCESS;
 		}
 	}
 
 	SC_log_error(func, "Bad return value", stmt);
-	return SQL_ERROR;
+	return SQL_ERROR;     
 }
 
 
-/*		This returns the number of columns associated with the database */
-/*		attached to "hstmt". */
+/*      This returns the number of columns associated with the database */
+/*      attached to "hstmt". */
 
 
-RETCODE SQL_API
-SQLNumResultCols(
-				 HSTMT hstmt,
-				 SWORD FAR *pccol)
-{
-	static char *func = "SQLNumResultCols";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *result;
-	char		parse_ok;
+RETCODE SQL_API SQLNumResultCols(
+        HSTMT     hstmt,
+        SWORD FAR *pccol)
+{       
+static char *func="SQLNumResultCols";
+StatementClass *stmt = (StatementClass *) hstmt;
+QResultClass *result;
+char parse_ok;
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	SC_clear_error(stmt);
+	SC_clear_error(stmt);    
 
 	parse_ok = FALSE;
-	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
-	{
-		if (stmt->parse_status == STMT_PARSE_NONE)
-		{
+	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) {
+
+		if (stmt->parse_status == STMT_PARSE_NONE) {
 			mylog("SQLNumResultCols: calling parse_statement on stmt=%u\n", stmt);
 			parse_statement(stmt);
 		}
 
-		if (stmt->parse_status != STMT_PARSE_FATAL)
-		{
+		if (stmt->parse_status != STMT_PARSE_FATAL) {
 			parse_ok = TRUE;
 			*pccol = stmt->nfld;
 			mylog("PARSE: SQLNumResultCols: *pccol = %d\n", *pccol);
 		}
 	}
 
-	if (!parse_ok)
-	{
-		SC_pre_execute(stmt);
+	if ( ! parse_ok) {
+
+		SC_pre_execute(stmt);       
 		result = SC_get_Result(stmt);
 
 		mylog("SQLNumResultCols: result = %u, status = %d, numcols = %d\n", result, stmt->status, result != NULL ? QR_NumResultCols(result) : -1);
-		if ((!result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)))
-		{
+		if (( ! result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)) ) {
 			/* no query has been executed on this statement */
 			stmt->errornumber = STMT_SEQUENCE_ERROR;
 			stmt->errormsg = "No query has been executed with that handle";
@@ -170,64 +155,59 @@ SQLNumResultCols(
 }
 
 
-/*		-		-		-		-		-		-		-		-		- */
+/*      -       -       -       -       -       -       -       -       - */
 
 
 
-/*		Return information about the database column the user wants */
-/*		information about. */
-RETCODE SQL_API
-SQLDescribeCol(
-			   HSTMT hstmt,
-			   UWORD icol,
-			   UCHAR FAR *szColName,
-			   SWORD cbColNameMax,
-			   SWORD FAR *pcbColName,
-			   SWORD FAR *pfSqlType,
-			   UDWORD FAR *pcbColDef,
-			   SWORD FAR *pibScale,
-			   SWORD FAR *pfNullable)
+/*      Return information about the database column the user wants */
+/*      information about. */
+RETCODE SQL_API SQLDescribeCol(
+        HSTMT      hstmt,
+        UWORD      icol,
+        UCHAR  FAR *szColName,
+        SWORD      cbColNameMax,
+        SWORD  FAR *pcbColName,
+        SWORD  FAR *pfSqlType,
+        UDWORD FAR *pcbColDef,
+        SWORD  FAR *pibScale,
+        SWORD  FAR *pfNullable)
 {
-	static char *func = "SQLDescribeCol";
-
-	/* gets all the information about a specific column */
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *res;
-	char	   *col_name = NULL;
-	Int4		fieldtype = 0;
-	int			precision = 0;
-	ConnInfo   *ci;
-	char		parse_ok;
-	char		buf[255];
-	int			len = 0;
-	RETCODE		result;
+static char *func="SQLDescribeCol";
+    /* gets all the information about a specific column */
+StatementClass *stmt = (StatementClass *) hstmt;
+QResultClass *res;
+char *col_name = NULL;
+Int4 fieldtype = 0;
+int precision = 0;
+ConnInfo *ci;
+char parse_ok;
+char buf[255];
+int len = 0;
+RETCODE result;
 
 
 	mylog("%s: entering...\n", func);
 
-	if (!stmt)
-	{
+    if ( ! stmt) {
 		SC_log_error(func, "", NULL);
-		return SQL_INVALID_HANDLE;
+        return SQL_INVALID_HANDLE;
 	}
 
 	ci = &(stmt->hdbc->connInfo);
 
-	SC_clear_error(stmt);
+    SC_clear_error(stmt);
 
-	/*
-	 * Dont check for bookmark column.	This is the responsibility of the
-	 * driver manager.
-	 */
+	/*	Dont check for bookmark column.  This is the responsibility
+		of the driver manager.  
+	*/
 
-	icol--;						/* use zero based column numbers */
+	icol--;		/* use zero based column numbers */
 
 
 	parse_ok = FALSE;
-	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
-	{
-		if (stmt->parse_status == STMT_PARSE_NONE)
-		{
+	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) {
+
+		if (stmt->parse_status == STMT_PARSE_NONE) {
 			mylog("SQLDescribeCol: calling parse_statement on stmt=%u\n", stmt);
 			parse_statement(stmt);
 		}
@@ -235,10 +215,9 @@ SQLDescribeCol(
 
 		mylog("PARSE: DescribeCol: icol=%d, stmt=%u, stmt->nfld=%d, stmt->fi=%u\n", icol, stmt, stmt->nfld, stmt->fi);
 
-		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol])
-		{
-			if (icol >= stmt->nfld)
-			{
+		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol]) {
+
+			if (icol >= stmt->nfld) {
 				stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 				stmt->errormsg = "Invalid column number in DescribeCol.";
 				SC_log_error(func, "", stmt);
@@ -257,20 +236,16 @@ SQLDescribeCol(
 	}
 
 
-	/*
-	 * If couldn't parse it OR the field being described was not parsed
-	 * (i.e., because it was a function or expression, etc, then do it the
-	 * old fashioned way.
-	 */
-	if (!parse_ok)
-	{
+	/*	If couldn't parse it OR the field being described was not parsed (i.e., because
+		it was a function or expression, etc, then do it the old fashioned way.
+	*/
+	if ( ! parse_ok) {
 		SC_pre_execute(stmt);
-
+	
 		res = SC_get_Result(stmt);
 
 		mylog("**** SQLDescribeCol: res = %u, stmt->status = %d, !finished=%d, !premature=%d\n", res, stmt->status, stmt->status != STMT_FINISHED, stmt->status != STMT_PREMATURE);
-		if ((NULL == res) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)))
-		{
+		if ( (NULL == res) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE))) {
 			/* no query has been executed on this statement */
 			stmt->errornumber = STMT_SEQUENCE_ERROR;
 			stmt->errormsg = "No query has been assigned to this statement.";
@@ -278,8 +253,7 @@ SQLDescribeCol(
 			return SQL_ERROR;
 		}
 
-		if (icol >= QR_NumResultCols(res))
-		{
+		if (icol >= QR_NumResultCols(res)) {
 			stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 			stmt->errormsg = "Invalid column number in DescribeCol.";
 			sprintf(buf, "Col#=%d, #Cols=%d", icol, QR_NumResultCols(res));
@@ -288,10 +262,9 @@ SQLDescribeCol(
 		}
 
 		col_name = QR_get_fieldname(res, icol);
-		fieldtype = QR_get_field_type(res, icol);
+        fieldtype = QR_get_field_type(res, icol);
 
-		precision = pgtype_precision(stmt, fieldtype, icol, globals.unknown_sizes);		/* atoi(ci->unknown_sizes
-																						 * ) */
+		precision = pgtype_precision(stmt, fieldtype, icol, globals.unknown_sizes);  /* atoi(ci->unknown_sizes) */
 	}
 
 	mylog("describeCol: col %d fieldname = '%s'\n", icol, col_name);
@@ -302,42 +275,39 @@ SQLDescribeCol(
 	result = SQL_SUCCESS;
 
 	/************************/
-	/* COLUMN NAME	   */
+	/*		COLUMN NAME     */
 	/************************/
 	len = strlen(col_name);
 
 	if (pcbColName)
 		*pcbColName = len;
 
-	if (szColName)
-	{
+	if (szColName) {
 		strncpy_null(szColName, col_name, cbColNameMax);
 
-		if (len >= cbColNameMax)
-		{
+		if (len >= cbColNameMax)  {
 			result = SQL_SUCCESS_WITH_INFO;
 			stmt->errornumber = STMT_TRUNCATED;
 			stmt->errormsg = "The buffer was too small for the result.";
 		}
-	}
+    }
 
 
 	/************************/
-	/* SQL TYPE		   */
+	/*		SQL TYPE        */
 	/************************/
-	if (pfSqlType)
-	{
-		*pfSqlType = pgtype_to_sqltype(stmt, fieldtype);
+    if (pfSqlType) {
+        *pfSqlType = pgtype_to_sqltype(stmt, fieldtype);
 
 		mylog("describeCol: col %d *pfSqlType = %d\n", icol, *pfSqlType);
 	}
 
 	/************************/
-	/* PRECISION	   */
+	/*		PRECISION       */
 	/************************/
-	if (pcbColDef)
-	{
-		if (precision < 0)
+    if (pcbColDef) {
+
+		if ( precision < 0)
 			precision = 0;		/* "I dont know" */
 
 		*pcbColDef = precision;
@@ -346,108 +316,94 @@ SQLDescribeCol(
 	}
 
 	/************************/
-	/* SCALE		   */
+	/*		SCALE           */
 	/************************/
-	if (pibScale)
-	{
-		Int2		scale;
-
-		scale = pgtype_scale(stmt, fieldtype, icol);
-		if (scale == -1)
-			scale = 0;
-
-		*pibScale = scale;
+    if (pibScale) {
+        Int2 scale;
+        scale = pgtype_scale(stmt, fieldtype, icol);
+        if(scale == -1) { scale = 0; }
+        
+        *pibScale = scale;
 		mylog("describeCol: col %d  *pibScale = %d\n", icol, *pibScale);
-	}
+    }
 
 	/************************/
-	/* NULLABILITY	   */
+	/*		NULLABILITY     */
 	/************************/
-	if (pfNullable)
-	{
+    if (pfNullable) {
 		*pfNullable = (parse_ok) ? stmt->fi[icol]->nullable : pgtype_nullable(stmt, fieldtype);
 
 		mylog("describeCol: col %d  *pfNullable = %d\n", icol, *pfNullable);
-	}
+    }
 
-	return result;
+    return result;
 }
 
-/*		Returns result column descriptor information for a result set. */
-
-RETCODE SQL_API
-SQLColAttributes(
-				 HSTMT hstmt,
-				 UWORD icol,
-				 UWORD fDescType,
-				 PTR rgbDesc,
-				 SWORD cbDescMax,
-				 SWORD FAR *pcbDesc,
-				 SDWORD FAR *pfDesc)
+/*      Returns result column descriptor information for a result set. */
+
+RETCODE SQL_API SQLColAttributes(
+        HSTMT      hstmt,
+        UWORD      icol,
+        UWORD      fDescType,
+        PTR        rgbDesc,
+        SWORD      cbDescMax,
+        SWORD  FAR *pcbDesc,
+        SDWORD FAR *pfDesc)
 {
-	static char *func = "SQLColAttributes";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	Int4		field_type = 0;
-	ConnInfo   *ci;
-	int			unknown_sizes;
-	int			cols = 0;
-	char		parse_ok;
-	RETCODE		result;
-	char	   *p = NULL;
-	int			len = 0,
-				value = 0;
+static char *func = "SQLColAttributes";
+StatementClass *stmt = (StatementClass *) hstmt;
+Int4 field_type = 0;
+ConnInfo *ci;
+int unknown_sizes;
+int cols = 0;
+char parse_ok;
+RETCODE result;
+char *p = NULL;
+int len = 0, value = 0;
 
 	mylog("%s: entering...\n", func);
 
-	if (!stmt)
-	{
+	if( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	ci = &(stmt->hdbc->connInfo);
 
-	/*
-	 * Dont check for bookmark column.	This is the responsibility of the
-	 * driver manager.	For certain types of arguments, the column number
-	 * is ignored anyway, so it may be 0.
-	 */
+	/*	Dont check for bookmark column.  This is the responsibility
+		of the driver manager.  For certain types of arguments, the column
+		number is ignored anyway, so it may be 0.
+	*/
 
 	icol--;
 
-	unknown_sizes = globals.unknown_sizes;		/* atoi(ci->unknown_sizes);
-												 * */
-	if (unknown_sizes == UNKNOWNS_AS_DONTKNOW)	/* not appropriate for
-												 * SQLColAttributes() */
+	unknown_sizes = globals.unknown_sizes;          /* atoi(ci->unknown_sizes); */
+	if (unknown_sizes == UNKNOWNS_AS_DONTKNOW)		/* not appropriate for SQLColAttributes() */
 		unknown_sizes = UNKNOWNS_AS_MAX;
 
 	parse_ok = FALSE;
-	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT)
-	{
-		if (stmt->parse_status == STMT_PARSE_NONE)
-		{
+	if (globals.parse && stmt->statement_type == STMT_TYPE_SELECT) {
+
+		if (stmt->parse_status == STMT_PARSE_NONE) {
 			mylog("SQLColAttributes: calling parse_statement\n");
 			parse_statement(stmt);
 		}
 
 		cols = stmt->nfld;
 
-		/*
-		 * Column Count is a special case.	The Column number is ignored
-		 * in this case.
-		 */
-		if (fDescType == SQL_COLUMN_COUNT)
-		{
+		/*	Column Count is a special case.  The Column number is ignored
+			in this case.
+		*/
+		if (fDescType == SQL_COLUMN_COUNT) {
 			if (pfDesc)
 				*pfDesc = cols;
 
 			return SQL_SUCCESS;
 		}
 
-		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol])
-		{
-			if (icol >= cols)
-			{
+		if (stmt->parse_status != STMT_PARSE_FATAL && stmt->fi && stmt->fi[icol]) {
+
+			if (icol >= cols) {
 				stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 				stmt->errormsg = "Invalid column number in DescribeCol.";
 				SC_log_error(func, "", stmt);
@@ -460,14 +416,12 @@ SQLColAttributes(
 		}
 	}
 
-	if (!parse_ok)
-	{
-		SC_pre_execute(stmt);
+	if ( ! parse_ok) {
+		SC_pre_execute(stmt);       
 
 		mylog("**** SQLColAtt: result = %u, status = %d, numcols = %d\n", stmt->result, stmt->status, stmt->result != NULL ? QR_NumResultCols(stmt->result) : -1);
 
-		if ((NULL == stmt->result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)))
-		{
+		if ( (NULL == stmt->result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE)) ) {
 			stmt->errormsg = "Can't get column attributes: no result found.";
 			stmt->errornumber = STMT_SEQUENCE_ERROR;
 			SC_log_error(func, "", stmt);
@@ -476,20 +430,17 @@ SQLColAttributes(
 
 		cols = QR_NumResultCols(stmt->result);
 
-		/*
-		 * Column Count is a special case.	The Column number is ignored
-		 * in this case.
-		 */
-		if (fDescType == SQL_COLUMN_COUNT)
-		{
+		/*	Column Count is a special case.  The Column number is ignored
+			in this case.
+		*/
+		if (fDescType == SQL_COLUMN_COUNT) {
 			if (pfDesc)
 				*pfDesc = cols;
 
 			return SQL_SUCCESS;
 		}
 
-		if (icol >= cols)
-		{
+		if (icol >= cols) {
 			stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 			stmt->errormsg = "Invalid column number in DescribeCol.";
 			SC_log_error(func, "", stmt);
@@ -501,231 +452,217 @@ SQLColAttributes(
 
 	mylog("colAttr: col %d field_type = %d\n", icol, field_type);
 
-	switch (fDescType)
-	{
-		case SQL_COLUMN_AUTO_INCREMENT:
-			value = pgtype_auto_increment(stmt, field_type);
-			if (value == -1)	/* non-numeric becomes FALSE (ODBC Doc) */
-				value = FALSE;
+	switch(fDescType) {
+	case SQL_COLUMN_AUTO_INCREMENT:
+		value  = pgtype_auto_increment(stmt, field_type);
+		if (value == -1)  /*  non-numeric becomes FALSE (ODBC Doc) */
+			value = FALSE;
+				
+		break;
 
-			break;
+	case SQL_COLUMN_CASE_SENSITIVE:
+		value = pgtype_case_sensitive(stmt, field_type);
+		break;
 
-		case SQL_COLUMN_CASE_SENSITIVE:
-			value = pgtype_case_sensitive(stmt, field_type);
-			break;
+	/* 	This special case is handled above.
 
-			/*
-			 * This special case is handled above.
-			 *
-			 * case SQL_COLUMN_COUNT:
-			 */
+	case SQL_COLUMN_COUNT: 
+	*/
 
-		case SQL_COLUMN_DISPLAY_SIZE:
-			value = (parse_ok) ? stmt->fi[icol]->display_size : pgtype_display_size(stmt, field_type, icol, unknown_sizes);
+    case SQL_COLUMN_DISPLAY_SIZE:
+		value = (parse_ok) ? stmt->fi[icol]->display_size : pgtype_display_size(stmt, field_type, icol, unknown_sizes);
 
-			mylog("SQLColAttributes: col %d, display_size= %d\n", icol, value);
+		mylog("SQLColAttributes: col %d, display_size= %d\n", icol, value);
 
-			break;
+        break;
+
+	case SQL_COLUMN_LABEL:
+		if (parse_ok && stmt->fi[icol]->alias[0] != '\0') {
+			p = stmt->fi[icol]->alias;
 
-		case SQL_COLUMN_LABEL:
-			if (parse_ok && stmt->fi[icol]->alias[0] != '\0')
-			{
-				p = stmt->fi[icol]->alias;
+			mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
+			break;
 
-				mylog("SQLColAttr: COLUMN_LABEL = '%s'\n", p);
-				break;
-			}					/* otherwise same as column name -- FALL
-								 * THROUGH!!! */
+		}	/* otherwise same as column name -- FALL THROUGH!!! */
 
-		case SQL_COLUMN_NAME:
+	case SQL_COLUMN_NAME:
 
-			p = (parse_ok) ? stmt->fi[icol]->name : QR_get_fieldname(stmt->result, icol);
+		p = (parse_ok) ? stmt->fi[icol]->name : QR_get_fieldname(stmt->result, icol);
 
-			mylog("SQLColAttr: COLUMN_NAME = '%s'\n", p);
-			break;
+		mylog("SQLColAttr: COLUMN_NAME = '%s'\n", p);
+		break;
 
-		case SQL_COLUMN_LENGTH:
-			value = (parse_ok) ? stmt->fi[icol]->length : pgtype_length(stmt, field_type, icol, unknown_sizes);
+	case SQL_COLUMN_LENGTH:
+		value = (parse_ok) ? stmt->fi[icol]->length :  pgtype_length(stmt, field_type, icol, unknown_sizes); 
 
-			mylog("SQLColAttributes: col %d, length = %d\n", icol, value);
-			break;
+		mylog("SQLColAttributes: col %d, length = %d\n", icol, value);
+        break;
 
-		case SQL_COLUMN_MONEY:
-			value = pgtype_money(stmt, field_type);
-			break;
+	case SQL_COLUMN_MONEY:
+		value = pgtype_money(stmt, field_type);
+		break;
 
-		case SQL_COLUMN_NULLABLE:
-			value = (parse_ok) ? stmt->fi[icol]->nullable : pgtype_nullable(stmt, field_type);
-			break;
+	case SQL_COLUMN_NULLABLE:
+		value = (parse_ok) ? stmt->fi[icol]->nullable : pgtype_nullable(stmt, field_type);
+		break;
 
-		case SQL_COLUMN_OWNER_NAME:
-			p = "";
-			break;
+	case SQL_COLUMN_OWNER_NAME:
+		p = "";
+		break;
 
-		case SQL_COLUMN_PRECISION:
-			value = (parse_ok) ? stmt->fi[icol]->precision : pgtype_precision(stmt, field_type, icol, unknown_sizes);
+	case SQL_COLUMN_PRECISION:
+		value = (parse_ok) ? stmt->fi[icol]->precision : pgtype_precision(stmt, field_type, icol, unknown_sizes);
 
-			mylog("SQLColAttributes: col %d, precision = %d\n", icol, value);
-			break;
+		mylog("SQLColAttributes: col %d, precision = %d\n", icol, value);
+        break;
 
-		case SQL_COLUMN_QUALIFIER_NAME:
-			p = "";
-			break;
+	case SQL_COLUMN_QUALIFIER_NAME:
+		p = "";
+		break;
 
-		case SQL_COLUMN_SCALE:
-			value = pgtype_scale(stmt, field_type, icol);
-			break;
+	case SQL_COLUMN_SCALE:
+		value = pgtype_scale(stmt, field_type, icol);
+		break;
 
-		case SQL_COLUMN_SEARCHABLE:
-			value = pgtype_searchable(stmt, field_type);
-			break;
+	case SQL_COLUMN_SEARCHABLE:
+		value = pgtype_searchable(stmt, field_type);
+		break;
 
-		case SQL_COLUMN_TABLE_NAME:
+    case SQL_COLUMN_TABLE_NAME:
 
-			p = (parse_ok && stmt->fi[icol]->ti) ? stmt->fi[icol]->ti->name : "";
+		p = (parse_ok && stmt->fi[icol]->ti) ? stmt->fi[icol]->ti->name : "";
 
-			mylog("SQLColAttr: TABLE_NAME = '%s'\n", p);
-			break;
+		mylog("SQLColAttr: TABLE_NAME = '%s'\n", p);
+        break;
 
-		case SQL_COLUMN_TYPE:
-			value = pgtype_to_sqltype(stmt, field_type);
-			break;
+	case SQL_COLUMN_TYPE:
+		value = pgtype_to_sqltype(stmt, field_type);
+		break;
 
-		case SQL_COLUMN_TYPE_NAME:
-			p = pgtype_to_name(stmt, field_type);
-			break;
+	case SQL_COLUMN_TYPE_NAME:
+		p = pgtype_to_name(stmt, field_type);
+		break;
 
-		case SQL_COLUMN_UNSIGNED:
-			value = pgtype_unsigned(stmt, field_type);
-			if (value == -1)	/* non-numeric becomes TRUE (ODBC Doc) */
-				value = TRUE;
+	case SQL_COLUMN_UNSIGNED:
+		value = pgtype_unsigned(stmt, field_type);
+		if(value == -1)	/* non-numeric becomes TRUE (ODBC Doc) */
+			value = TRUE;
 
-			break;
+		break;
 
-		case SQL_COLUMN_UPDATABLE:
+	case SQL_COLUMN_UPDATABLE:
+		/*	Neither Access or Borland care about this.
 
-			/*
-			 * Neither Access or Borland care about this.
-			 *
-			 * if (field_type == PG_TYPE_OID) pfDesc = SQL_ATTR_READONLY;
-			 * else
-			 */
+		if (field_type == PG_TYPE_OID)
+			*pfDesc = SQL_ATTR_READONLY;
+		else
+		*/
 
-			value = SQL_ATTR_WRITE;
+		value = SQL_ATTR_WRITE;
 
-			mylog("SQLColAttr: UPDATEABLE = %d\n", value);
-			break;
-	}
+		mylog("SQLColAttr: UPDATEABLE = %d\n", value);
+		break;
+    }
 
 	result = SQL_SUCCESS;
 
-	if (p)
-	{							/* char/binary data */
+	if (p) {  /* char/binary data */
 		len = strlen(p);
 
-		if (rgbDesc)
-		{
-			strncpy_null((char *) rgbDesc, p, (size_t) cbDescMax);
+		if (rgbDesc) {
+			strncpy_null((char *)rgbDesc, p, (size_t)cbDescMax);
 
-			if (len >= cbDescMax)
-			{
+			if (len >= cbDescMax)  {
 				result = SQL_SUCCESS_WITH_INFO;
 				stmt->errornumber = STMT_TRUNCATED;
 				stmt->errormsg = "The buffer was too small for the result.";
 			}
 		}
 
-		if (pcbDesc)
+		if (pcbDesc) 
 			*pcbDesc = len;
 	}
-	else
-	{							/* numeric data */
+	else {	/* numeric data */
 
 		if (pfDesc)
 			*pfDesc = value;
+
 	}
 
 
-	return result;
+    return result;
 }
 
-/*		Returns result data for a single column in the current row. */
+/*      Returns result data for a single column in the current row. */
 
-RETCODE SQL_API
-SQLGetData(
-		   HSTMT hstmt,
-		   UWORD icol,
-		   SWORD fCType,
-		   PTR rgbValue,
-		   SDWORD cbValueMax,
-		   SDWORD FAR *pcbValue)
+RETCODE SQL_API SQLGetData(
+        HSTMT      hstmt,
+        UWORD      icol,
+        SWORD      fCType,
+        PTR        rgbValue,
+        SDWORD     cbValueMax,
+        SDWORD FAR *pcbValue)
 {
-	static char *func = "SQLGetData";
-	QResultClass *res;
-	StatementClass *stmt = (StatementClass *) hstmt;
-	int			num_cols,
-				num_rows;
-	Int4		field_type;
-	void	   *value = NULL;
-	int			result;
-	char		get_bookmark = FALSE;
-
-	mylog("SQLGetData: enter, stmt=%u\n", stmt);
-
-	if (!stmt)
-	{
+static char *func="SQLGetData";
+QResultClass *res;
+StatementClass *stmt = (StatementClass *) hstmt;
+int num_cols, num_rows;
+Int4 field_type;
+void *value = NULL;
+int result;
+char get_bookmark = FALSE;
+
+mylog("SQLGetData: enter, stmt=%u\n", stmt);
+
+    if( ! stmt) {
 		SC_log_error(func, "", NULL);
-		return SQL_INVALID_HANDLE;
-	}
+        return SQL_INVALID_HANDLE;
+    }
 	res = stmt->result;
 
-	if (STMT_EXECUTING == stmt->status)
-	{
-		stmt->errormsg = "Can't get data while statement is still executing.";
-		stmt->errornumber = STMT_SEQUENCE_ERROR;
+    if (STMT_EXECUTING == stmt->status) {
+        stmt->errormsg = "Can't get data while statement is still executing.";
+        stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
 
-	if (stmt->status != STMT_FINISHED)
-	{
-		stmt->errornumber = STMT_STATUS_ERROR;
-		stmt->errormsg = "GetData can only be called after the successful execution on a SQL statement";
+    if (stmt->status != STMT_FINISHED) {
+        stmt->errornumber = STMT_STATUS_ERROR;
+        stmt->errormsg = "GetData can only be called after the successful execution on a SQL statement";
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+        return SQL_ERROR;
+    }
+
+    if (icol == 0) {
 
-	if (icol == 0)
-	{
-		if (stmt->options.use_bookmarks == SQL_UB_OFF)
-		{
+		if (stmt->options.use_bookmarks == SQL_UB_OFF) {
 			stmt->errornumber = STMT_COLNUM_ERROR;
 			stmt->errormsg = "Attempt to retrieve bookmark with bookmark usage disabled";
 			SC_log_error(func, "", stmt);
 			return SQL_ERROR;
 		}
 
-		/* Make sure it is the bookmark data type */
-		if (fCType != SQL_C_BOOKMARK)
-		{
+		/*	Make sure it is the bookmark data type */
+		if (fCType != SQL_C_BOOKMARK) {
 			stmt->errormsg = "Column 0 is not of type SQL_C_BOOKMARK";
 			stmt->errornumber = STMT_PROGRAM_TYPE_OUT_OF_RANGE;
 			SC_log_error(func, "", stmt);
 			return SQL_ERROR;
 		}
-
+		
 		get_bookmark = TRUE;
-	}
 
-	else
-	{
+    }
+
+	else {
+
 		/* use zero-based column numbers */
 		icol--;
 
 		/* make sure the column number is valid */
 		num_cols = QR_NumResultCols(res);
-		if (icol >= num_cols)
-		{
+		if (icol >= num_cols) {
 			stmt->errormsg = "Invalid column number.";
 			stmt->errornumber = STMT_INVALID_COLUMN_NUMBER_ERROR;
 			SC_log_error(func, "", stmt);
@@ -733,13 +670,11 @@ SQLGetData(
 		}
 	}
 
-	if (stmt->manual_result || !globals.use_declarefetch)
-	{
+	if ( stmt->manual_result || ! globals.use_declarefetch) {
 		/* make sure we're positioned on a valid row */
 		num_rows = QR_get_num_tuples(res);
-		if ((stmt->currTuple < 0) ||
-			(stmt->currTuple >= num_rows))
-		{
+		if((stmt->currTuple < 0) ||
+		   (stmt->currTuple >= num_rows)) {
 			stmt->errormsg = "Not positioned on a valid row for GetData.";
 			stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
 			SC_log_error(func, "", stmt);
@@ -747,33 +682,31 @@ SQLGetData(
 		}
 		mylog("     num_rows = %d\n", num_rows);
 
-		if (!get_bookmark)
-		{
-			if (stmt->manual_result)
+		if ( ! get_bookmark) {
+			if ( stmt->manual_result) {
 				value = QR_get_value_manual(res, stmt->currTuple, icol);
-			else
+			}
+			else {
 				value = QR_get_value_backend_row(res, stmt->currTuple, icol);
+			}
 			mylog("     value = '%s'\n", value);
 		}
 	}
-	else
-	{							/* it's a SOCKET result (backend data) */
-		if (stmt->currTuple == -1 || !res || !res->tupleField)
-		{
+	else { /* it's a SOCKET result (backend data) */
+		if (stmt->currTuple == -1 || ! res || ! res->tupleField) {
 			stmt->errormsg = "Not positioned on a valid row for GetData.";
 			stmt->errornumber = STMT_INVALID_CURSOR_STATE_ERROR;
 			SC_log_error(func, "", stmt);
 			return SQL_ERROR;
 		}
 
-		if (!get_bookmark)
+		if ( ! get_bookmark)
 			value = QR_get_value_backend(res, icol);
 
 		mylog("  socket: value = '%s'\n", value);
 	}
 
-	if (get_bookmark)
-	{
+	if ( get_bookmark) {
 		*((UDWORD *) rgbValue) = SC_get_bookmark(stmt);
 
 		if (pcbValue)
@@ -788,91 +721,85 @@ SQLGetData(
 
 	stmt->current_col = icol;
 
-	result = copy_and_convert_field(stmt, field_type, value,
-								 fCType, rgbValue, cbValueMax, pcbValue);
+    result = copy_and_convert_field(stmt, field_type, value, 
+                                    fCType, rgbValue, cbValueMax, pcbValue);
 
 	stmt->current_col = -1;
 
-	switch (result)
-	{
-		case COPY_OK:
-			return SQL_SUCCESS;
+	switch(result) {
+	case COPY_OK:
+		return SQL_SUCCESS;
 
-		case COPY_UNSUPPORTED_TYPE:
-			stmt->errormsg = "Received an unsupported type from Postgres.";
-			stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
+	case COPY_UNSUPPORTED_TYPE:
+		stmt->errormsg = "Received an unsupported type from Postgres.";
+		stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+		SC_log_error(func, "", stmt);
+		return SQL_ERROR;
 
-		case COPY_UNSUPPORTED_CONVERSION:
-			stmt->errormsg = "Couldn't handle the necessary data type conversion.";
-			stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
+	case COPY_UNSUPPORTED_CONVERSION:
+		stmt->errormsg = "Couldn't handle the necessary data type conversion.";
+		stmt->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+		SC_log_error(func, "", stmt);
+		return SQL_ERROR;
 
-		case COPY_RESULT_TRUNCATED:
-			stmt->errornumber = STMT_TRUNCATED;
-			stmt->errormsg = "The buffer was too small for the result.";
-			return SQL_SUCCESS_WITH_INFO;
+	case COPY_RESULT_TRUNCATED:
+		stmt->errornumber = STMT_TRUNCATED;
+		stmt->errormsg = "The buffer was too small for the result.";
+		return SQL_SUCCESS_WITH_INFO;
 
-		case COPY_GENERAL_ERROR:		/* error msg already filled in */
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
+	case COPY_GENERAL_ERROR:	/* error msg already filled in */
+		SC_log_error(func, "", stmt);
+		return SQL_ERROR;
 
-		case COPY_NO_DATA_FOUND:
-			/* SC_log_error(func, "no data found", stmt); */
-			return SQL_NO_DATA_FOUND;
+	case COPY_NO_DATA_FOUND:
+		/* SC_log_error(func, "no data found", stmt); */
+		return SQL_NO_DATA_FOUND;
 
-		default:
-			stmt->errormsg = "Unrecognized return value from copy_and_convert_field.";
-			stmt->errornumber = STMT_INTERNAL_ERROR;
-			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
-	}
+    default:
+        stmt->errormsg = "Unrecognized return value from copy_and_convert_field.";
+        stmt->errornumber = STMT_INTERNAL_ERROR;
+		SC_log_error(func, "", stmt);
+        return SQL_ERROR;
+    }
 }
 
 
 
-/*		Returns data for bound columns in the current row ("hstmt->iCursor"), */
-/*		advances the cursor. */
+/*      Returns data for bound columns in the current row ("hstmt->iCursor"), */
+/*      advances the cursor. */
 
-RETCODE SQL_API
-SQLFetch(
-		 HSTMT hstmt)
+RETCODE SQL_API SQLFetch(
+        HSTMT   hstmt)
 {
-	static char *func = "SQLFetch";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *res;
+static char *func = "SQLFetch";
+StatementClass *stmt = (StatementClass *) hstmt;   
+QResultClass *res;
 
-	mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
+mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	SC_clear_error(stmt);
 
-	if (!(res = stmt->result))
-	{
+	if ( ! (res = stmt->result)) {
 		stmt->errormsg = "Null statement result in SQLFetch.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	/* Not allowed to bind a bookmark column when using SQLFetch. */
-	if (stmt->bookmark.buffer)
-	{
+	/*	Not allowed to bind a bookmark column when using SQLFetch. */
+	if ( stmt->bookmark.buffer) {
 		stmt->errornumber = STMT_COLNUM_ERROR;
 		stmt->errormsg = "Not allowed to bind a bookmark column when using SQLFetch";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->status == STMT_EXECUTING)
-	{
+	if (stmt->status == STMT_EXECUTING) {
 		stmt->errormsg = "Can't fetch while statement is still executing.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
@@ -880,16 +807,14 @@ SQLFetch(
 	}
 
 
-	if (stmt->status != STMT_FINISHED)
-	{
+	if (stmt->status != STMT_FINISHED) {
 		stmt->errornumber = STMT_STATUS_ERROR;
 		stmt->errormsg = "Fetch can only be called after the successful execution on a SQL statement";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->bindings == NULL)
-	{
+	if (stmt->bindings == NULL) {
 		/* just to avoid a crash if the user insists on calling this */
 		/* function even if SQL_ExecDirect has reported an Error */
 		stmt->errormsg = "Bindings were not allocated properly.";
@@ -899,43 +824,36 @@ SQLFetch(
 	}
 
 	QR_set_rowset_size(res, 1);
-	QR_inc_base(res, stmt->last_fetch_count);
+	QR_inc_base(res, stmt->last_fetch_count);	
 
 	return SC_fetch(stmt);
 }
 
-/*		This fetchs a block of data (rowset). */
+/*      This fetchs a block of data (rowset). */
 
-RETCODE SQL_API
-SQLExtendedFetch(
-				 HSTMT hstmt,
-				 UWORD fFetchType,
-				 SDWORD irow,
-				 UDWORD FAR *pcrow,
-				 UWORD FAR *rgfRowStatus)
+RETCODE SQL_API SQLExtendedFetch(
+        HSTMT      hstmt,
+        UWORD      fFetchType,
+        SDWORD     irow,
+        UDWORD FAR *pcrow,
+        UWORD  FAR *rgfRowStatus)
 {
-	static char *func = "SQLExtendedFetch";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *res;
-	int			num_tuples,
-				i,
-				save_rowset_size;
-	RETCODE		result;
-	char		truncated,
-				error;
-
-	mylog("SQLExtendedFetch: stmt=%u\n", stmt);
-
-	if (!stmt)
-	{
+static char *func = "SQLExtendedFetch";
+StatementClass *stmt = (StatementClass *) hstmt;
+QResultClass *res;
+int num_tuples, i, save_rowset_size;
+RETCODE result;
+char truncated, error;
+
+mylog("SQLExtendedFetch: stmt=%u\n", stmt);
+
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (globals.use_declarefetch && !stmt->manual_result)
-	{
-		if (fFetchType != SQL_FETCH_NEXT)
-		{
+	if ( globals.use_declarefetch && ! stmt->manual_result) {
+		if ( fFetchType != SQL_FETCH_NEXT) {
 			stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
 			stmt->errormsg = "Unsupported fetch type for SQLExtendedFetch with UseDeclareFetch option.";
 			return SQL_ERROR;
@@ -944,44 +862,36 @@ SQLExtendedFetch(
 
 	SC_clear_error(stmt);
 
-	if (!(res = stmt->result))
-	{
+	if ( ! (res = stmt->result)) {
 		stmt->errormsg = "Null statement result in SQLExtendedFetch.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	/*
-	 * If a bookmark colunmn is bound but bookmark usage is off, then
-	 * error
-	 */
-	if (stmt->bookmark.buffer && stmt->options.use_bookmarks == SQL_UB_OFF)
-	{
+	/*	If a bookmark colunmn is bound but bookmark usage is off, then error */
+	if (stmt->bookmark.buffer && stmt->options.use_bookmarks == SQL_UB_OFF) {
 		stmt->errornumber = STMT_COLNUM_ERROR;
 		stmt->errormsg = "Attempt to retrieve bookmark with bookmark usage disabled";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->status == STMT_EXECUTING)
-	{
+	if (stmt->status == STMT_EXECUTING) {
 		stmt->errormsg = "Can't fetch while statement is still executing.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->status != STMT_FINISHED)
-	{
+	if (stmt->status != STMT_FINISHED) {
 		stmt->errornumber = STMT_STATUS_ERROR;
 		stmt->errormsg = "ExtendedFetch can only be called after the successful execution on a SQL statement";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (stmt->bindings == NULL)
-	{
+	if (stmt->bindings == NULL) {
 		/* just to avoid a crash if the user insists on calling this */
 		/* function even if SQL_ExecDirect has reported an Error */
 		stmt->errormsg = "Bindings were not allocated properly.";
@@ -990,7 +900,7 @@ SQLExtendedFetch(
 		return SQL_ERROR;
 	}
 
-	/* Initialize to no rows fetched */
+	/*	Initialize to no rows fetched */
 	if (rgfRowStatus)
 		for (i = 0; i < stmt->options.rowset_size; i++)
 			*(rgfRowStatus + i) = SQL_ROW_NOROW;
@@ -1000,158 +910,150 @@ SQLExtendedFetch(
 
 	num_tuples = QR_get_num_tuples(res);
 
-	/* Save and discard the saved rowset size */
+	/*	Save and discard the saved rowset size */
 	save_rowset_size = stmt->save_rowset_size;
 	stmt->save_rowset_size = -1;
 
-	switch (fFetchType)
-	{
-		case SQL_FETCH_NEXT:
+	switch (fFetchType)  {
+	case SQL_FETCH_NEXT:
 
-			/*
-			 * From the odbc spec... If positioned before the start of the
-			 * RESULT SET, then this should be equivalent to
-			 * SQL_FETCH_FIRST.
-			 */
+		/*	From the odbc spec... If positioned before the start of the RESULT SET,
+			then this should be equivalent to SQL_FETCH_FIRST.
+		*/
 
-			if (stmt->rowset_start < 0)
-				stmt->rowset_start = 0;
-
-			else
-				stmt->rowset_start += (save_rowset_size > 0 ? save_rowset_size : stmt->options.rowset_size);
+		if (stmt->rowset_start < 0)
+			stmt->rowset_start = 0;
 
-			mylog("SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
-			break;
+		else {
+			
+			stmt->rowset_start += (save_rowset_size > 0 ? save_rowset_size : stmt->options.rowset_size);
+		}
 
-		case SQL_FETCH_PRIOR:
-			mylog("SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+		mylog("SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+		break;
 
+	case SQL_FETCH_PRIOR:
+		mylog("SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
 
-			/*
-			 * From the odbc spec... If positioned after the end of the
-			 * RESULT SET, then this should be equivalent to
-			 * SQL_FETCH_LAST.
-			 */
 
-			if (stmt->rowset_start >= num_tuples)
-				stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
-			else
-				stmt->rowset_start -= stmt->options.rowset_size;
+		/*	From the odbc spec... If positioned after the end of the RESULT SET,
+			then this should be equivalent to SQL_FETCH_LAST.
+		*/
 
-			break;
+		if (stmt->rowset_start >= num_tuples) {
+			stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
 
-		case SQL_FETCH_FIRST:
-			mylog("SQL_FETCH_FIRST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+		}
+		else {
 
-			stmt->rowset_start = 0;
-			break;
+			stmt->rowset_start -= stmt->options.rowset_size;
 
-		case SQL_FETCH_LAST:
-			mylog("SQL_FETCH_LAST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
+		}
 
-			stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size);
-			break;
+		break;
 
-		case SQL_FETCH_ABSOLUTE:
-			mylog("SQL_FETCH_ABSOLUTE: num_tuples=%d, currtuple=%d, irow=%d\n", num_tuples, stmt->currTuple, irow);
+	case SQL_FETCH_FIRST:
+		mylog("SQL_FETCH_FIRST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
 
-			/* Position before result set, but dont fetch anything */
-			if (irow == 0)
-			{
-				stmt->rowset_start = -1;
-				stmt->currTuple = -1;
-				return SQL_NO_DATA_FOUND;
-			}
-			/* Position before the desired row */
-			else if (irow > 0)
-				stmt->rowset_start = irow - 1;
-			/* Position with respect to the end of the result set */
-			else
-				stmt->rowset_start = num_tuples + irow;
+		stmt->rowset_start = 0;
+		break;
 
-			break;
+	case SQL_FETCH_LAST:
+		mylog("SQL_FETCH_LAST: num_tuples=%d, currtuple=%d\n", num_tuples, stmt->currTuple);
 
-		case SQL_FETCH_RELATIVE:
+		stmt->rowset_start = num_tuples <= 0 ? 0 : (num_tuples - stmt->options.rowset_size) ;
+		break;
 
-			/*
-			 * Refresh the current rowset -- not currently implemented,
-			 * but lie anyway
-			 */
-			if (irow == 0)
-				break;
+	case SQL_FETCH_ABSOLUTE:
+		mylog("SQL_FETCH_ABSOLUTE: num_tuples=%d, currtuple=%d, irow=%d\n", num_tuples, stmt->currTuple, irow);
 
-			stmt->rowset_start += irow;
+		/*	Position before result set, but dont fetch anything */
+		if (irow == 0) {
+			stmt->rowset_start = -1;
+			stmt->currTuple = -1;
+			return SQL_NO_DATA_FOUND;
+		}
+		/*	Position before the desired row */
+		else if (irow > 0) {
+			stmt->rowset_start = irow - 1;
+		}
+		/*	Position with respect to the end of the result set */
+		else {
+			stmt->rowset_start = num_tuples + irow;
+		}    
 
+		break;
 
+	case SQL_FETCH_RELATIVE:
+		
+		/*	Refresh the current rowset -- not currently implemented, but lie anyway */
+		if (irow == 0) {
 			break;
+		}
 
-		case SQL_FETCH_BOOKMARK:
+		stmt->rowset_start += irow;
 
-			stmt->rowset_start = irow - 1;
-			break;
+		
+		break;
 
-		default:
-			SC_log_error(func, "Unsupported SQLExtendedFetch Direction", stmt);
-			return SQL_ERROR;
-	}
+	case SQL_FETCH_BOOKMARK:
+
+		stmt->rowset_start = irow - 1;
+		break;
+
+	default:
+		SC_log_error(func, "Unsupported SQLExtendedFetch Direction", stmt);
+		return SQL_ERROR;   
+
+	}           
 
 
 	/***********************************/
-	/* CHECK FOR PROPER CURSOR STATE  */
+	/*	CHECK FOR PROPER CURSOR STATE  */
 	/***********************************/
-
-	/*
-	 * Handle Declare Fetch style specially because the end is not really
-	 * the end...
-	 */
-	if (globals.use_declarefetch && !stmt->manual_result)
-	{
-		if (QR_end_tuples(res))
+	/*	Handle Declare Fetch style specially because the end is not really the end... */
+	if ( globals.use_declarefetch && ! stmt->manual_result) {
+		if (QR_end_tuples(res)) {
 			return SQL_NO_DATA_FOUND;
+		}
 	}
-	else
-	{
-		/* If *new* rowset is after the result_set, return no data found */
-		if (stmt->rowset_start >= num_tuples)
-		{
+	else {
+		/*	If *new* rowset is after the result_set, return no data found */
+		if (stmt->rowset_start >= num_tuples) {
 			stmt->rowset_start = num_tuples;
 			return SQL_NO_DATA_FOUND;
 		}
 	}
 
-	/* If *new* rowset is prior to result_set, return no data found */
-	if (stmt->rowset_start < 0)
-	{
-		if (stmt->rowset_start + stmt->options.rowset_size <= 0)
-		{
+	/*	If *new* rowset is prior to result_set, return no data found */
+	if (stmt->rowset_start < 0) {
+		if (stmt->rowset_start + stmt->options.rowset_size <= 0) {
 			stmt->rowset_start = -1;
 			return SQL_NO_DATA_FOUND;
 		}
-		else
-		{						/* overlap with beginning of result set,
-								 * so get first rowset */
+		else {	/*	overlap with beginning of result set, so get first rowset */
 			stmt->rowset_start = 0;
 		}
 	}
 
-	/* currTuple is always 1 row prior to the rowset */
+	/*	currTuple is always 1 row prior to the rowset */
 	stmt->currTuple = stmt->rowset_start - 1;
 
-	/* increment the base row in the tuple cache */
+	/*	increment the base row in the tuple cache */
 	QR_set_rowset_size(res, stmt->options.rowset_size);
-	QR_inc_base(res, stmt->last_fetch_count);
-
-	/* Physical Row advancement occurs for each row fetched below */
+	QR_inc_base(res, stmt->last_fetch_count);	
+		
+	/*	Physical Row advancement occurs for each row fetched below */
 
 	mylog("SQLExtendedFetch: new currTuple = %d\n", stmt->currTuple);
 
 	truncated = error = FALSE;
-	for (i = 0; i < stmt->options.rowset_size; i++)
-	{
+	for (i = 0; i < stmt->options.rowset_size; i++) {
+
 		stmt->bind_row = i;		/* set the binding location */
 		result = SC_fetch(stmt);
 
-		/* Determine Function status */
+		/*	Determine Function status */
 		if (result == SQL_NO_DATA_FOUND)
 			break;
 		else if (result == SQL_SUCCESS_WITH_INFO)
@@ -1159,88 +1061,82 @@ SQLExtendedFetch(
 		else if (result == SQL_ERROR)
 			error = TRUE;
 
-		/* Determine Row Status */
-		if (rgfRowStatus)
-		{
-			if (result == SQL_ERROR)
+		/*	Determine Row Status */
+		if (rgfRowStatus) {
+			if (result == SQL_ERROR) 
 				*(rgfRowStatus + i) = SQL_ROW_ERROR;
 			else
-				*(rgfRowStatus + i) = SQL_ROW_SUCCESS;
+				*(rgfRowStatus + i)= SQL_ROW_SUCCESS;
 		}
 	}
 
-	/* Save the fetch count for SQLSetPos */
-	stmt->last_fetch_count = i;
+	/*	Save the fetch count for SQLSetPos */
+	stmt->last_fetch_count= i;
 
-	/* Reset next binding row */
+	/*	Reset next binding row */
 	stmt->bind_row = 0;
 
-	/* Move the cursor position to the first row in the result set. */
+	/*	Move the cursor position to the first row in the result set. */
 	stmt->currTuple = stmt->rowset_start;
 
-	/* For declare/fetch, need to reset cursor to beginning of rowset */
-	if (globals.use_declarefetch && !stmt->manual_result)
+	/*	For declare/fetch, need to reset cursor to beginning of rowset */
+	if (globals.use_declarefetch && ! stmt->manual_result) {
 		QR_set_position(res, 0);
+	}
 
-	/* Set the number of rows retrieved */
+	/*	Set the number of rows retrieved */
 	if (pcrow)
 		*pcrow = i;
 
 	if (i == 0)
-		return SQL_NO_DATA_FOUND;		/* Only DeclareFetch should wind
-										 * up here */
+		return SQL_NO_DATA_FOUND;		/*	Only DeclareFetch should wind up here */
 	else if (error)
 		return SQL_ERROR;
 	else if (truncated)
 		return SQL_SUCCESS_WITH_INFO;
 	else
 		return SQL_SUCCESS;
+
 }
 
 
-/*		This determines whether there are more results sets available for */
-/*		the "hstmt". */
+/*      This determines whether there are more results sets available for */
+/*      the "hstmt". */
 
 /* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
-RETCODE SQL_API
-SQLMoreResults(
-			   HSTMT hstmt)
+RETCODE SQL_API SQLMoreResults(
+        HSTMT   hstmt)
 {
 	return SQL_NO_DATA_FOUND;
 }
 
-/*	   This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
+/*     This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
 /*	   This will be useful (so far) only when using SQLGetData after SQLExtendedFetch.	 */
-RETCODE SQL_API
-SQLSetPos(
-		  HSTMT hstmt,
-		  UWORD irow,
-		  UWORD fOption,
-		  UWORD fLock)
+RETCODE SQL_API SQLSetPos(
+        HSTMT   hstmt,
+        UWORD   irow,
+        UWORD   fOption,
+        UWORD   fLock)
 {
-	static char *func = "SQLSetPos";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	QResultClass *res;
-	int			num_cols,
-				i;
-	BindInfoClass *bindings = stmt->bindings;
-
-	if (!stmt)
-	{
+static char *func = "SQLSetPos";
+StatementClass *stmt = (StatementClass *) hstmt;
+QResultClass *res;
+int num_cols, i;
+BindInfoClass *bindings = stmt->bindings;
+
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (fOption != SQL_POSITION && fOption != SQL_REFRESH)
-	{
+	if (fOption != SQL_POSITION && fOption != SQL_REFRESH) {
 		stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR;
 		stmt->errormsg = "Only SQL_POSITION/REFRESH is supported for SQLSetPos";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (!(res = stmt->result))
-	{
+	if ( ! (res = stmt->result)) {
 		stmt->errormsg = "Null statement result in SQLSetPos.";
 		stmt->errornumber = STMT_SEQUENCE_ERROR;
 		SC_log_error(func, "", stmt);
@@ -1248,16 +1144,14 @@ SQLSetPos(
 	}
 	num_cols = QR_NumResultCols(res);
 
-	if (irow == 0)
-	{
+	if (irow == 0) {
 		stmt->errornumber = STMT_ROW_OUT_OF_RANGE;
 		stmt->errormsg = "Driver does not support Bulk operations.";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	if (irow > stmt->last_fetch_count)
-	{
+	if (irow > stmt->last_fetch_count) {
 		stmt->errornumber = STMT_ROW_OUT_OF_RANGE;
 		stmt->errormsg = "Row value out of range";
 		SC_log_error(func, "", stmt);
@@ -1266,7 +1160,7 @@ SQLSetPos(
 
 	irow--;
 
-	/* Reset for SQLGetData */
+	/*	Reset for SQLGetData */
 	for (i = 0; i < num_cols; i++)
 		bindings[i].data_left = -1;
 
@@ -1275,82 +1169,76 @@ SQLSetPos(
 	stmt->currTuple = stmt->rowset_start + irow;
 
 	return SQL_SUCCESS;
+
 }
 
-/*		Sets options that control the behavior of cursors. */
+/*      Sets options that control the behavior of cursors. */
 
-RETCODE SQL_API
-SQLSetScrollOptions(
-					HSTMT hstmt,
-					UWORD fConcurrency,
-					SDWORD crowKeyset,
-					UWORD crowRowset)
+RETCODE SQL_API SQLSetScrollOptions(
+        HSTMT      hstmt,
+        UWORD      fConcurrency,
+        SDWORD  crowKeyset,
+        UWORD      crowRowset)
 {
-	static char *func = "SQLSetScrollOptions";
+static char *func = "SQLSetScrollOptions";
 
 	SC_log_error(func, "Function not implemented", (StatementClass *) hstmt);
 	return SQL_ERROR;
 }
 
 
-/*		Set the cursor name on a statement handle */
+/*      Set the cursor name on a statement handle */
 
-RETCODE SQL_API
-SQLSetCursorName(
-				 HSTMT hstmt,
-				 UCHAR FAR *szCursor,
-				 SWORD cbCursor)
+RETCODE SQL_API SQLSetCursorName(
+        HSTMT     hstmt,
+        UCHAR FAR *szCursor,
+        SWORD     cbCursor)
 {
-	static char *func = "SQLSetCursorName";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	int			len;
+static char *func="SQLSetCursorName";
+StatementClass *stmt = (StatementClass *) hstmt;
+int len;
 
-	mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCursor, cbCursor);
+mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCursor, cbCursor);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
 	len = (cbCursor == SQL_NTS) ? strlen(szCursor) : cbCursor;
 
-	if (len <= 0 || len > sizeof(stmt->cursor_name) - 1)
-	{
+	if (len <= 0 || len > sizeof(stmt->cursor_name) - 1) {
 		stmt->errornumber = STMT_INVALID_CURSOR_NAME;
 		stmt->errormsg = "Invalid Cursor Name";
 		SC_log_error(func, "", stmt);
 		return SQL_ERROR;
 	}
 
-	strncpy_null(stmt->cursor_name, szCursor, len + 1);
+	strncpy_null(stmt->cursor_name, szCursor, len+1);
 	return SQL_SUCCESS;
 }
 
-/*		Return the cursor name for a statement handle */
+/*      Return the cursor name for a statement handle */
 
-RETCODE SQL_API
-SQLGetCursorName(
-				 HSTMT hstmt,
-				 UCHAR FAR *szCursor,
-				 SWORD cbCursorMax,
-				 SWORD FAR *pcbCursor)
+RETCODE SQL_API SQLGetCursorName(
+        HSTMT     hstmt,
+        UCHAR FAR *szCursor,
+        SWORD     cbCursorMax,
+        SWORD FAR *pcbCursor)
 {
-	static char *func = "SQLGetCursorName";
-	StatementClass *stmt = (StatementClass *) hstmt;
-	int			len = 0;
-	RETCODE		result;
+static char *func="SQLGetCursorName";
+StatementClass *stmt = (StatementClass *) hstmt;
+int len = 0;
+RETCODE result;
 
-	mylog("SQLGetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d, pcbCursor=%u\n", hstmt, szCursor, cbCursorMax, pcbCursor);
+mylog("SQLGetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d, pcbCursor=%u\n", hstmt, szCursor, cbCursorMax, pcbCursor);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (stmt->cursor_name[0] == '\0')
-	{
+	if ( stmt->cursor_name[0] == '\0') {
 		stmt->errornumber = STMT_NO_CURSOR_NAME;
 		stmt->errormsg = "No Cursor name available";
 		SC_log_error(func, "", stmt);
@@ -1360,12 +1248,10 @@ SQLGetCursorName(
 	result = SQL_SUCCESS;
 	len = strlen(stmt->cursor_name);
 
-	if (szCursor)
-	{
+	if (szCursor) {
 		strncpy_null(szCursor, stmt->cursor_name, cbCursorMax);
 
-		if (len >= cbCursorMax)
-		{
+		if (len >= cbCursorMax)  {
 			result = SQL_SUCCESS_WITH_INFO;
 			stmt->errornumber = STMT_TRUNCATED;
 			stmt->errormsg = "The buffer was too small for the result.";
@@ -1377,3 +1263,5 @@ SQLGetCursorName(
 
 	return result;
 }
+
+
diff --git a/src/interfaces/odbc/setup.c b/src/interfaces/odbc/setup.c
index 8ab8760d48ae622541801a9da4951c963caec970..8c3ba4d02ae4d0bbd20948cafd681b3c504a3cd3 100644
--- a/src/interfaces/odbc/setup.c
+++ b/src/interfaces/odbc/setup.c
@@ -1,14 +1,15 @@
-/* Module:			setup.c
+
+/* Module:          setup.c
  *
- * Description:		This module contains the setup functions for
- *					adding/modifying a Data Source in the ODBC.INI portion
- *					of the registry.
+ * Description:     This module contains the setup functions for 
+ *                  adding/modifying a Data Source in the ODBC.INI portion
+ *                  of the registry.
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	ConfigDSN
+ * API functions:   ConfigDSN
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  *************************************************************************************/
 
@@ -25,311 +26,288 @@
 
 #define INTFUNC  __stdcall
 
-extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
+extern HINSTANCE NEAR s_hModule;               /* Saved module handle. */
 extern GLOBAL_VALUES globals;
 
 /* Constants --------------------------------------------------------------- */
-#define MIN(x,y)	  ((x) < (y) ? (x) : (y))
+#define MIN(x,y)      ((x) < (y) ? (x) : (y))
 
 #ifdef WIN32
-#define MAXPGPATH		(255+1)
+#define MAXPGPATH       (255+1)
 #endif
 
-#define MAXKEYLEN		(15+1)	/* Max keyword length */
-#define MAXDESC			(255+1) /* Max description length */
-#define MAXDSNAME		(32+1)	/* Max data source name length */
+#define MAXKEYLEN       (15+1)            /* Max keyword length */
+#define MAXDESC         (255+1)           /* Max description length */
+#define MAXDSNAME       (32+1)            /* Max data source name length */
 
 
 /* Globals ----------------------------------------------------------------- */
 /* NOTE:  All these are used by the dialog procedures */
-typedef struct tagSETUPDLG
-{
-	HWND		hwndParent;		/* Parent window handle */
-	LPCSTR		lpszDrvr;		/* Driver description */
-	ConnInfo	ci;
-	char		szDSN[MAXDSNAME];		/* Original data source name */
-	BOOL		fNewDSN;		/* New data source flag */
-	BOOL		fDefault;		/* Default data source flag */
-}			SETUPDLG, FAR *LPSETUPDLG;
+typedef struct tagSETUPDLG {
+        HWND       hwndParent;                   /* Parent window handle */
+        LPCSTR     lpszDrvr;                     /* Driver description */
+		ConnInfo   ci;
+        char       szDSN[MAXDSNAME];             /* Original data source name */
+        BOOL       fNewDSN;                      /* New data source flag */
+        BOOL       fDefault;                     /* Default data source flag */
+
+} SETUPDLG, FAR *LPSETUPDLG;
 
 
 
 /* Prototypes -------------------------------------------------------------- */
 void INTFUNC CenterDialog(HWND hdlg);
-int CALLBACK ConfigDlgProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam);
-void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
+int  CALLBACK ConfigDlgProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam);
+void INTFUNC ParseAttributes (LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
 BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
 
 
 /* ConfigDSN ---------------------------------------------------------------
-  Description:	ODBC Setup entry point
-				This entry point is called by the ODBC Installer
-				(see file header for more details)
-  Input		 :	hwnd ----------- Parent window handle
-				fRequest ------- Request type (i.e., add, config, or remove)
-				lpszDriver ----- Driver name
-				lpszAttributes - data source attribute string
-  Output	 :	TRUE success, FALSE otherwise
+  Description:  ODBC Setup entry point
+                This entry point is called by the ODBC Installer
+                (see file header for more details)
+  Input      :  hwnd ----------- Parent window handle
+                fRequest ------- Request type (i.e., add, config, or remove)
+                lpszDriver ----- Driver name
+                lpszAttributes - data source attribute string
+  Output     :  TRUE success, FALSE otherwise
 --------------------------------------------------------------------------*/
 
-BOOL		CALLBACK
-ConfigDSN(HWND hwnd,
-		  WORD fRequest,
-		  LPCSTR lpszDriver,
-		  LPCSTR lpszAttributes)
+BOOL CALLBACK ConfigDSN (HWND    hwnd,
+                         WORD    fRequest,
+                         LPCSTR  lpszDriver,
+                         LPCSTR  lpszAttributes)
 {
-	BOOL		fSuccess;		/* Success/fail flag */
-	GLOBALHANDLE hglbAttr;
-	LPSETUPDLG	lpsetupdlg;
-
+BOOL  fSuccess;                                            /* Success/fail flag */
+GLOBALHANDLE hglbAttr;
+LPSETUPDLG lpsetupdlg;
+        
 
 	/* Allocate attribute array */
-	hglbAttr = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(SETUPDLG));
-	if (!hglbAttr)
-		return FALSE;
-	lpsetupdlg = (LPSETUPDLG) GlobalLock(hglbAttr);
-
-	/* Parse attribute string */
-	if (lpszAttributes)
-		ParseAttributes(lpszAttributes, lpsetupdlg);
-
-	/* Save original data source name */
-	if (lpsetupdlg->ci.dsn[0])
-		lstrcpy(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn);
-	else
-		lpsetupdlg->szDSN[0] = '\0';
-
-	/* Remove data source */
-	if (ODBC_REMOVE_DSN == fRequest)
-	{
+        hglbAttr = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, sizeof(SETUPDLG));
+        if (!hglbAttr)
+                return FALSE;
+        lpsetupdlg = (LPSETUPDLG)GlobalLock(hglbAttr);
+
+        /* Parse attribute string */
+        if (lpszAttributes)
+                ParseAttributes(lpszAttributes, lpsetupdlg);
+
+        /* Save original data source name */
+        if (lpsetupdlg->ci.dsn[0])
+                lstrcpy(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn);
+        else
+                lpsetupdlg->szDSN[0] = '\0';
+
+        /* Remove data source */
+        if (ODBC_REMOVE_DSN == fRequest) {
 		/* Fail if no data source name was supplied */
-		if (!lpsetupdlg->ci.dsn[0])
-			fSuccess = FALSE;
+                if (!lpsetupdlg->ci.dsn[0])
+                        fSuccess = FALSE;
 
-		/* Otherwise remove data source from ODBC.INI */
-		else
-			fSuccess = SQLRemoveDSNFromIni(lpsetupdlg->ci.dsn);
-	}
+                /* Otherwise remove data source from ODBC.INI */
+                else
+                        fSuccess = SQLRemoveDSNFromIni(lpsetupdlg->ci.dsn);
+        }
 
-	/* Add or Configure data source */
-	else
-	{
+        /* Add or Configure data source */
+        else {
 		/* Save passed variables for global access (e.g., dialog access) */
-		lpsetupdlg->hwndParent = hwnd;
-		lpsetupdlg->lpszDrvr = lpszDriver;
-		lpsetupdlg->fNewDSN = (ODBC_ADD_DSN == fRequest);
-		lpsetupdlg->fDefault = !lstrcmpi(lpsetupdlg->ci.dsn, INI_DSN);
-
-		/*
-		 * Display the appropriate dialog (if parent window handle
-		 * supplied)
-		 */
-		if (hwnd)
-		{
-			/* Display dialog(s) */
-			fSuccess = (IDOK == DialogBoxParam(s_hModule,
-											 MAKEINTRESOURCE(DLG_CONFIG),
-											   hwnd,
-											   ConfigDlgProc,
-											 (LONG) (LPSTR) lpsetupdlg));
-		}
-
-		else if (lpsetupdlg->ci.dsn[0])
-			fSuccess = SetDSNAttributes(hwnd, lpsetupdlg);
-		else
-			fSuccess = FALSE;
-	}
-
-	GlobalUnlock(hglbAttr);
-	GlobalFree(hglbAttr);
-
-	return fSuccess;
+                lpsetupdlg->hwndParent = hwnd;
+                lpsetupdlg->lpszDrvr     = lpszDriver;
+                lpsetupdlg->fNewDSN      = (ODBC_ADD_DSN == fRequest);
+                lpsetupdlg->fDefault     = !lstrcmpi(lpsetupdlg->ci.dsn, INI_DSN);
+
+                /* Display the appropriate dialog (if parent window handle supplied) */
+                if (hwnd) {
+			  /* Display dialog(s) */
+                          fSuccess = (IDOK == DialogBoxParam(s_hModule,
+                                                                MAKEINTRESOURCE(DLG_CONFIG),
+                                                                hwnd,
+                                                                ConfigDlgProc,
+                                                                (LONG)(LPSTR)lpsetupdlg));
+                }
+
+                else if (lpsetupdlg->ci.dsn[0])
+                        fSuccess = SetDSNAttributes(hwnd, lpsetupdlg);
+                else
+                        fSuccess = FALSE;
+        }
+
+        GlobalUnlock(hglbAttr);
+        GlobalFree(hglbAttr);
+
+        return fSuccess;
 }
 
 
 /* CenterDialog ------------------------------------------------------------
-		Description:  Center the dialog over the frame window
-		Input	   :  hdlg -- Dialog window handle
-		Output	   :  None
+        Description:  Center the dialog over the frame window
+        Input      :  hdlg -- Dialog window handle
+        Output     :  None
 --------------------------------------------------------------------------*/
-void		INTFUNC
-CenterDialog(HWND hdlg)
+void INTFUNC CenterDialog(HWND hdlg)
 {
-	HWND		hwndFrame;
-	RECT		rcDlg,
-				rcScr,
-				rcFrame;
-	int			cx,
-				cy;
-
-	hwndFrame = GetParent(hdlg);
-
-	GetWindowRect(hdlg, &rcDlg);
-	cx = rcDlg.right - rcDlg.left;
-	cy = rcDlg.bottom - rcDlg.top;
-
-	GetClientRect(hwndFrame, &rcFrame);
-	ClientToScreen(hwndFrame, (LPPOINT) (&rcFrame.left));
-	ClientToScreen(hwndFrame, (LPPOINT) (&rcFrame.right));
-	rcDlg.top = rcFrame.top + (((rcFrame.bottom - rcFrame.top) - cy) >> 1);
-	rcDlg.left = rcFrame.left + (((rcFrame.right - rcFrame.left) - cx) >> 1);
-	rcDlg.bottom = rcDlg.top + cy;
-	rcDlg.right = rcDlg.left + cx;
-
-	GetWindowRect(GetDesktopWindow(), &rcScr);
-	if (rcDlg.bottom > rcScr.bottom)
-	{
-		rcDlg.bottom = rcScr.bottom;
-		rcDlg.top = rcDlg.bottom - cy;
-	}
-	if (rcDlg.right > rcScr.right)
-	{
-		rcDlg.right = rcScr.right;
-		rcDlg.left = rcDlg.right - cx;
-	}
-
-	if (rcDlg.left < 0)
-		rcDlg.left = 0;
-	if (rcDlg.top < 0)
-		rcDlg.top = 0;
-
-	MoveWindow(hdlg, rcDlg.left, rcDlg.top, cx, cy, TRUE);
-	return;
+        HWND    hwndFrame;
+        RECT    rcDlg, rcScr, rcFrame;
+        int             cx, cy;
+
+        hwndFrame = GetParent(hdlg);
+
+        GetWindowRect(hdlg, &rcDlg);
+        cx = rcDlg.right  - rcDlg.left;
+        cy = rcDlg.bottom - rcDlg.top;
+
+        GetClientRect(hwndFrame, &rcFrame);
+        ClientToScreen(hwndFrame, (LPPOINT)(&rcFrame.left));
+        ClientToScreen(hwndFrame, (LPPOINT)(&rcFrame.right));
+        rcDlg.top    = rcFrame.top  + (((rcFrame.bottom - rcFrame.top) - cy) >> 1);
+        rcDlg.left   = rcFrame.left + (((rcFrame.right - rcFrame.left) - cx) >> 1);
+        rcDlg.bottom = rcDlg.top  + cy;
+        rcDlg.right  = rcDlg.left + cx;
+
+        GetWindowRect(GetDesktopWindow(), &rcScr);
+        if (rcDlg.bottom > rcScr.bottom)
+        {
+                rcDlg.bottom = rcScr.bottom;
+                rcDlg.top    = rcDlg.bottom - cy;
+        }
+        if (rcDlg.right  > rcScr.right)
+        {
+                rcDlg.right = rcScr.right;
+                rcDlg.left  = rcDlg.right - cx;
+        }
+
+        if (rcDlg.left < 0) rcDlg.left = 0;
+        if (rcDlg.top  < 0) rcDlg.top  = 0;
+
+        MoveWindow(hdlg, rcDlg.left, rcDlg.top, cx, cy, TRUE);
+        return;
 }
 
 /* ConfigDlgProc -----------------------------------------------------------
-  Description:	Manage add data source name dialog
-  Input		 :	hdlg --- Dialog window handle
-				wMsg --- Message
-				wParam - Message parameter
-				lParam - Message parameter
-  Output	 :	TRUE if message processed, FALSE otherwise
+  Description:  Manage add data source name dialog
+  Input      :  hdlg --- Dialog window handle
+                wMsg --- Message
+                wParam - Message parameter
+                lParam - Message parameter
+  Output     :  TRUE if message processed, FALSE otherwise
 --------------------------------------------------------------------------*/
 
 
-int			CALLBACK
-ConfigDlgProc(HWND hdlg,
-			  WORD wMsg,
-			  WPARAM wParam,
-			  LPARAM lParam)
+int CALLBACK ConfigDlgProc(HWND   hdlg,
+                           WORD   wMsg,
+                           WPARAM wParam,
+                           LPARAM lParam)
 {
-	switch (wMsg)
+
+	switch (wMsg) {
+	/* Initialize the dialog */
+	case WM_INITDIALOG:
 	{
-			/* Initialize the dialog */
-			case WM_INITDIALOG:
-			{
-				LPSETUPDLG	lpsetupdlg = (LPSETUPDLG) lParam;
-				ConnInfo   *ci = &lpsetupdlg->ci;
+		LPSETUPDLG lpsetupdlg = (LPSETUPDLG) lParam;
+		ConnInfo *ci = &lpsetupdlg->ci;
 
-				/* Hide the driver connect message */
-				ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL), SW_HIDE);
+		/*	Hide the driver connect message */
+		ShowWindow(GetDlgItem(hdlg, DRV_MSG_LABEL), SW_HIDE);
 
-				SetWindowLong(hdlg, DWL_USER, lParam);
-				CenterDialog(hdlg);		/* Center dialog */
+		SetWindowLong(hdlg, DWL_USER, lParam);
+		CenterDialog(hdlg);                             /* Center dialog */
 
-				/*
-				 * NOTE: Values supplied in the attribute string will
-				 * always
-				 */
-				/* override settings in ODBC.INI */
+		/* NOTE: Values supplied in the attribute string will always */
+		/*       override settings in ODBC.INI */
 
-				/* Get the rest of the common attributes */
-				getDSNinfo(ci, CONN_DONT_OVERWRITE);
+		/*	Get the rest of the common attributes */
+		getDSNinfo(ci, CONN_DONT_OVERWRITE);
 
-				/* Fill in any defaults */
-				getDSNdefaults(ci);
+		/*	Fill in any defaults */
+		getDSNdefaults(ci);
 
 
-				/* Initialize dialog fields */
-				SetDlgStuff(hdlg, ci);
+		/* Initialize dialog fields */
+		SetDlgStuff(hdlg, ci);
 
 
-				if (lpsetupdlg->fDefault)
-				{
-					EnableWindow(GetDlgItem(hdlg, IDC_DSNAME), FALSE);
-					EnableWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), FALSE);
-				}
-				else
-					SendDlgItemMessage(hdlg, IDC_DSNAME,
-							 EM_LIMITTEXT, (WPARAM) (MAXDSNAME - 1), 0L);
+		if (lpsetupdlg->fDefault) {
+			EnableWindow(GetDlgItem(hdlg, IDC_DSNAME), FALSE);
+			EnableWindow(GetDlgItem(hdlg, IDC_DSNAMETEXT), FALSE);
+		}
+		else
+			SendDlgItemMessage(hdlg, IDC_DSNAME,
+				EM_LIMITTEXT, (WPARAM)(MAXDSNAME-1), 0L);
 
-				SendDlgItemMessage(hdlg, IDC_DESC,
-							   EM_LIMITTEXT, (WPARAM) (MAXDESC - 1), 0L);
-				return TRUE;	/* Focus was not set */
-			}
+		SendDlgItemMessage(hdlg, IDC_DESC,
+			EM_LIMITTEXT, (WPARAM)(MAXDESC-1), 0L);
+		return TRUE;                                            /* Focus was not set */
+    }
 
 
-			/* Process buttons */
-		case WM_COMMAND:
+	/* Process buttons */
+	case WM_COMMAND:
 
-			switch (GET_WM_COMMAND_ID(wParam, lParam))
+		switch (GET_WM_COMMAND_ID(wParam, lParam)) {
+		/* Ensure the OK button is enabled only when a data source name */
+		/* is entered */
+		case IDC_DSNAME:
+			if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
 			{
+				char    szItem[MAXDSNAME];              /* Edit control text */
 
-					/*
-					 * Ensure the OK button is enabled only when a data
-					 * source name
-					 */
-					/* is entered */
-				case IDC_DSNAME:
-					if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
-					{
-						char		szItem[MAXDSNAME];	/* Edit control text */
-
-						/* Enable/disable the OK button */
-						EnableWindow(GetDlgItem(hdlg, IDOK),
-									 GetDlgItemText(hdlg, IDC_DSNAME,
-												szItem, sizeof(szItem)));
+				/* Enable/disable the OK button */
+				EnableWindow(GetDlgItem(hdlg, IDOK),
+					GetDlgItemText(hdlg, IDC_DSNAME,
+					szItem, sizeof(szItem)));
 
-						return TRUE;
-					}
-					break;
+				return TRUE;
+			}
+			break;
 
-					/* Accept results */
-				case IDOK:
-					{
-						LPSETUPDLG	lpsetupdlg;
+		/* Accept results */
+		case IDOK:
+		{
+			LPSETUPDLG lpsetupdlg;
 
-						lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
-						/* Retrieve dialog values */
-						if (!lpsetupdlg->fDefault)
-							GetDlgItemText(hdlg, IDC_DSNAME,
-										   lpsetupdlg->ci.dsn,
-										   sizeof(lpsetupdlg->ci.dsn));
+			lpsetupdlg = (LPSETUPDLG)GetWindowLong(hdlg, DWL_USER);
+			/* Retrieve dialog values */
+			if (!lpsetupdlg->fDefault)
+					GetDlgItemText(hdlg, IDC_DSNAME,
+							lpsetupdlg->ci.dsn,
+							sizeof(lpsetupdlg->ci.dsn));
 
 
-						/* Get Dialog Values */
-						GetDlgStuff(hdlg, &lpsetupdlg->ci);
+			/*	Get Dialog Values */
+			GetDlgStuff(hdlg, &lpsetupdlg->ci);
 
-						/* Update ODBC.INI */
-						SetDSNAttributes(hdlg, lpsetupdlg);
-					}
+			/* Update ODBC.INI */
+			SetDSNAttributes(hdlg, lpsetupdlg);
+        }
 
-					/* Return to caller */
-				case IDCANCEL:
-					EndDialog(hdlg, wParam);
-					return TRUE;
+		/* Return to caller */
+		case IDCANCEL:
+			EndDialog(hdlg, wParam);
+			return TRUE;
 
-				case IDC_DRIVER:
+		case IDC_DRIVER:
 
-					DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
-								hdlg, driver_optionsProc, (LPARAM) NULL);
+			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DRV),
+									hdlg, driver_optionsProc, (LPARAM) NULL);
 
-					return TRUE;
+			return TRUE;
 
-				case IDC_DATASOURCE:
-					{
-						LPSETUPDLG	lpsetupdlg;
+		case IDC_DATASOURCE:
+			{
+			LPSETUPDLG lpsetupdlg;
 
-						lpsetupdlg = (LPSETUPDLG) GetWindowLong(hdlg, DWL_USER);
+			lpsetupdlg = (LPSETUPDLG)GetWindowLong(hdlg, DWL_USER);
 
-						DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
-						 hdlg, ds_optionsProc, (LPARAM) &lpsetupdlg->ci);
+			DialogBoxParam(s_hModule, MAKEINTRESOURCE(DLG_OPTIONS_DS),
+									hdlg, ds_optionsProc, (LPARAM) &lpsetupdlg->ci);
 
-						return TRUE;
-					}
+			return TRUE;
 			}
+		}
 
-			break;
+		break;
 	}
 
 	/* Message not processed */
@@ -338,97 +316,97 @@ ConfigDlgProc(HWND hdlg,
 
 
 /* ParseAttributes ---------------------------------------------------------
-  Description:	Parse attribute string moving values into the aAttr array
-  Input		 :	lpszAttributes - Pointer to attribute string
-  Output	 :	None (global aAttr normally updated)
+  Description:  Parse attribute string moving values into the aAttr array
+  Input      :  lpszAttributes - Pointer to attribute string
+  Output     :  None (global aAttr normally updated)
 --------------------------------------------------------------------------*/
-void		INTFUNC
-ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
+void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
 {
-	LPCSTR		lpsz;
-	LPCSTR		lpszStart;
-	char		aszKey[MAXKEYLEN];
-	int			cbKey;
-	char		value[MAXPGPATH];
-
-	memset(&lpsetupdlg->ci, 0, sizeof(ConnInfo));
-
-	for (lpsz = lpszAttributes; *lpsz; lpsz++)
-	{							/* Extract key name (e.g., DSN), it must
-								 * be terminated by an equals */
-		lpszStart = lpsz;
-		for (;; lpsz++)
-		{
-			if (!*lpsz)
-				return;			/* No key was found */
-			else if (*lpsz == '=')
-				break;			/* Valid key found */
-		}
-		/* Determine the key's index in the key table (-1 if not found) */
-		cbKey = lpsz - lpszStart;
-		if (cbKey < sizeof(aszKey))
-		{
-			_fmemcpy(aszKey, lpszStart, cbKey);
-			aszKey[cbKey] = '\0';
-		}
-
-		/* Locate end of key value */
-		lpszStart = ++lpsz;
-		for (; *lpsz; lpsz++);
-
-
-		/* lpsetupdlg->aAttr[iElement].fSupplied = TRUE; */
-		_fmemcpy(value, lpszStart, MIN(lpsz - lpszStart + 1, MAXPGPATH));
-
-		mylog("aszKey='%s', value='%s'\n", aszKey, value);
-
-		/* Copy the appropriate value to the conninfo  */
-		copyAttributes(&lpsetupdlg->ci, aszKey, value);
-	}
-	return;
+LPCSTR  lpsz;
+LPCSTR  lpszStart;
+char    aszKey[MAXKEYLEN];
+int     cbKey;
+char    value[MAXPGPATH];
+
+		memset(&lpsetupdlg->ci, 0, sizeof(ConnInfo));
+
+        for (lpsz=lpszAttributes; *lpsz; lpsz++)
+        {  /*  Extract key name (e.g., DSN), it must be terminated by an equals */
+                lpszStart = lpsz;
+                for (;; lpsz++)
+                {
+                        if (!*lpsz)
+                                return;         /* No key was found */
+                        else if (*lpsz == '=')
+                                break;          /* Valid key found */
+                }
+                /* Determine the key's index in the key table (-1 if not found) */
+                cbKey    = lpsz - lpszStart;
+                if (cbKey < sizeof(aszKey))
+                {
+
+                        _fmemcpy(aszKey, lpszStart, cbKey);
+                        aszKey[cbKey] = '\0';
+                }
+
+                /* Locate end of key value */
+                lpszStart = ++lpsz;
+                for (; *lpsz; lpsz++);
+
+
+                /* lpsetupdlg->aAttr[iElement].fSupplied = TRUE; */
+                _fmemcpy(value, lpszStart, MIN(lpsz-lpszStart+1, MAXPGPATH));
+
+				mylog("aszKey='%s', value='%s'\n", aszKey, value);
+
+				/*	Copy the appropriate value to the conninfo  */
+				copyAttributes(&lpsetupdlg->ci, aszKey, value);
+        }
+        return;
 }
 
 
 /* SetDSNAttributes --------------------------------------------------------
-  Description:	Write data source attributes to ODBC.INI
-  Input		 :	hwnd - Parent window handle (plus globals)
-  Output	 :	TRUE if successful, FALSE otherwise
+  Description:  Write data source attributes to ODBC.INI
+  Input      :  hwnd - Parent window handle (plus globals)
+  Output     :  TRUE if successful, FALSE otherwise
 --------------------------------------------------------------------------*/
 
-BOOL		INTFUNC
-SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg)
+BOOL INTFUNC SetDSNAttributes(HWND hwndParent, LPSETUPDLG lpsetupdlg)
 {
-	LPCSTR		lpszDSN;		/* Pointer to data source name */
-
-	lpszDSN = lpsetupdlg->ci.dsn;
+LPCSTR  lpszDSN;                                                /* Pointer to data source name */
+    
+        lpszDSN = lpsetupdlg->ci.dsn;
 
-	/* Validate arguments */
-	if (lpsetupdlg->fNewDSN && !*lpsetupdlg->ci.dsn)
-		return FALSE;
+        /* Validate arguments */
+        if (lpsetupdlg->fNewDSN && !*lpsetupdlg->ci.dsn)
+                return FALSE;
 
-	/* Write the data source name */
-	if (!SQLWriteDSNToIni(lpszDSN, lpsetupdlg->lpszDrvr))
-	{
-		if (hwndParent)
-		{
-			char		szBuf[MAXPGPATH];
-			char		szMsg[MAXPGPATH];
+        /* Write the data source name */
+        if (!SQLWriteDSNToIni(lpszDSN, lpsetupdlg->lpszDrvr))
+        {
+                if (hwndParent)
+                {
+                        char  szBuf[MAXPGPATH];
+                        char  szMsg[MAXPGPATH];
 
-			LoadString(s_hModule, IDS_BADDSN, szBuf, sizeof(szBuf));
-			wsprintf(szMsg, szBuf, lpszDSN);
-			LoadString(s_hModule, IDS_MSGTITLE, szBuf, sizeof(szBuf));
-			MessageBox(hwndParent, szMsg, szBuf, MB_ICONEXCLAMATION | MB_OK);
-		}
-		return FALSE;
-	}
+                        LoadString(s_hModule, IDS_BADDSN, szBuf, sizeof(szBuf));
+                        wsprintf(szMsg, szBuf, lpszDSN);
+                        LoadString(s_hModule, IDS_MSGTITLE, szBuf, sizeof(szBuf));
+                        MessageBox(hwndParent, szMsg, szBuf, MB_ICONEXCLAMATION | MB_OK);
+                }
+                return FALSE;
+        }
 
 
-	/* Update ODBC.INI */
-	writeDSNinfo(&lpsetupdlg->ci);
+        /* Update ODBC.INI */
+		writeDSNinfo(&lpsetupdlg->ci);
 
 
 	/* If the data source name has changed, remove the old name */
-	if (lstrcmpi(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn))
-		SQLRemoveDSNFromIni(lpsetupdlg->szDSN);
-	return TRUE;
+        if (lstrcmpi(lpsetupdlg->szDSN, lpsetupdlg->ci.dsn))
+        {
+                SQLRemoveDSNFromIni(lpsetupdlg->szDSN);
+        }
+        return TRUE;
 }
diff --git a/src/interfaces/odbc/socket.c b/src/interfaces/odbc/socket.c
index 3c15eeecbbb1d13910b1c738a78b2b8b9688f795..6b551792fe12f89fec2cfca6d696e54ac0349731 100644
--- a/src/interfaces/odbc/socket.c
+++ b/src/interfaces/odbc/socket.c
@@ -1,13 +1,14 @@
-/* Module:			socket.c
+
+/* Module:          socket.c
  *
- * Description:		This module contains functions for low level socket
- *					operations (connecting/reading/writing to the backend)
+ * Description:     This module contains functions for low level socket
+ *                  operations (connecting/reading/writing to the backend)
  *
- * Classes:			SocketClass (Functions prefix: "SOCK_")
+ * Classes:         SocketClass (Functions prefix: "SOCK_")
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -19,7 +20,7 @@
 
 #ifndef WIN32
 #include <stdlib.h>
-#include <string.h>				/* for memset */
+#include <string.h>	/* for memset */
 #endif
 
 extern GLOBAL_VALUES globals;
@@ -38,45 +39,44 @@ extern GLOBAL_VALUES globals;
 void
 SOCK_clear_error(SocketClass *self)
 {
-	self->errornumber = 0;
-	self->errormsg = NULL;
+	self->errornumber = 0; 
+	self->errormsg = NULL; 
 }
 
-SocketClass *
+SocketClass * 
 SOCK_Constructor()
 {
-	SocketClass *rv;
+SocketClass *rv;
 
-	rv = (SocketClass *) malloc(sizeof(SocketClass));
+    rv = (SocketClass *) malloc(sizeof(SocketClass));
 
-	if (rv != NULL)
-	{
-		rv->socket = (SOCKETFD) - 1;
+    if (rv != NULL) {
+		rv->socket = (SOCKETFD) -1;
 		rv->buffer_filled_in = 0;
 		rv->buffer_filled_out = 0;
 		rv->buffer_read_in = 0;
 
 		rv->buffer_in = (unsigned char *) malloc(globals.socket_buffersize);
-		if (!rv->buffer_in)
+		if ( ! rv->buffer_in)
 			return NULL;
 
 		rv->buffer_out = (unsigned char *) malloc(globals.socket_buffersize);
-		if (!rv->buffer_out)
+		if ( ! rv->buffer_out)
 			return NULL;
-
-		rv->errormsg = NULL;
-		rv->errornumber = 0;
+		
+        rv->errormsg = NULL;
+        rv->errornumber = 0;
 
 		rv->reverse = FALSE;
-	}
-	return rv;
+    } 
+    return rv;
+
 }
 
 void
 SOCK_Destructor(SocketClass *self)
 {
-	if (self->socket != -1)
-	{
+	if (self->socket != -1) {
 		SOCK_put_char(self, 'X');
 		SOCK_flush_output(self);
 		closesocket(self->socket);
@@ -89,34 +89,32 @@ SOCK_Destructor(SocketClass *self)
 		free(self->buffer_out);
 
 	free(self);
+
 }
 
 
-char
+char 
 SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname)
 {
-	struct hostent *host;
-	struct sockaddr_in sadr;
-	unsigned long iaddr;
+struct hostent *host;
+struct sockaddr_in sadr;
+unsigned long iaddr;
 
-	if (self->socket != -1)
-	{
+	if (self->socket != -1) {
 		self->errornumber = SOCKET_ALREADY_CONNECTED;
 		self->errormsg = "Socket is already connected";
 		return 0;
 	}
 
-	memset((char *) &sadr, 0, sizeof(sadr));
+	memset((char *)&sadr, 0, sizeof(sadr));
 
-	/*
-	 * If it is a valid IP address, use it. Otherwise use hostname lookup.
-	 */
+	/*	If it is a valid IP address, use it.
+		Otherwise use hostname lookup. 
+	*/
 	iaddr = inet_addr(hostname);
-	if (iaddr == INADDR_NONE)
-	{
+	if (iaddr == INADDR_NONE) {
 		host = gethostbyname(hostname);
-		if (host == NULL)
-		{
+		if (host == NULL) {
 			self->errornumber = SOCKET_HOST_NOT_FOUND;
 			self->errormsg = "Could not resolve hostname.";
 			return 0;
@@ -124,187 +122,177 @@ SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname)
 		memcpy(&(sadr.sin_addr), host->h_addr, host->h_length);
 	}
 	else
-		memcpy(&(sadr.sin_addr), (struct in_addr *) & iaddr, sizeof(iaddr));
+		memcpy(&(sadr.sin_addr), (struct in_addr *) &iaddr, sizeof(iaddr));
 
 	sadr.sin_family = AF_INET;
 	sadr.sin_port = htons(port);
 
 	self->socket = socket(AF_INET, SOCK_STREAM, 0);
-	if (self->socket == -1)
-	{
+	if (self->socket == -1) {
 		self->errornumber = SOCKET_COULD_NOT_CREATE_SOCKET;
 		self->errormsg = "Could not create Socket.";
 		return 0;
 	}
 
-	if (connect(self->socket, (struct sockaddr *) & (sadr),
-				sizeof(sadr)) < 0)
-	{
+	if ( connect(self->socket, (struct sockaddr *)&(sadr),
+			sizeof(sadr))  < 0) {
+
 		self->errornumber = SOCKET_COULD_NOT_CONNECT;
 		self->errormsg = "Could not connect to remote socket.";
 		closesocket(self->socket);
-		self->socket = (SOCKETFD) - 1;
+		self->socket = (SOCKETFD) -1;
 		return 0;
 	}
 	return 1;
 }
 
 
-void
+void 
 SOCK_get_n_char(SocketClass *self, char *buffer, int len)
 {
-	int			lf;
+int lf;
 
-	if (!buffer)
-	{
+	if ( ! buffer) {
 		self->errornumber = SOCKET_NULLPOINTER_PARAMETER;
 		self->errormsg = "get_n_char was called with NULL-Pointer";
 		return;
 	}
 
-	for (lf = 0; lf < len; lf++)
+	for(lf=0; lf < len; lf++)
 		buffer[lf] = SOCK_get_next_byte(self);
 }
 
 
-void
+void 
 SOCK_put_n_char(SocketClass *self, char *buffer, int len)
 {
-	int			lf;
+int lf;
 
-	if (!buffer)
-	{
+	if ( ! buffer) {
 		self->errornumber = SOCKET_NULLPOINTER_PARAMETER;
 		self->errormsg = "put_n_char was called with NULL-Pointer";
 		return;
 	}
 
-	for (lf = 0; lf < len; lf++)
-		SOCK_put_next_byte(self, (unsigned char) buffer[lf]);
+	for(lf=0; lf < len; lf++)
+		SOCK_put_next_byte(self, (unsigned char)buffer[lf]);
 }
 
 
-/*	bufsize must include room for the null terminator
-	will read at most bufsize-1 characters + null.
+/*  bufsize must include room for the null terminator 
+	will read at most bufsize-1 characters + null. 
 */
-void
+void 
 SOCK_get_string(SocketClass *self, char *buffer, int bufsize)
 {
-	register int lf = 0;
+register int lf = 0;
 
 	for (lf = 0; lf < bufsize; lf++)
-		if (!(buffer[lf] = SOCK_get_next_byte(self)))
+		if ( ! (buffer[lf] = SOCK_get_next_byte(self)))
 			return;
-
-	buffer[bufsize - 1] = '\0';
+		
+	buffer[bufsize-1] = '\0';
 }
 
 
-void
+void 
 SOCK_put_string(SocketClass *self, char *string)
 {
-	register int lf;
-	int			len;
+register int lf;
+int len;
 
-	len = strlen(string) + 1;
+	len = strlen(string)+1;
 
-	for (lf = 0; lf < len; lf++)
-		SOCK_put_next_byte(self, (unsigned char) string[lf]);
+	for(lf = 0; lf < len; lf++)
+		SOCK_put_next_byte(self, (unsigned char)string[lf]);
 }
 
 
-int
+int 
 SOCK_get_int(SocketClass *self, short len)
 {
-	char		buf[4];
-
-	switch (len)
-	{
-		case 2:
-			SOCK_get_n_char(self, buf, len);
-			if (self->reverse)
-				return *((unsigned short *) buf);
-			else
-				return ntohs(*((unsigned short *) buf));
-
-		case 4:
-			SOCK_get_n_char(self, buf, len);
-			if (self->reverse)
-				return *((unsigned int *) buf);
-			else
-				return ntohl(*((unsigned int *) buf));
-
-		default:
-			self->errornumber = SOCKET_GET_INT_WRONG_LENGTH;
-			self->errormsg = "Cannot read ints of that length";
-			return 0;
+char buf[4];
+
+	switch (len) {
+	case 2:
+		SOCK_get_n_char(self, buf, len);
+		if (self->reverse)
+			return *((unsigned short *) buf);
+		else
+			return ntohs( *((unsigned short *) buf) );
+
+	case 4:
+		SOCK_get_n_char(self, buf, len);
+		if (self->reverse)
+			return *((unsigned int *) buf);
+		else
+			return ntohl( *((unsigned int *) buf) );
+
+	default:
+		self->errornumber = SOCKET_GET_INT_WRONG_LENGTH;
+		self->errormsg = "Cannot read ints of that length";
+		return 0;
 	}
 }
 
 
-void
+void 
 SOCK_put_int(SocketClass *self, int value, short len)
 {
-	unsigned int rv;
+unsigned int rv;
 
-	switch (len)
-	{
-		case 2:
-			rv = self->reverse ? value : htons((unsigned short) value);
-			SOCK_put_n_char(self, (char *) &rv, 2);
-			return;
+	switch (len) {
+	case 2:
+		rv = self->reverse ? value : htons( (unsigned short) value);
+		SOCK_put_n_char(self, (char *) &rv, 2);
+		return;
 
-		case 4:
-			rv = self->reverse ? value : htonl((unsigned int) value);
-			SOCK_put_n_char(self, (char *) &rv, 4);
-			return;
+	case 4:
+		rv = self->reverse ? value : htonl( (unsigned int) value);
+		SOCK_put_n_char(self, (char *) &rv, 4);
+		return;
 
-		default:
-			self->errornumber = SOCKET_PUT_INT_WRONG_LENGTH;
-			self->errormsg = "Cannot write ints of that length";
-			return;
-	}
+	default:
+		self->errornumber = SOCKET_PUT_INT_WRONG_LENGTH;
+		self->errormsg = "Cannot write ints of that length";
+		return;
+	 }
 }
 
 
-void
+void 
 SOCK_flush_output(SocketClass *self)
 {
-	int			written;
+int written;
 
-	written = send(self->socket, (char *) self->buffer_out, self->buffer_filled_out, 0);
-	if (written != self->buffer_filled_out)
-	{
+	written = send(self->socket, (char *)self->buffer_out, self->buffer_filled_out, 0);
+	if (written != self->buffer_filled_out) {
 		self->errornumber = SOCKET_WRITE_ERROR;
 		self->errormsg = "Could not flush socket buffer.";
 	}
 	self->buffer_filled_out = 0;
 }
 
-unsigned char
+unsigned char 
 SOCK_get_next_byte(SocketClass *self)
 {
-	if (self->buffer_read_in >= self->buffer_filled_in)
-	{
-		/* there are no more bytes left in the buffer, so */
-		/* reload the buffer */
+
+	if (self->buffer_read_in >= self->buffer_filled_in) {
+		/* there are no more bytes left in the buffer so */
+	  	/* reload the buffer */
 
 		self->buffer_read_in = 0;
-		self->buffer_filled_in = recv(self->socket, (char *) self->buffer_in,
-									  globals.socket_buffersize, 0);
+		self->buffer_filled_in = recv(self->socket, (char *)self->buffer_in, globals.socket_buffersize, 0);
 
-		mylog("read %d, global_socket_buffersize=%d\n",
-			  self->buffer_filled_in, globals.socket_buffersize);
+		mylog("read %d, global_socket_buffersize=%d\n", self->buffer_filled_in, globals.socket_buffersize);
 
-		if (self->buffer_filled_in < 0)
-		{
+		if (self->buffer_filled_in < 0) {
 			self->errornumber = SOCKET_READ_ERROR;
 			self->errormsg = "Error while reading from the socket.";
 			self->buffer_filled_in = 0;
 			return 0;
 		}
-		if (self->buffer_filled_in == 0)
-		{
+		if (self->buffer_filled_in == 0) {
 			self->errornumber = SOCKET_CLOSED;
 			self->errormsg = "Socket has been closed.";
 			self->buffer_filled_in = 0;
@@ -314,19 +302,17 @@ SOCK_get_next_byte(SocketClass *self)
 	return self->buffer_in[self->buffer_read_in++];
 }
 
-void
+void 
 SOCK_put_next_byte(SocketClass *self, unsigned char next_byte)
 {
-	int			bytes_sent;
+int bytes_sent;
 
 	self->buffer_out[self->buffer_filled_out++] = next_byte;
 
-	if (self->buffer_filled_out == globals.socket_buffersize)
-	{
+	if (self->buffer_filled_out == globals.socket_buffersize) {
 		/* buffer is full, so write it out */
-		bytes_sent = send(self->socket, (char *) self->buffer_out, globals.socket_buffersize, 0);
-		if (bytes_sent != globals.socket_buffersize)
-		{
+		bytes_sent = send(self->socket, (char *)self->buffer_out, globals.socket_buffersize, 0);
+		if (bytes_sent != globals.socket_buffersize) {
 			self->errornumber = SOCKET_WRITE_ERROR;
 			self->errormsg = "Error while writing to the socket.";
 		}
diff --git a/src/interfaces/odbc/socket.h b/src/interfaces/odbc/socket.h
index f9e98eb60fe893d553ccf43da60533bbdeff0a77..0b4b9101d6fa483b19a54e6e80f0048e572fa102 100644
--- a/src/interfaces/odbc/socket.h
+++ b/src/interfaces/odbc/socket.h
@@ -1,9 +1,9 @@
 
-/* File:			socket.h
+/* File:            socket.h
  *
- * Description:		See "socket.c"
+ * Description:     See "socket.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -25,11 +25,10 @@
 #define closesocket(xxx) close(xxx)
 #define SOCKETFD int
 
-#ifndef INADDR_NONE
+#ifndef       INADDR_NONE
 #ifndef _IN_ADDR_T
 #define _IN_ADDR_T
-typedef unsigned int in_addr_t;
-
+typedef unsigned int    in_addr_t;
 #endif
 #define INADDR_NONE ((in_addr_t)-1)
 #endif
@@ -41,34 +40,32 @@ typedef unsigned int in_addr_t;
 
 #include "psqlodbc.h"
 
-#define SOCKET_ALREADY_CONNECTED		1
-#define SOCKET_HOST_NOT_FOUND			2
-#define SOCKET_COULD_NOT_CREATE_SOCKET	3
-#define SOCKET_COULD_NOT_CONNECT		4
-#define SOCKET_READ_ERROR				5
-#define SOCKET_WRITE_ERROR				6
-#define SOCKET_NULLPOINTER_PARAMETER	7
-#define SOCKET_PUT_INT_WRONG_LENGTH		8
-#define SOCKET_GET_INT_WRONG_LENGTH		9
-#define SOCKET_CLOSED					10
+#define SOCKET_ALREADY_CONNECTED 1
+#define SOCKET_HOST_NOT_FOUND 2
+#define SOCKET_COULD_NOT_CREATE_SOCKET 3
+#define SOCKET_COULD_NOT_CONNECT 4
+#define SOCKET_READ_ERROR 5
+#define SOCKET_WRITE_ERROR 6
+#define SOCKET_NULLPOINTER_PARAMETER 7
+#define SOCKET_PUT_INT_WRONG_LENGTH 8
+#define SOCKET_GET_INT_WRONG_LENGTH 9
+#define SOCKET_CLOSED 10
 
 
-struct SocketClass_
-{
+struct SocketClass_ {
 
-	int			buffer_filled_in;
-	int			buffer_filled_out;
-	int			buffer_read_in;
+	int buffer_filled_in;
+	int buffer_filled_out;
+	int buffer_read_in;
 	unsigned char *buffer_in;
 	unsigned char *buffer_out;
 
-	SOCKETFD	socket;
+	SOCKETFD socket;
 
-	char	   *errormsg;
-	int			errornumber;
+	char *errormsg;
+	int errornumber;
 
-	char		reverse;		/* used to handle Postgres 6.2 protocol
-								 * (reverse byte order) */
+	char reverse;	/* used to handle Postgres 6.2 protocol (reverse byte order) */
 
 };
 
@@ -83,17 +80,17 @@ struct SocketClass_
 
 /* Socket prototypes */
 SocketClass *SOCK_Constructor(void);
-void		SOCK_Destructor(SocketClass *self);
-char		SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname);
-void		SOCK_get_n_char(SocketClass *self, char *buffer, int len);
-void		SOCK_put_n_char(SocketClass *self, char *buffer, int len);
-void		SOCK_get_string(SocketClass *self, char *buffer, int bufsize);
-void		SOCK_put_string(SocketClass *self, char *string);
-int			SOCK_get_int(SocketClass *self, short len);
-void		SOCK_put_int(SocketClass *self, int value, short len);
-void		SOCK_flush_output(SocketClass *self);
+void SOCK_Destructor(SocketClass *self);
+char SOCK_connect_to(SocketClass *self, unsigned short port, char *hostname);
+void SOCK_get_n_char(SocketClass *self, char *buffer, int len);
+void SOCK_put_n_char(SocketClass *self, char *buffer, int len);
+void SOCK_get_string(SocketClass *self, char *buffer, int bufsize);
+void SOCK_put_string(SocketClass *self, char *string);
+int SOCK_get_int(SocketClass *self, short len);
+void SOCK_put_int(SocketClass *self, int value, short len);
+void SOCK_flush_output(SocketClass *self);
 unsigned char SOCK_get_next_byte(SocketClass *self);
-void		SOCK_put_next_byte(SocketClass *self, unsigned char next_byte);
-void		SOCK_clear_error(SocketClass *self);
+void SOCK_put_next_byte(SocketClass *self, unsigned char next_byte);
+void SOCK_clear_error(SocketClass *self);
 
 #endif
diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c
index d730e1b6401f598877d2d3915b7505b25ec25c22..06d97f7457e99f97a991e45bd883900b440995f3 100644
--- a/src/interfaces/odbc/statement.c
+++ b/src/interfaces/odbc/statement.c
@@ -1,13 +1,14 @@
-/* Module:			statement.c
+
+/* Module:          statement.c
  *
- * Description:		This module contains functions related to creating
- *					and manipulating a statement.
+ * Description:     This module contains functions related to creating
+ *                  and manipulating a statement.
  *
- * Classes:			StatementClass (Functions prefix: "SC_")
+ * Classes:         StatementClass (Functions prefix: "SC_")
  *
- * API functions:	SQLAllocStmt, SQLFreeStmt
+ * API functions:   SQLAllocStmt, SQLFreeStmt
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -38,65 +39,40 @@ extern GLOBAL_VALUES globals;
 
 #ifndef WIN32
 #ifndef HAVE_STRICMP
-#define stricmp(s1,s2)		strcasecmp(s1,s2)
+#define stricmp(s1,s2) 		strcasecmp(s1,s2)
 #define strnicmp(s1,s2,n)	strncasecmp(s1,s2,n)
 #endif
 #endif
 #define PRN_NULLCHECK
 
 /*	Map sql commands to statement types */
-static struct
-{
-	int			type;
-	char	   *s;
-}			Statement_Type[] =
-
-{
-	{
-		STMT_TYPE_SELECT, "SELECT"
-	},
-	{
-		STMT_TYPE_INSERT, "INSERT"
-	},
-	{
-		STMT_TYPE_UPDATE, "UPDATE"
-	},
-	{
-		STMT_TYPE_DELETE, "DELETE"
-	},
-	{
-		STMT_TYPE_CREATE, "CREATE"
-	},
-	{
-		STMT_TYPE_ALTER, "ALTER"
-	},
-	{
-		STMT_TYPE_DROP, "DROP"
-	},
-	{
-		STMT_TYPE_GRANT, "GRANT"
-	},
-	{
-		STMT_TYPE_REVOKE, "REVOKE"
-	},
-	{
-		0, NULL
-	}
+static struct {
+	int  type;
+	char *s;
+} Statement_Type[] = {
+	{ STMT_TYPE_SELECT, "SELECT" },
+	{ STMT_TYPE_INSERT, "INSERT" },
+	{ STMT_TYPE_UPDATE, "UPDATE" },
+	{ STMT_TYPE_DELETE, "DELETE" },
+	{ STMT_TYPE_CREATE, "CREATE" },
+	{ STMT_TYPE_ALTER,  "ALTER"  },
+	{ STMT_TYPE_DROP,   "DROP"   },
+	{ STMT_TYPE_GRANT,  "GRANT"  },
+	{ STMT_TYPE_REVOKE, "REVOKE" },
+	{      0,            NULL    }
 };
 
 
-RETCODE SQL_API
-SQLAllocStmt(HDBC hdbc,
-			 HSTMT FAR *phstmt)
+RETCODE SQL_API SQLAllocStmt(HDBC      hdbc,
+			     HSTMT FAR *phstmt)
 {
-	static char *func = "SQLAllocStmt";
-	ConnectionClass *conn = (ConnectionClass *) hdbc;
-	StatementClass *stmt;
+static char *func="SQLAllocStmt";
+ConnectionClass *conn = (ConnectionClass *) hdbc;
+StatementClass *stmt;
 
 	mylog("%s: entering...\n", func);
 
-	if (!conn)
-	{
+	if( ! conn) {
 		CC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
@@ -105,8 +81,7 @@ SQLAllocStmt(HDBC hdbc,
 
 	mylog("**** SQLAllocStmt: hdbc = %u, stmt = %u\n", hdbc, stmt);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		conn->errornumber = CONN_STMT_ALLOC_ERROR;
 		conn->errormsg = "No more memory to allocate a further SQL-statement";
 		*phstmt = SQL_NULL_HSTMT;
@@ -114,65 +89,56 @@ SQLAllocStmt(HDBC hdbc,
 		return SQL_ERROR;
 	}
 
-	if (!CC_add_statement(conn, stmt))
-	{
-		conn->errormsg = "Maximum number of connections exceeded.";
-		conn->errornumber = CONN_STMT_ALLOC_ERROR;
+    if ( ! CC_add_statement(conn, stmt)) {
+	conn->errormsg = "Maximum number of connections exceeded.";
+	conn->errornumber = CONN_STMT_ALLOC_ERROR;
 		CC_log_error(func, "", conn);
-		SC_Destructor(stmt);
+	SC_Destructor(stmt);
 		*phstmt = SQL_NULL_HSTMT;
-		return SQL_ERROR;
-	}
+	return SQL_ERROR;
+    }
 
 	*phstmt = (HSTMT) stmt;
 
-	/*
-	 * Copy default statement options based from Connection options
-	 */
+	/*	Copy default statement options based from Connection options
+	*/
 	stmt->options = conn->stmtOptions;
 
 
-	/* Save the handle for later */
+	/*	Save the handle for later */
 	stmt->phstmt = phstmt;
 
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
 
-RETCODE SQL_API
-SQLFreeStmt(HSTMT hstmt,
-			UWORD fOption)
+RETCODE SQL_API SQLFreeStmt(HSTMT     hstmt,
+			    UWORD     fOption)
 {
-	static char *func = "SQLFreeStmt";
-	StatementClass *stmt = (StatementClass *) hstmt;
+static char *func="SQLFreeStmt";
+StatementClass *stmt = (StatementClass *) hstmt;
 
 	mylog("%s: entering...hstmt=%u, fOption=%d\n", func, hstmt, fOption);
 
-	if (!stmt)
-	{
+	if ( ! stmt) {
 		SC_log_error(func, "", NULL);
 		return SQL_INVALID_HANDLE;
 	}
 
-	if (fOption == SQL_DROP)
-	{
+	if (fOption == SQL_DROP) {
 		ConnectionClass *conn = stmt->hdbc;
 
 		/* Remove the statement from the connection's statement list */
-		if (conn)
-		{
-			if (!CC_remove_statement(conn, stmt))
-			{
+		if ( conn) {
+			if ( ! CC_remove_statement(conn, stmt)) {
 				stmt->errornumber = STMT_SEQUENCE_ERROR;
 				stmt->errormsg = "Statement is currently executing a transaction.";
 				SC_log_error(func, "", stmt);
-				return SQL_ERROR;		/* stmt may be executing a
-										 * transaction */
+				return SQL_ERROR;  /* stmt may be executing a transaction */
 			}
 
-			/* Free any cursors and discard any result info */
-			if (stmt->result)
-			{
+			/*	Free any cursors and discard any result info */
+			if (stmt->result) {
 				QR_Destructor(stmt->result);
 				stmt->result = NULL;
 			}
@@ -180,31 +146,30 @@ SQLFreeStmt(HSTMT hstmt,
 
 		/* Destroy the statement and free any results, cursors, etc. */
 		SC_Destructor(stmt);
-	}
-	else if (fOption == SQL_UNBIND)
+
+    } else if (fOption == SQL_UNBIND) {
 		SC_unbind_cols(stmt);
-	else if (fOption == SQL_CLOSE)
-	{
+
+    } else if (fOption == SQL_CLOSE) {
 		/* this should discard all the results, but leave the statement */
 		/* itself in place (it can be executed again) */
-		if (!SC_recycle_statement(stmt))
-		{
-			/* errormsg passed in above */
+	if (!SC_recycle_statement(stmt)) {
+		/*	errormsg passed in above */
 			SC_log_error(func, "", stmt);
-			return SQL_ERROR;
+	    return SQL_ERROR;
 		}
-	}
-	else if (fOption == SQL_RESET_PARAMS)
+
+    } else if(fOption == SQL_RESET_PARAMS) {
 		SC_free_params(stmt, STMT_FREE_PARAMS_ALL);
-	else
-	{
-		stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
-		stmt->errornumber = STMT_OPTION_OUT_OF_RANGE_ERROR;
+
+    } else {
+	stmt->errormsg = "Invalid option passed to SQLFreeStmt.";
+	stmt->errornumber = STMT_OPTION_OUT_OF_RANGE_ERROR;
 		SC_log_error(func, "", stmt);
-		return SQL_ERROR;
-	}
+	return SQL_ERROR;
+    }
 
-	return SQL_SUCCESS;
+    return SQL_SUCCESS;
 }
 
 
@@ -229,12 +194,11 @@ InitializeStatementOptions(StatementOptions *opt)
 StatementClass *
 SC_Constructor(void)
 {
-	StatementClass *rv;
+StatementClass *rv;
 
 	rv = (StatementClass *) malloc(sizeof(StatementClass));
-	if (rv)
-	{
-		rv->hdbc = NULL;		/* no connection associated yet */
+	if (rv) {
+		rv->hdbc = NULL;       /* no connection associated yet */
 		rv->phstmt = NULL;
 		rv->result = NULL;
 		rv->manual_result = FALSE;
@@ -273,7 +237,7 @@ SC_Constructor(void)
 		rv->lobj_fd = -1;
 		rv->cursor_name[0] = '\0';
 
-		/* Parse Stuff */
+		/*	Parse Stuff */
 		rv->ti = NULL;
 		rv->fi = NULL;
 		rv->ntab = 0;
@@ -281,7 +245,7 @@ SC_Constructor(void)
 		rv->parse_status = STMT_PARSE_NONE;
 
 
-		/* Clear Statement Options -- defaults will be set in AllocStmt */
+		/*  Clear Statement Options -- defaults will be set in AllocStmt */
 		memset(&rv->options, 0, sizeof(StatementOptions));
 	}
 	return rv;
@@ -290,18 +254,17 @@ SC_Constructor(void)
 char
 SC_Destructor(StatementClass *self)
 {
+
 	mylog("SC_Destructor: self=%u, self->result=%u, self->hdbc=%u\n", self, self->result, self->hdbc);
-	if (STMT_EXECUTING == self->status)
-	{
+	if (STMT_EXECUTING == self->status) {
 		self->errornumber = STMT_SEQUENCE_ERROR;
 		self->errormsg = "Statement is currently executing a transaction.";
 		return FALSE;
 	}
 
-	if (self->result)
-	{
-		if (!self->hdbc)
-			self->result->conn = NULL;	/* prevent any dbase activity */
+	if (self->result) {
+		if ( ! self->hdbc)
+			self->result->conn = NULL;  /* prevent any dbase activity */
 
 		QR_Destructor(self->result);
 	}
@@ -311,38 +274,29 @@ SC_Destructor(StatementClass *self)
 
 	SC_free_params(self, STMT_FREE_PARAMS_ALL);
 
-	/*
-	 * the memory pointed to by the bindings is not deallocated by the
-	 * driver
-	 */
-
-	/*
-	 * by by the application that uses that driver, so we don't have to
-	 * care
-	 */
+	/* the memory pointed to by the bindings is not deallocated by the driver */
+	/* by by the application that uses that driver, so we don't have to care  */
 	/* about that here. */
 	if (self->bindings)
 		free(self->bindings);
 
 
-	/* Free the parsed table information */
-	if (self->ti)
-	{
-		int			i;
-
-		for (i = 0; i < self->ntab; i++)
+	/*	Free the parsed table information */
+	if (self->ti) {
+		int i;
+		for (i = 0; i < self->ntab; i++) {
 			free(self->ti[i]);
+		}
 
 		free(self->ti);
 	}
 
-	/* Free the parsed field information */
-	if (self->fi)
-	{
-		int			i;
-
-		for (i = 0; i < self->nfld; i++)
+	/*	Free the parsed field information */
+	if (self->fi) {
+		int i;
+		for (i = 0; i < self->nfld; i++) {
 			free(self->fi[i]);
+		}
 		free(self->fi);
 	}
 
@@ -360,25 +314,22 @@ SC_Destructor(StatementClass *self)
 void
 SC_free_params(StatementClass *self, char option)
 {
-	int			i;
+int i;
 
 	mylog("SC_free_params:  ENTER, self=%d\n", self);
 
-	if (!self->parameters)
+	if( ! self->parameters)
 		return;
 
-	for (i = 0; i < self->parameters_allocated; i++)
-	{
-		if (self->parameters[i].data_at_exec == TRUE)
-		{
-			if (self->parameters[i].EXEC_used)
-			{
+	for (i = 0; i < self->parameters_allocated; i++) {
+		if (self->parameters[i].data_at_exec == TRUE) {
+
+			if (self->parameters[i].EXEC_used) {
 				free(self->parameters[i].EXEC_used);
 				self->parameters[i].EXEC_used = NULL;
 			}
 
-			if (self->parameters[i].EXEC_buffer)
-			{
+			if (self->parameters[i].EXEC_buffer) {
 				if (self->parameters[i].SQLType != SQL_LONGVARBINARY)
 					free(self->parameters[i].EXEC_buffer);
 				self->parameters[i].EXEC_buffer = NULL;
@@ -389,8 +340,7 @@ SC_free_params(StatementClass *self, char option)
 	self->current_exec_param = -1;
 	self->put_data = FALSE;
 
-	if (option == STMT_FREE_PARAMS_ALL)
-	{
+	if (option == STMT_FREE_PARAMS_ALL) {
 		free(self->parameters);
 		self->parameters = NULL;
 		self->parameters_allocated = 0;
@@ -403,14 +353,14 @@ SC_free_params(StatementClass *self, char option)
 int
 statement_type(char *statement)
 {
-	int			i;
+int i;
 
 	/* ignore leading whitespace in query string */
 	while (*statement && isspace((unsigned char) *statement))
 		statement++;
 
 	for (i = 0; Statement_Type[i].s; i++)
-		if (!strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
+		if ( ! strnicmp(statement, Statement_Type[i].s, strlen(Statement_Type[i].s)))
 			return Statement_Type[i].type;
 
 	return STMT_TYPE_OTHER;
@@ -424,13 +374,12 @@ statement_type(char *statement)
 char
 SC_recycle_statement(StatementClass *self)
 {
-	ConnectionClass *conn;
+ConnectionClass *conn;
 
-	mylog("recycle statement: self= %u\n", self);
+mylog("recycle statement: self= %u\n", self);
 
-	/* This would not happen */
-	if (self->status == STMT_EXECUTING)
-	{
+	/*	This would not happen */
+	if (self->status == STMT_EXECUTING) {
 		self->errornumber = STMT_SEQUENCE_ERROR;
 		self->errormsg = "Statement is currently executing a transaction.";
 		return FALSE;
@@ -440,78 +389,71 @@ SC_recycle_statement(StatementClass *self)
 	self->errornumber = 0;
 	self->errormsg_created = FALSE;
 
-	switch (self->status)
-	{
-		case STMT_ALLOCATED:
-			/* this statement does not need to be recycled */
-			return TRUE;
-
-		case STMT_READY:
-			break;
-
-		case STMT_PREMATURE:
-
-			/*
-			 * Premature execution of the statement might have caused the
-			 * start of a transaction. If so, we have to rollback that
-			 * transaction.
-			 */
-			conn = SC_get_conn(self);
-			if (!CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
-			{
-				CC_send_query(conn, "ABORT", NULL);
-				CC_set_no_trans(conn);
-			}
-			break;
+	switch (self->status) {
+	case STMT_ALLOCATED:
+		/* this statement does not need to be recycled */
+		return TRUE;
 
-		case STMT_FINISHED:
-			break;
+	case STMT_READY:
+		break;
 
-		default:
-			self->errormsg = "An internal error occured while recycling statements";
-			self->errornumber = STMT_INTERNAL_ERROR;
-			return FALSE;
-	}
+	case STMT_PREMATURE:
+		/*	Premature execution of the statement might have caused the start of a transaction.
+			If so, we have to rollback that transaction.
+		*/
+		conn = SC_get_conn(self);
+		if ( ! CC_is_in_autocommit(conn) && CC_is_in_trans(conn)) {
+
+			CC_send_query(conn, "ABORT", NULL);
+			CC_set_no_trans(conn);
+		}
+		break;
+
+	case STMT_FINISHED:
+		break;
 
-	/* Free the parsed table information */
-	if (self->ti)
-	{
-		int			i;
+	default:
+		self->errormsg = "An internal error occured while recycling statements";
+		self->errornumber = STMT_INTERNAL_ERROR;
+		return FALSE;
+	}
 
-		for (i = 0; i < self->ntab; i++)
+	/*	Free the parsed table information */
+	if (self->ti) {
+		int i;
+		for (i = 0; i < self->ntab; i++) {
 			free(self->ti[i]);
+		}
 
 		free(self->ti);
 		self->ti = NULL;
 		self->ntab = 0;
 	}
 
-	/* Free the parsed field information */
-	if (self->fi)
-	{
-		int			i;
-
-		for (i = 0; i < self->nfld; i++)
+	/*	Free the parsed field information */
+	if (self->fi) {
+		int i;
+		for (i = 0; i < self->nfld; i++) {
 			free(self->fi[i]);
+		}
 		free(self->fi);
 		self->fi = NULL;
 		self->nfld = 0;
 	}
 	self->parse_status = STMT_PARSE_NONE;
 
-	/* Free any cursors */
-	if (self->result)
-	{
+	/*	Free any cursors */
+	if (self->result) {
 		QR_Destructor(self->result);
 		self->result = NULL;
 	}
 
 	/****************************************************************/
-	/* Reset only parameters that have anything to do with results */
+	/*	Reset only parameters that have anything to do with results */
 	/****************************************************************/
 
 	self->status = STMT_READY;
-	self->manual_result = FALSE;/* very important */
+	self->manual_result = FALSE;	/* very important */
 
 	self->currTuple = -1;
 	self->rowset_start = -1;
@@ -525,9 +467,9 @@ SC_recycle_statement(StatementClass *self)
 
 	self->lobj_fd = -1;
 
-	/* Free any data at exec params before the statement is executed */
-	/* again.  If not, then there will be a memory leak when */
-	/* the next SQLParamData/SQLPutData is called. */
+	/*	Free any data at exec params before the statement is executed */
+	/*	again.  If not, then there will be a memory leak when */
+	/*	the next SQLParamData/SQLPutData is called. */
 	SC_free_params(self, STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY);
 
 	return TRUE;
@@ -537,16 +479,15 @@ SC_recycle_statement(StatementClass *self)
 void
 SC_pre_execute(StatementClass *self)
 {
+
 	mylog("SC_pre_execute: status = %d\n", self->status);
 
-	if (self->status == STMT_READY)
-	{
+	if (self->status == STMT_READY) {
 		mylog("              preprocess: status = READY\n");
 
 		SQLExecute(self);
 
-		if (self->status == STMT_FINISHED)
-		{
+		if (self->status == STMT_FINISHED) {
 			mylog("              preprocess: after status = FINISHED, so set PREMATURE\n");
 			self->status = STMT_PREMATURE;
 		}
@@ -557,10 +498,9 @@ SC_pre_execute(StatementClass *self)
 char
 SC_unbind_cols(StatementClass *self)
 {
-	Int2		lf;
+Int2 lf;
 
-	for (lf = 0; lf < self->bindings_allocated; lf++)
-	{
+	for(lf = 0; lf < self->bindings_allocated; lf++) {
 		self->bindings[lf].data_left = -1;
 		self->bindings[lf].buflen = 0;
 		self->bindings[lf].buffer = NULL;
@@ -571,7 +511,7 @@ SC_unbind_cols(StatementClass *self)
 	self->bookmark.buffer = NULL;
 	self->bookmark.used = NULL;
 
-	return 1;
+    return 1;
 }
 
 void
@@ -588,10 +528,10 @@ SC_clear_error(StatementClass *self)
 char *
 SC_create_errormsg(StatementClass *self)
 {
-	QResultClass *res = self->result;
-	ConnectionClass *conn = self->hdbc;
-	int			pos;
-	static char msg[4096];
+QResultClass *res = self->result;
+ConnectionClass *conn = self->hdbc;
+int pos;
+static char msg[4096];
 
 	msg[0] = '\0';
 
@@ -601,18 +541,15 @@ SC_create_errormsg(StatementClass *self)
 	else if (self->errormsg)
 		strcpy(msg, self->errormsg);
 
-	if (conn)
-	{
+	if (conn) {
 		SocketClass *sock = conn->sock;
 
-		if (conn->errormsg && conn->errormsg[0] != '\0')
-		{
+		if (conn->errormsg && conn->errormsg[0] != '\0') {
 			pos = strlen(msg);
 			sprintf(&msg[pos], ";\n%s", conn->errormsg);
 		}
 
-		if (sock && sock->errormsg && sock->errormsg[0] != '\0')
-		{
+		if (sock && sock->errormsg && sock->errormsg[0] != '\0') {
 			pos = strlen(msg);
 			sprintf(&msg[pos], ";\n%s", sock->errormsg);
 		}
@@ -624,17 +561,15 @@ SC_create_errormsg(StatementClass *self)
 char
 SC_get_error(StatementClass *self, int *number, char **message)
 {
-	char		rv;
+char rv;
 
 /*	Create a very informative errormsg if it hasn't been done yet. */
-	if (!self->errormsg_created)
-	{
+	if ( ! self->errormsg_created) {
 		self->errormsg = SC_create_errormsg(self);
 		self->errormsg_created = TRUE;
 	}
 
-	if (self->errornumber)
-	{
+	if ( self->errornumber) {
 		*number = self->errornumber;
 		*message = self->errormsg;
 		self->errormsg = NULL;
@@ -659,33 +594,28 @@ SC_get_bookmark(StatementClass *self)
 RETCODE
 SC_fetch(StatementClass *self)
 {
-	static char *func = "SC_fetch";
-	QResultClass *res = self->result;
-	int			retval,
-				result;
-	Int2		num_cols,
-				lf;
-	Oid			type;
-	char	   *value;
-	ColumnInfoClass *ci;
-
+static char *func = "SC_fetch";
+QResultClass *res = self->result;
+int retval, result;
+Int2 num_cols, lf;
+Oid type;
+char *value;
+ColumnInfoClass *ci;
 /* TupleField *tupleField; */
 
 	self->last_fetch_count = 0;
-	ci = QR_get_fields(res);	/* the column info */
+	ci = QR_get_fields(res);		/* the column info */
 
 	mylog("manual_result = %d, use_declarefetch = %d\n", self->manual_result, globals.use_declarefetch);
 
-	if (self->manual_result || !globals.use_declarefetch)
-	{
-		if (self->currTuple >= QR_get_num_tuples(res) - 1 ||
-			(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1))
-		{
+	if ( self->manual_result || ! globals.use_declarefetch) {
+
+		if (self->currTuple >= QR_get_num_tuples(res) -1 ||
+			(self->options.maxRows > 0 && self->currTuple == self->options.maxRows - 1)) {
 
-			/*
-			 * if at the end of the tuples, return "no data found" and set
-			 * the cursor past the end of the result set
-			 */
+			/*	if at the end of the tuples, return "no data found"
+				and set the cursor past the end of the result set
+			*/
 			self->currTuple = QR_get_num_tuples(res);
 			return SQL_NO_DATA_FOUND;
 		}
@@ -693,20 +623,18 @@ SC_fetch(StatementClass *self)
 		mylog("**** SQLFetch: manual_result\n");
 		(self->currTuple)++;
 	}
-	else
-	{
+	else {
+
 		/* read from the cache or the physical next tuple */
 		retval = QR_next_tuple(res);
-		if (retval < 0)
-		{
+		if (retval < 0) {
 			mylog("**** SQLFetch: end_tuples\n");
 			return SQL_NO_DATA_FOUND;
 		}
 		else if (retval > 0)
-			(self->currTuple)++;/* all is well */
+			(self->currTuple)++;		/* all is well */
 
-		else
-		{
+		else {
 			mylog("SQLFetch: error\n");
 			self->errornumber = STMT_EXEC_ERROR;
 			self->errormsg = "Error fetching next row";
@@ -720,94 +648,89 @@ SC_fetch(StatementClass *self)
 	result = SQL_SUCCESS;
 	self->last_fetch_count = 1;
 
-	/*
-	 * If the bookmark column was bound then return a bookmark. Since this
-	 * is used with SQLExtendedFetch, and the rowset size may be greater
-	 * than 1, and an application can use row or column wise binding, use
-	 * the code in copy_and_convert_field() to handle that.
-	 */
-	if (self->bookmark.buffer)
-	{
-		char		buf[32];
+	/*	If the bookmark column was bound then return a bookmark.
+		Since this is used with SQLExtendedFetch, and the rowset size
+		may be greater than 1, and an application can use row or column wise
+		binding, use the code in copy_and_convert_field() to handle that.
+	*/
+	if (self->bookmark.buffer) {
+		char buf[32];
 
 		sprintf(buf, "%ld", SC_get_bookmark(self));
 		result = copy_and_convert_field(self, 0, buf,
-			 SQL_C_ULONG, self->bookmark.buffer, 0, self->bookmark.used);
+								SQL_C_ULONG, self->bookmark.buffer, 0, self->bookmark.used);
 	}
 
-	for (lf = 0; lf < num_cols; lf++)
-	{
+	for (lf=0; lf < num_cols; lf++) {
+
 		mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer);
 
-		/* reset for SQLGetData */
+		/*	reset for SQLGetData */
 		self->bindings[lf].data_left = -1;
 
-		if (self->bindings[lf].buffer != NULL)
-		{
+		if (self->bindings[lf].buffer != NULL) {
 			/* this column has a binding */
 
 			/* type = QR_get_field_type(res, lf); */
-			type = CI_get_oid(ci, lf);	/* speed things up */
+			type = CI_get_oid(ci, lf);		/* speed things up */
 
 			mylog("type = %d\n", type);
 
-			if (self->manual_result)
-			{
+			if (self->manual_result) {
 				value = QR_get_value_manual(res, self->currTuple, lf);
 				mylog("manual_result\n");
 			}
 			else if (globals.use_declarefetch)
 				value = QR_get_value_backend(res, lf);
-			else
+			else {
 				value = QR_get_value_backend_row(res, self->currTuple, lf);
+			}
 
-			mylog("value = '%s'\n", (value == NULL) ? "<NULL>" : value);
+			mylog("value = '%s'\n",  (value==NULL)?"<NULL>":value);
 
 			retval = copy_and_convert_field_bindinfo(self, type, value, lf);
 
 			mylog("copy_and_convert: retval = %d\n", retval);
 
-			switch (retval)
-			{
-				case COPY_OK:
-					break;		/* OK, do next bound column */
-
-				case COPY_UNSUPPORTED_TYPE:
-					self->errormsg = "Received an unsupported type from Postgres.";
-					self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-					SC_log_error(func, "", self);
-					result = SQL_ERROR;
-					break;
-
-				case COPY_UNSUPPORTED_CONVERSION:
-					self->errormsg = "Couldn't handle the necessary data type conversion.";
-					self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
-					SC_log_error(func, "", self);
-					result = SQL_ERROR;
-					break;
-
-				case COPY_RESULT_TRUNCATED:
-					self->errornumber = STMT_TRUNCATED;
-					self->errormsg = "The buffer was too small for the result.";
-					result = SQL_SUCCESS_WITH_INFO;
-					break;
-
-				case COPY_GENERAL_ERROR:		/* error msg already
-												 * filled in */
-					SC_log_error(func, "", self);
-					result = SQL_ERROR;
-					break;
-
-					/* This would not be meaningful in SQLFetch. */
-				case COPY_NO_DATA_FOUND:
-					break;
-
-				default:
-					self->errormsg = "Unrecognized return value from copy_and_convert_field.";
-					self->errornumber = STMT_INTERNAL_ERROR;
-					SC_log_error(func, "", self);
-					result = SQL_ERROR;
-					break;
+			switch(retval) {
+			case COPY_OK:
+				break;	/*	OK, do next bound column */
+
+			case COPY_UNSUPPORTED_TYPE:
+				self->errormsg = "Received an unsupported type from Postgres.";
+				self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+				SC_log_error(func, "", self);
+				result = SQL_ERROR;
+				break;
+
+			case COPY_UNSUPPORTED_CONVERSION:
+				self->errormsg = "Couldn't handle the necessary data type conversion.";
+				self->errornumber = STMT_RESTRICTED_DATA_TYPE_ERROR;
+				SC_log_error(func, "", self);
+				result = SQL_ERROR;
+				break;
+
+			case COPY_RESULT_TRUNCATED:
+				self->errornumber = STMT_TRUNCATED;
+				self->errormsg = "The buffer was too small for the result.";
+				result = SQL_SUCCESS_WITH_INFO;
+				break;
+
+			case COPY_GENERAL_ERROR:	/* error msg already filled in */
+				SC_log_error(func, "", self);
+				result = SQL_ERROR;
+				break;
+
+			/*  This would not be meaningful in SQLFetch. */
+			case COPY_NO_DATA_FOUND:
+				break;
+
+			default:
+				self->errormsg = "Unrecognized return value from copy_and_convert_field.";
+				self->errornumber = STMT_INTERNAL_ERROR;
+				SC_log_error(func, "", self);
+				result = SQL_ERROR;
+				break;
 			}
 		}
 	}
@@ -816,39 +739,35 @@ SC_fetch(StatementClass *self)
 }
 
 
-RETCODE
-SC_execute(StatementClass *self)
+RETCODE SC_execute(StatementClass *self)
 {
-	static char *func = "SC_execute";
-	ConnectionClass *conn;
-	QResultClass *res;
-	char		ok,
-				was_ok,
-				was_nonfatal;
-	Int2		oldstatus,
-				numcols;
-	QueryInfo	qi;
+static char *func="SC_execute";
+ConnectionClass *conn;
+QResultClass *res;
+char ok, was_ok, was_nonfatal;
+Int2 oldstatus, numcols;
+QueryInfo qi;
 
 
 	conn = SC_get_conn(self);
 
-	/* Begin a transaction if one is not already in progress */
-
+	/*	Begin a transaction if one is not already in progress */
 	/*
-	 * Basically we don't have to begin a transaction in autocommit mode
-	 * because Postgres backend runs in autocomit mode. We issue "BEGIN"
-	 * in the following cases. 1) we use declare/fetch and the statement
-	 * is SELECT (because declare/fetch must be called in a transaction).
-	 * 2) we are not in autocommit state and the statement is of type
-	 * UPDATE.
-	 */
-	if (!self->internal && !CC_is_in_trans(conn) &&
-		((globals.use_declarefetch && self->statement_type == STMT_TYPE_SELECT) || (!CC_is_in_autocommit(conn) && STMT_UPDATE(self))))
-	{
+		Basically we don't have to begin a transaction in
+		autocommit mode because Postgres backend runs in
+		autocomit mode.  
+		We issue "BEGIN" in the following cases.
+		1) we use declare/fetch and the statement is SELECT
+		   (because declare/fetch must be called in a transaction).
+		2) we are not in autocommit state and the statement
+		   is of type UPDATE.
+	*/ 
+	if ( ! self->internal && ! CC_is_in_trans(conn) &&
+	    ((globals.use_declarefetch && self->statement_type == STMT_TYPE_SELECT) || (! CC_is_in_autocommit(conn) && STMT_UPDATE(self)))) {
+
 		mylog("   about to begin a transaction on statement = %u\n", self);
 		res = CC_send_query(conn, "BEGIN", NULL);
-		if (!res)
-		{
+		if ( ! res) {
 			self->errormsg = "Could not begin a transaction";
 			self->errornumber = STMT_EXEC_ERROR;
 			SC_log_error(func, "", self);
@@ -861,8 +780,7 @@ SC_execute(StatementClass *self)
 
 		QR_Destructor(res);
 
-		if (!ok)
-		{
+		if (!ok) {
 			self->errormsg = "Could not begin a transaction";
 			self->errornumber = STMT_EXEC_ERROR;
 			SC_log_error(func, "", self);
@@ -872,94 +790,85 @@ SC_execute(StatementClass *self)
 			CC_set_in_trans(conn);
 	}
 
+
+
 	oldstatus = conn->status;
 	conn->status = CONN_EXECUTING;
 	self->status = STMT_EXECUTING;
 
 
-	/* If it's a SELECT statement, use a cursor. */
+	/*	If it's a SELECT statement, use a cursor. */
+	/*	Note that the declare cursor has already been prepended to the statement */
+	/*	in copy_statement... */
+	if (self->statement_type == STMT_TYPE_SELECT) {
 
-	/*
-	 * Note that the declare cursor has already been prepended to the
-	 * statement
-	 */
-	/* in copy_statement... */
-	if (self->statement_type == STMT_TYPE_SELECT)
-	{
-		char		fetch[128];
+		char fetch[128];
 
 		mylog("       Sending SELECT statement on stmt=%u, cursor_name='%s'\n", self, self->cursor_name);
 
 
-		/* send the declare/select */
+		/*	send the declare/select */
 		self->result = CC_send_query(conn, self->stmt_with_params, NULL);
 
 		if (globals.use_declarefetch && self->result != NULL &&
-			QR_command_successful(self->result))
-		{
+			QR_command_successful(self->result)) {
+
 			QR_Destructor(self->result);
 
-			/*
-			 * That worked, so now send the fetch to start getting data
-			 * back
-			 */
+			/*	That worked, so now send the fetch to start getting data back */
 			qi.result_in = NULL;
 			qi.cursor = self->cursor_name;
 			qi.row_size = globals.fetch_max;
 
-			/*
-			 * Most likely the rowset size will not be set by the
-			 * application until after the statement is executed, so might
-			 * as well use the cache size. The qr_next_tuple() function
-			 * will correct for any discrepancies in sizes and adjust the
-			 * cache accordingly.
-			 */
+			/*	Most likely the rowset size will not be set by the application until
+				after the statement	is executed, so might as well use the cache size.
+				The qr_next_tuple() function will correct for any discrepancies in
+				sizes and adjust the cache accordingly.
+			*/
 
 			sprintf(fetch, "fetch %d in %s", qi.row_size, self->cursor_name);
 
-			self->result = CC_send_query(conn, fetch, &qi);
+			self->result = CC_send_query( conn, fetch, &qi);
 		}
+
 		mylog("     done sending the query:\n");
+
+
+
 	}
-	else
-	{							/* not a SELECT statement so don't use a
-								 * cursor */
+	else  { /* not a SELECT statement so don't use a cursor */
 		mylog("      it's NOT a select statement: stmt=%u\n", self);
 		self->result = CC_send_query(conn, self->stmt_with_params, NULL);
 
-		/*
-		 * We shouldn't send COMMIT. Postgres backend does the autocommit
-		 * if neccessary. (Zoltan, 04/26/2000)
-		 */
-
-		/*
-		 * Even in case of autocommit, started transactions must be
-		 * committed. (Hiroshi, 09/02/2001)
-		 */
-		if (!self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn) && STMT_UPDATE(self))
-		{
-			res = CC_send_query(conn, "COMMIT", NULL);
+		/*	We shouldn't send COMMIT. Postgres backend does the
+			autocommit if neccessary. (Zoltan, 04/26/2000)
+		*/
+		/*	Even in case of autocommit, started transactions
+			must be committed. (Hiroshi, 09/02/2001)
+		 */ 
+		if ( ! self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn) && STMT_UPDATE(self)) {                   
+			res = CC_send_query(conn, "COMMIT", NULL); 
 			QR_Destructor(res);
 			CC_set_no_trans(conn);
-		}
+		} 
+	
 	}
 
 	conn->status = oldstatus;
 	self->status = STMT_FINISHED;
 
-	/* Check the status of the result */
-	if (self->result)
-	{
+	/*	Check the status of the result */
+	if (self->result) {
+
 		was_ok = QR_command_successful(self->result);
 		was_nonfatal = QR_command_nonfatal(self->result);
 
-		if (was_ok)
+		if ( was_ok)
 			self->errornumber = STMT_OK;
 		else
 			self->errornumber = was_nonfatal ? STMT_INFO_ONLY : STMT_ERROR_TAKEN_FROM_BACKEND;
 
-		self->currTuple = -1;	/* set cursor before the first tuple in
-								 * the list */
+		self->currTuple = -1; /* set cursor before the first tuple in the list */
 		self->current_col = -1;
 		self->rowset_start = -1;
 
@@ -967,57 +876,47 @@ SC_execute(StatementClass *self)
 		numcols = QR_NumResultCols(self->result);
 
 		/* now allocate the array to hold the binding info */
-		if (numcols > 0)
-		{
+		if (numcols > 0) {
 			extend_bindings(self, numcols);
-			if (self->bindings == NULL)
-			{
+			if (self->bindings == NULL) {
 				self->errornumber = STMT_NO_MEMORY_ERROR;
 				self->errormsg = "Could not get enough free memory to store the binding information";
 				SC_log_error(func, "", self);
 				return SQL_ERROR;
 			}
 		}
-		/* in autocommit mode declare/fetch error must be aborted */
-		if (!was_ok && !self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn))
+		/* in autocommit mode declare/fetch error must be aborted */ 
+		if ( ! was_ok && ! self->internal && CC_is_in_autocommit(conn) && CC_is_in_trans(conn))                   
 			CC_abort(conn);
-	}
-	else
-	{							/* Bad Error -- The error message will be
-								 * in the Connection */
+	} else {		/* Bad Error -- The error message will be in the Connection */
 
-		if (self->statement_type == STMT_TYPE_CREATE)
-		{
+		if (self->statement_type == STMT_TYPE_CREATE) {
 			self->errornumber = STMT_CREATE_TABLE_ERROR;
 			self->errormsg = "Error creating the table";
-
-			/*
-			 * This would allow the table to already exists, thus
-			 * appending rows to it.  BUT, if the table didn't have the
-			 * same attributes, it would fail. return
-			 * SQL_SUCCESS_WITH_INFO;
-			 */
+			/*	This would allow the table to already exists, thus appending
+				rows to it.  BUT, if the table didn't have the same attributes,
+				it would fail.
+				return SQL_SUCCESS_WITH_INFO;
+			*/
 		}
-		else
-		{
+		else {
 			self->errornumber = STMT_EXEC_ERROR;
 			self->errormsg = "Error while executing the query";
 		}
 
-		if (!self->internal)
+		if ( ! self->internal)
 			CC_abort(conn);
 	}
 
 	if (self->errornumber == STMT_OK)
 		return SQL_SUCCESS;
 
-	else
-	{
+	else {
 		/* Modified, 2000-04-29, Zoltan */
 		if (self->errornumber == STMT_INFO_ONLY)
-			self->errormsg = "Error while executing the query (non-fatal)";
+		    self->errormsg = "Error while executing the query (non-fatal)";
 		else
-			self->errormsg = "Unknown error";
+		    self->errormsg = "Unknown error";
 		SC_log_error(func, "", self);
 		return SQL_ERROR;
 	}
@@ -1029,8 +928,7 @@ SC_log_error(char *func, char *desc, StatementClass *self)
 #ifdef PRN_NULLCHECK
 #define nullcheck(a) (a ? a : "(NULL)")
 #endif
-	if (self)
-	{
+	if (self) {
 		qlog("STATEMENT ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
 		mylog("STATEMENT ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, nullcheck(self->errormsg));
 		qlog("                 ------------------------------------------------------------\n");
@@ -1047,20 +945,19 @@ SC_log_error(char *func, char *desc, StatementClass *self)
 
 		qlog("                 ----------------QResult Info -------------------------------\n");
 
-		if (self->result)
-		{
-			QResultClass *res = self->result;
-
-			qlog("                 fields=%u, manual_tuples=%u, backend_tuples=%u, tupleField=%d, conn=%u\n", res->fields, res->manual_tuples, res->backend_tuples, res->tupleField, res->conn);
-			qlog("                 fetch_count=%d, fcount=%d, num_fields=%d, cursor='%s'\n", res->fetch_count, res->fcount, res->num_fields, nullcheck(res->cursor));
-			qlog("                 message='%s', command='%s', notice='%s'\n", nullcheck(res->message), nullcheck(res->command), nullcheck(res->notice));
-			qlog("                 status=%d, inTuples=%d\n", res->status, res->inTuples);
+		if (self->result) {
+		QResultClass *res = self->result;
+		qlog("                 fields=%u, manual_tuples=%u, backend_tuples=%u, tupleField=%d, conn=%u\n", res->fields, res->manual_tuples, res->backend_tuples, res->tupleField, res->conn);
+		qlog("                 fetch_count=%d, fcount=%d, num_fields=%d, cursor='%s'\n", res->fetch_count, res->fcount, res->num_fields, nullcheck(res->cursor));
+		qlog("                 message='%s', command='%s', notice='%s'\n", nullcheck(res->message), nullcheck(res->command), nullcheck(res->notice));
+		qlog("                 status=%d, inTuples=%d\n", res->status, res->inTuples);
 		}
 
-		/* Log the connection error if there is one */
+		/*	Log the connection error if there is one */
 		CC_log_error(func, desc, self->hdbc);
 	}
 	else
 		qlog("INVALID STATEMENT HANDLE ERROR: func=%s, desc='%s'\n", func, desc);
 #undef PRN_NULLCHECK
 }
+
diff --git a/src/interfaces/odbc/statement.h b/src/interfaces/odbc/statement.h
index 3ef91e5d77a5902aa3c593c4d471b054500ba4d9..ae2df856b2572af682062af45efece8d0aa8d600 100644
--- a/src/interfaces/odbc/statement.h
+++ b/src/interfaces/odbc/statement.h
@@ -1,9 +1,9 @@
 
-/* File:			statement.h
+/* File:            statement.h
  *
- * Description:		See "statement.c"
+ * Description:     See "statement.c"
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -33,59 +33,51 @@
 #define TRUE	(BOOL)1
 #endif
 
-typedef enum
-{
-	STMT_ALLOCATED,				/* The statement handle is allocated, but
-								 * not used so far */
-	STMT_READY,					/* the statement is waiting to be executed */
-	STMT_PREMATURE,				/* ODBC states that it is legal to call
-								 * e.g. SQLDescribeCol before a call to
-								 * SQLExecute, but after SQLPrepare. To
-								 * get all the necessary information in
-								 * such a case, we simply execute the
-								 * query _before_ the actual call to
-								 * SQLExecute, so that statement is
-								 * considered to be "premature". */
-	STMT_FINISHED,				/* statement execution has finished */
-	STMT_EXECUTING				/* statement execution is still going on */
+typedef enum {
+    STMT_ALLOCATED,     /* The statement handle is allocated, but not used so far */
+    STMT_READY,         /* the statement is waiting to be executed */
+    STMT_PREMATURE,     /* ODBC states that it is legal to call e.g. SQLDescribeCol before
+                           a call to SQLExecute, but after SQLPrepare. To get all the necessary
+                           information in such a case, we simply execute the query _before_ the
+                           actual call to SQLExecute, so that statement is considered to be "premature".
+                        */   
+    STMT_FINISHED,      /* statement execution has finished */
+    STMT_EXECUTING      /* statement execution is still going on */
 } STMT_Status;
 
-#define STMT_TRUNCATED	(-2)
-#define STMT_INFO_ONLY	(-1)	/* not an error message, just a
-								 * notification to be returned by SQLError */
-#define STMT_OK			0		/* will be interpreted as "no error
-								 * pending" */
-#define STMT_EXEC_ERROR						1
-#define STMT_STATUS_ERROR					2
-#define STMT_SEQUENCE_ERROR					3
-#define STMT_NO_MEMORY_ERROR				4
-#define STMT_COLNUM_ERROR					5
-#define STMT_NO_STMTSTRING					6
-#define STMT_ERROR_TAKEN_FROM_BACKEND		7
-#define STMT_INTERNAL_ERROR					8
-#define STMT_STILL_EXECUTING				9
-#define STMT_NOT_IMPLEMENTED_ERROR			10
-#define STMT_BAD_PARAMETER_NUMBER_ERROR		11
-#define STMT_OPTION_OUT_OF_RANGE_ERROR		12
-#define STMT_INVALID_COLUMN_NUMBER_ERROR	13
-#define STMT_RESTRICTED_DATA_TYPE_ERROR		14
-#define STMT_INVALID_CURSOR_STATE_ERROR		15
-#define STMT_OPTION_VALUE_CHANGED			16
-#define STMT_CREATE_TABLE_ERROR				17
-#define STMT_NO_CURSOR_NAME					18
-#define STMT_INVALID_CURSOR_NAME			19
-#define STMT_INVALID_ARGUMENT_NO			20
-#define STMT_ROW_OUT_OF_RANGE				21
-#define STMT_OPERATION_CANCELLED			22
-#define STMT_INVALID_CURSOR_POSITION		23
-#define STMT_VALUE_OUT_OF_RANGE				24
-#define STMT_OPERATION_INVALID				25
-#define STMT_PROGRAM_TYPE_OUT_OF_RANGE		26
-#define STMT_BAD_ERROR						27
+#define STMT_TRUNCATED -2
+#define STMT_INFO_ONLY -1 /* not an error message, just a notification to be returned by SQLError */
+#define STMT_OK 0 /* will be interpreted as "no error pending" */
+#define STMT_EXEC_ERROR 1
+#define STMT_STATUS_ERROR 2
+#define STMT_SEQUENCE_ERROR 3
+#define STMT_NO_MEMORY_ERROR 4
+#define STMT_COLNUM_ERROR 5
+#define STMT_NO_STMTSTRING 6
+#define STMT_ERROR_TAKEN_FROM_BACKEND 7
+#define STMT_INTERNAL_ERROR 8
+#define STMT_STILL_EXECUTING 9
+#define STMT_NOT_IMPLEMENTED_ERROR 10
+#define STMT_BAD_PARAMETER_NUMBER_ERROR 11
+#define STMT_OPTION_OUT_OF_RANGE_ERROR 12
+#define STMT_INVALID_COLUMN_NUMBER_ERROR 13
+#define STMT_RESTRICTED_DATA_TYPE_ERROR 14
+#define STMT_INVALID_CURSOR_STATE_ERROR 15
+#define STMT_OPTION_VALUE_CHANGED 16
+#define STMT_CREATE_TABLE_ERROR 17
+#define STMT_NO_CURSOR_NAME 18
+#define STMT_INVALID_CURSOR_NAME 19
+#define STMT_INVALID_ARGUMENT_NO 20
+#define STMT_ROW_OUT_OF_RANGE 21
+#define STMT_OPERATION_CANCELLED 22
+#define STMT_INVALID_CURSOR_POSITION 23
+#define STMT_VALUE_OUT_OF_RANGE 24
+#define STMT_OPERATION_INVALID 25
+#define STMT_PROGRAM_TYPE_OUT_OF_RANGE 26
+#define STMT_BAD_ERROR 27
 
 /* statement types */
-enum
-{
+enum {
 	STMT_TYPE_UNKNOWN = -2,
 	STMT_TYPE_OTHER = -1,
 	STMT_TYPE_SELECT = 0,
@@ -103,8 +95,7 @@ enum
 
 
 /*	Parsing status */
-enum
-{
+enum {
 	STMT_PARSE_NONE = 0,
 	STMT_PARSE_COMPLETE,
 	STMT_PARSE_INCOMPLETE,
@@ -112,110 +103,92 @@ enum
 };
 
 /*	Result style */
-enum
-{
+enum {
 	STMT_FETCH_NONE = 0,
 	STMT_FETCH_NORMAL,
 	STMT_FETCH_EXTENDED,
 };
 
-typedef struct
-{
-	COL_INFO   *col_info;		/* cached SQLColumns info for this table */
-	char		name[MAX_TABLE_LEN + 1];
-	char		alias[MAX_TABLE_LEN + 1];
+typedef struct {
+	COL_INFO		*col_info;		/* cached SQLColumns info for this table */
+	char 			name[MAX_TABLE_LEN+1];
+	char			alias[MAX_TABLE_LEN+1];
 } TABLE_INFO;
 
-typedef struct
-{
-	TABLE_INFO *ti;				/* resolve to explicit table names */
-	int			precision;
-	int			display_size;
-	int			length;
-	int			type;
-	char		nullable;
-	char		func;
-	char		expr;
-	char		quote;
-	char		dquote;
-	char		numeric;
-	char		dot[MAX_TABLE_LEN + 1];
-	char		name[MAX_COLUMN_LEN + 1];
-	char		alias[MAX_COLUMN_LEN + 1];
+typedef struct {
+	TABLE_INFO  	*ti;			/* resolve to explicit table names */
+	int				precision;
+	int				display_size;
+	int				length;
+	int				type;
+	char			nullable;
+	char			func;
+	char			expr;
+	char			quote;
+	char			dquote;
+	char			numeric;
+	char			dot[MAX_TABLE_LEN+1];
+	char			name[MAX_COLUMN_LEN+1];
+	char			alias[MAX_COLUMN_LEN+1];
 } FIELD_INFO;
 
 
 /********	Statement Handle	***********/
-struct StatementClass_
-{
-	ConnectionClass *hdbc;		/* pointer to ConnectionClass this
-								 * statement belongs to */
-	QResultClass *result;		/* result of the current statement */
-	HSTMT FAR  *phstmt;
+struct StatementClass_ {
+    ConnectionClass *hdbc;		/* pointer to ConnectionClass this statement belongs to */
+    QResultClass *result;		/* result of the current statement */
+	HSTMT FAR *phstmt;
 	StatementOptions options;
 
-	STMT_Status status;
-	char	   *errormsg;
-	int			errornumber;
+    STMT_Status status;
+    char *errormsg;
+    int errornumber;
 
-	/* information on bindings */
-	BindInfoClass *bindings;	/* array to store the binding information */
+    /* information on bindings */
+    BindInfoClass *bindings;	/* array to store the binding information */
 	BindInfoClass bookmark;
-	int			bindings_allocated;
-
-	/* information on statement parameters */
-	int			parameters_allocated;
-	ParameterInfoClass *parameters;
-
-	Int4		currTuple;		/* current absolute row number (GetData,
-								 * SetPos, SQLFetch) */
-	int			save_rowset_size;		/* saved rowset size in case of
-										 * change/FETCH_NEXT */
-	int			rowset_start;	/* start of rowset (an absolute row
-								 * number) */
-	int			bind_row;		/* current offset for Multiple row/column
-								 * binding */
-	int			last_fetch_count;		/* number of rows retrieved in
-										 * last fetch/extended fetch */
-	int			current_col;	/* current column for GetData -- used to
-								 * handle multiple calls */
-	int			lobj_fd;		/* fd of the current large object */
-
-	char	   *statement;		/* if non--null pointer to the SQL
-								 * statement that has been executed */
-
-	TABLE_INFO **ti;
-	FIELD_INFO **fi;
+    int bindings_allocated;
+
+    /* information on statement parameters */
+    int parameters_allocated;
+    ParameterInfoClass *parameters;
+
+	Int4 currTuple;				/* current absolute row number (GetData, SetPos, SQLFetch) */
+	int  save_rowset_size;		/* saved rowset size in case of change/FETCH_NEXT */
+	int  rowset_start;			/* start of rowset (an absolute row number) */
+	int  bind_row;				/* current offset for Multiple row/column binding */
+	int  last_fetch_count;      /* number of rows retrieved in last fetch/extended fetch */
+	int  current_col;			/* current column for GetData -- used to handle multiple calls */
+	int  lobj_fd;				/* fd of the current large object */
+
+    char *statement;			/* if non--null pointer to the SQL statement that has been executed */
+
+	TABLE_INFO	**ti;
+	FIELD_INFO	**fi;
 	int			nfld;
 	int			ntab;
 
-	int			parse_status;
+	int parse_status;
 
-	int			statement_type; /* According to the defines above */
-	int			data_at_exec;	/* Number of params needing SQLPutData */
-	int			current_exec_param;		/* The current parameter for
-										 * SQLPutData */
+    int statement_type;			/* According to the defines above */
+	int data_at_exec;			/* Number of params needing SQLPutData */
+	int current_exec_param;		/* The current parameter for SQLPutData */
 
-	char		put_data;		/* Has SQLPutData been called yet? */
+	char put_data;				/* Has SQLPutData been called yet? */
 
-	char		errormsg_created;		/* has an informative error msg
-										 * been created?  */
-	char		manual_result;	/* Is the statement result manually built? */
-	char		prepare;		/* is this statement a prepared statement
-								 * or direct */
+	char errormsg_created;		/* has an informative error msg been created?  */
+	char manual_result;			/* Is the statement result manually built? */
+	char prepare;				/* is this statement a prepared statement or direct */
 
-	char		internal;		/* Is this statement being called
-								 * internally? */
+	char internal;				/* Is this statement being called internally? */
 
-	char		cursor_name[MAX_CURSOR_LEN + 1];
+	char cursor_name[MAX_CURSOR_LEN+1];
 
-	char		stmt_with_params[STD_STATEMENT_LEN];	/* statement after
-														 * parameter
-														 * substitution */
+	char stmt_with_params[STD_STATEMENT_LEN];		/* statement after parameter substitution */
 
 };
 
-#define SC_get_conn(a)	  (a->hdbc)
+#define SC_get_conn(a)    (a->hdbc)
 #define SC_get_Result(a)  (a->result);
 
 /*	options for SC_free_params() */
@@ -224,21 +197,21 @@ struct StatementClass_
 
 /*	Statement prototypes */
 StatementClass *SC_Constructor(void);
-void		InitializeStatementOptions(StatementOptions *opt);
-char		SC_Destructor(StatementClass *self);
-int			statement_type(char *statement);
-char		parse_statement(StatementClass *stmt);
-void		SC_pre_execute(StatementClass *self);
-char		SC_unbind_cols(StatementClass *self);
-char		SC_recycle_statement(StatementClass *self);
-
-void		SC_clear_error(StatementClass *self);
-char		SC_get_error(StatementClass *self, int *number, char **message);
-char	   *SC_create_errormsg(StatementClass *self);
-RETCODE		SC_execute(StatementClass *self);
-RETCODE		SC_fetch(StatementClass *self);
-void		SC_free_params(StatementClass *self, char option);
-void		SC_log_error(char *func, char *desc, StatementClass *self);
+void InitializeStatementOptions(StatementOptions *opt);
+char SC_Destructor(StatementClass *self);
+int statement_type(char *statement);
+char parse_statement(StatementClass *stmt);
+void SC_pre_execute(StatementClass *self);
+char SC_unbind_cols(StatementClass *self);
+char SC_recycle_statement(StatementClass *self);
+
+void SC_clear_error(StatementClass *self);
+char SC_get_error(StatementClass *self, int *number, char **message);
+char *SC_create_errormsg(StatementClass *self);
+RETCODE SC_execute(StatementClass *self);
+RETCODE SC_fetch(StatementClass *self);
+void SC_free_params(StatementClass *self, char option);
+void SC_log_error(char *func, char *desc, StatementClass *self);
 unsigned long SC_get_bookmark(StatementClass *self);
 
 
diff --git a/src/interfaces/odbc/tuple.c b/src/interfaces/odbc/tuple.c
index e12f2fc55e90b327c0d49354deab53410a5da212..303476fef28cb090619c3e9ba68c7a615955c572 100644
--- a/src/interfaces/odbc/tuple.c
+++ b/src/interfaces/odbc/tuple.c
@@ -1,16 +1,17 @@
-/* Module:			tuple.c
+
+/* Module:          tuple.c
  *
- * Description:		This module contains functions for setting the data for individual
- *					fields (TupleField structure) of a manual result set.
+ * Description:     This module contains functions for setting the data for individual
+ *                  fields (TupleField structure) of a manual result set.
  *
- * Important Note:	These functions are ONLY used in building manual result sets for
- *					info functions (SQLTables, SQLColumns, etc.)
+ * Important Note:  These functions are ONLY used in building manual result sets for 
+ *                  info functions (SQLTables, SQLColumns, etc.)
  *
- * Classes:			n/a
+ * Classes:         n/a
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -18,43 +19,39 @@
 #include <string.h>
 #include <stdlib.h>
 
-void
-set_tuplefield_null(TupleField *tuple_field)
+void set_tuplefield_null(TupleField *tuple_field)
 {
 	tuple_field->len = 0;
-	tuple_field->value = NULL;	/* strdup(""); */
+	tuple_field->value = NULL;  /* strdup(""); */
 }
 
-void
-set_tuplefield_string(TupleField *tuple_field, char *string)
+void set_tuplefield_string(TupleField *tuple_field, char *string)
 {
 	tuple_field->len = strlen(string);
-	tuple_field->value = malloc(strlen(string) + 1);
+	tuple_field->value = malloc(strlen(string)+1);
 	strcpy(tuple_field->value, string);
 }
 
 
-void
-set_tuplefield_int2(TupleField *tuple_field, Int2 value)
+void set_tuplefield_int2(TupleField *tuple_field, Int2 value)
 {
-	char		buffer[10];
+char buffer[10];
 
 
-	sprintf(buffer, "%d", value);
+	sprintf(buffer,"%d", value);
 
-	tuple_field->len = strlen(buffer) + 1;
+	tuple_field->len = strlen(buffer)+1;
 	/* +1 ... is this correct (better be on the save side-...) */
 	tuple_field->value = strdup(buffer);
 }
 
-void
-set_tuplefield_int4(TupleField *tuple_field, Int4 value)
+void set_tuplefield_int4(TupleField *tuple_field, Int4 value)
 {
-	char		buffer[15];
+char buffer[15];
 
-	sprintf(buffer, "%ld", value);
+	sprintf(buffer,"%ld", value);
 
-	tuple_field->len = strlen(buffer) + 1;
+	tuple_field->len = strlen(buffer)+1;
 	/* +1 ... is this correct (better be on the save side-...) */
 	tuple_field->value = strdup(buffer);
 }
diff --git a/src/interfaces/odbc/tuple.h b/src/interfaces/odbc/tuple.h
index f3d3d997d13eb7323e0092ab3a50a6dc785ff71c..628d5ce449c75abe22eae3fdd49076b67cf74590 100644
--- a/src/interfaces/odbc/tuple.h
+++ b/src/interfaces/odbc/tuple.h
@@ -1,13 +1,13 @@
 
-/* File:			tuple.h
+/* File:            tuple.h
  *
- * Description:		See "tuple.c"
+ * Description:     See "tuple.c"
  *
- * Important NOTE:	The TupleField structure is used both to hold backend data and
- *					manual result set data.  The "set_" functions and the TupleNode
- *					structure are only used for manual result sets by info routines.
+ * Important NOTE:  The TupleField structure is used both to hold backend data and
+ *                  manual result set data.  The "set_" functions and the TupleNode
+ *                  structure are only used for manual result sets by info routines.  
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -17,18 +17,15 @@
 #include "psqlodbc.h"
 
 /*	Used by backend data AND manual result sets */
-struct TupleField_
-{
-	Int4		len;			/* length of the current Tuple */
-	void	   *value;			/* an array representing the value */
+struct TupleField_ {
+    Int4 len;     /* length of the current Tuple */
+    void *value;  /* an array representing the value */
 };
 
 /*	Used ONLY for manual result sets */
-struct TupleNode_
-{
-	struct TupleNode_ *prev,
-			   *next;
-	TupleField	tuple[1];
+struct TupleNode_ {
+    struct TupleNode_ *prev, *next;
+    TupleField tuple[1];
 };
 
 /*	These macros are wrappers for the corresponding set_tuplefield functions
@@ -39,9 +36,9 @@ struct TupleNode_
 #define set_nullfield_int2(FLD, VAL)		((VAL) != -1 ? set_tuplefield_int2(FLD, (VAL)) : set_tuplefield_null(FLD))
 #define set_nullfield_int4(FLD, VAL)		((VAL) != -1 ? set_tuplefield_int4(FLD, (VAL)) : set_tuplefield_null(FLD))
 
-void		set_tuplefield_null(TupleField *tuple_field);
-void		set_tuplefield_string(TupleField *tuple_field, char *string);
-void		set_tuplefield_int2(TupleField *tuple_field, Int2 value);
-void		set_tuplefield_int4(TupleField *tuple_field, Int4 value);
+void set_tuplefield_null(TupleField *tuple_field);
+void set_tuplefield_string(TupleField *tuple_field, char *string);
+void set_tuplefield_int2(TupleField *tuple_field, Int2 value);
+void set_tuplefield_int4(TupleField *tuple_field, Int4 value);
 
 #endif
diff --git a/src/interfaces/odbc/tuplelist.c b/src/interfaces/odbc/tuplelist.c
index 7867c9ba994f65869c6a01dce913173be01120b0..31acb9c9c908ffd6edfc1da7d6b523af05691b72 100644
--- a/src/interfaces/odbc/tuplelist.c
+++ b/src/interfaces/odbc/tuplelist.c
@@ -1,13 +1,14 @@
-/* Module:			tuplelist.c
+
+/* Module:          tuplelist.c
  *
- * Description:		This module contains functions for creating a manual result set
- *					(the TupleList) and retrieving data from it for a specific row/column.
+ * Description:     This module contains functions for creating a manual result set
+ *                  (the TupleList) and retrieving data from it for a specific row/column.
  *
- * Classes:			TupleListClass (Functions prefix: "TL_")
+ * Classes:         TupleListClass (Functions prefix: "TL_")
  *
- * API functions:	none
+ * API functions:   none
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -18,19 +19,19 @@
 TupleListClass *
 TL_Constructor(UInt4 fieldcnt)
 {
-	TupleListClass *rv;
+TupleListClass *rv;
 
 	mylog("in TL_Constructor\n");
 
 	rv = (TupleListClass *) malloc(sizeof(TupleListClass));
-	if (rv)
-	{
-		rv->num_fields = fieldcnt;
-		rv->num_tuples = 0;
-		rv->list_start = NULL;
-		rv->list_end = NULL;
-		rv->lastref = NULL;
-		rv->last_indexed = -1;
+	if (rv) {
+
+        rv->num_fields = fieldcnt;
+        rv->num_tuples = 0;
+        rv->list_start = NULL;
+        rv->list_end = NULL;
+        rv->lastref = NULL;
+        rv->last_indexed = -1;
 	}
 
 	mylog("exit TL_Constructor\n");
@@ -41,38 +42,35 @@ TL_Constructor(UInt4 fieldcnt)
 void
 TL_Destructor(TupleListClass *self)
 {
-	int			lf;
-	TupleNode  *node,
-			   *tp;
+int lf;
+TupleNode *node, *tp;
 
 	mylog("TupleList: in DESTRUCTOR\n");
 
-	node = self->list_start;
-	while (node != NULL)
-	{
-		for (lf = 0; lf < self->num_fields; lf++)
-			if (node->tuple[lf].value != NULL)
-				free(node->tuple[lf].value);
-		tp = node->next;
-		free(node);
-		node = tp;
-	}
+    node = self->list_start;
+    while(node != NULL) {
+        for (lf=0; lf < self->num_fields; lf++)
+            if (node->tuple[lf].value != NULL) {
+                free(node->tuple[lf].value);
+            }
+        tp = node->next;
+        free(node);
+        node = tp;
+    }
 
 	free(self);
 
 	mylog("TupleList: exit DESTRUCTOR\n");
 }
-
+			
 
 void *
 TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
 {
-	Int4		lf;
-	Int4		delta,
-				from_end;
-	char		end_is_closer,
-				start_is_closer;
-	TupleNode  *rv;
+Int4 lf;
+Int4 delta, from_end;
+char end_is_closer, start_is_closer;
+TupleNode *rv;
 
 	if (self->last_indexed == -1)
 		/* we have an empty tuple list */
@@ -87,88 +85,67 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
 		/* illegel field number range */
 		return NULL;
 
-	/*
-	 * check if we are accessing the same tuple that was used in the last
-	 * fetch (e.g: for fetching all the fields one after another. Do this
-	 * to speed things up
-	 */
+ /* check if we are accessing the same tuple that was used in
+    the last fetch (e.g: for fetching all the fields one after
+    another. Do this to speed things up
+ */
 	if (tupleno == self->last_indexed)
 		return self->lastref->tuple[fieldno].value;
 
-	/* now for the tricky part... */
+ /* now for the tricky part... */
 
-	/*
-	 * Since random access is quite inefficient for linked lists we use
-	 * the lastref pointer that points to the last element referenced by a
-	 * get_fieldval() call in conjunction with the its index number that
-	 * is stored in last_indexed. (So we use some locality of reference
-	 * principle to speed things up)
-	 */
+ /*
+ Since random access is quite inefficient for linked lists we use
+ the lastref pointer that points to the last element referenced
+ by a get_fieldval() call in conjunction with the its index number
+ that is stored in last_indexed. (So we use some locality of
+ reference principle to speed things up)
+ */
 
 	delta = tupleno - self->last_indexed;
 	/* if delta is positive, we have to go forward */
 
-	/*
-	 * now check if we are closer to the start or the end of the list than
-	 * to our last_indexed pointer
-	 */
+	/* now check if we are closer to the start or the end of the list
+	than to our last_indexed pointer
+	*/
 	from_end = (self->num_tuples - 1) - tupleno;
 
 	start_is_closer = labs(delta) > tupleno;
-
-	/*
-	 * true if we are closer to the start of the list than to the
-	 * last_indexed pointer
-	 */
+	/* true if we are closer to the start of the list than to the
+	last_indexed pointer
+	*/
 
 	end_is_closer = labs(delta) > from_end;
 	/* true if we are closer at the end of the list */
 
-	if (end_is_closer)
-	{
+	if (end_is_closer) {
 		/* scanning from the end is the shortest way. so we do that... */
 		rv = self->list_end;
-		for (lf = 0; lf < from_end; lf++)
+		for (lf=0; lf < from_end; lf++)
 			rv = rv->prev;
-	}
-	else if (start_is_closer)
-	{
-
-		/*
-		 * the shortest way is to start the search from the head of the
-		 * list
-		 */
+	} else if (start_is_closer) {
+		/* the shortest way is to start the search from the head of the list */
 		rv = self->list_start;
-		for (lf = 0; lf < tupleno; lf++)
+		for (lf=0; lf < tupleno; lf++)
 			rv = rv->next;
-	}
-	else
-	{
+	} else {
 		/* the closest way is starting from our lastref - pointer */
 		rv = self->lastref;
-
-		/*
-		 * at first determine whether we have to search forward or
-		 * backwards
-		 */
-		if (delta < 0)
-		{
+		/* at first determine whether we have to search forward or backwards */
+		if (delta < 0) {
 			/* we have to search backwards */
-			for (lf = 0; lf < (-1) * delta; lf++)
+			for(lf=0; lf < (-1)*delta; lf++)
 				rv = rv->prev;
-		}
-		else
-		{
+		} else {
 			/* ok, we have to search forward... */
-			for (lf = 0; lf < delta; lf++)
-				rv = rv->next;
+			for (lf=0; lf < delta; lf++)
+			rv = rv->next;
 		}
 	}
 
-	/*
-	 * now we have got our return pointer, so update the lastref and the
-	 * last_indexed values
-	 */
+	/* now we have got our return pointer, so update the lastref
+		and the last_indexed values
+	*/
 	self->lastref = rv;
 	self->last_indexed = tupleno;
 
@@ -180,30 +157,23 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
 char
 TL_add_tuple(TupleListClass *self, TupleNode *new_field)
 {
-
-	/*
-	 * we append the tuple at the end of the doubly linked list of the
-	 * tuples we have already read in
-	 */
+ /* we append the tuple at the end of the doubly linked list
+    of the tuples we have already read in
+ */
 
 	new_field->prev = NULL;
 	new_field->next = NULL;
 
-	if (self->list_start == NULL)
-	{
+	if (self->list_start == NULL) {
 		/* the list is empty, we have to add the first tuple */
 		self->list_start = new_field;
 		self->list_end = new_field;
 		self->lastref = new_field;
 		self->last_indexed = 0;
-	}
-	else
-	{
-
-		/*
-		 * there is already an element in the list, so add the new one at
-		 * the end of the list
-		 */
+	} else {
+		/* there is already an element in the list, so add the new
+			one at the end of the list
+		*/
 		self->list_end->next = new_field;
 		new_field->prev = self->list_end;
 		self->list_end = new_field;
@@ -213,3 +183,5 @@ TL_add_tuple(TupleListClass *self, TupleNode *new_field)
 	/* this method of building a list cannot fail, so we return 1 */
 	return 1;
 }
+
+
diff --git a/src/interfaces/odbc/tuplelist.h b/src/interfaces/odbc/tuplelist.h
index 2b255bece76d0133dbdd342484a4584f4bf3dfdb..0f0bdb42ffb41f85d281d202a2d6714b87de8d3e 100644
--- a/src/interfaces/odbc/tuplelist.h
+++ b/src/interfaces/odbc/tuplelist.h
@@ -1,12 +1,12 @@
 
-/* File:			tuplelist.h
+/* File:            tuplelist.h
  *
- * Description:		See "tuplelist.c"
+ * Description:     See "tuplelist.c"
  *
- * Important Note:	This structure and its functions are ONLY used in building manual result
- *					sets for info functions (SQLTables, SQLColumns, etc.)
+ * Important Note:  This structure and its functions are ONLY used in building manual result
+ *                  sets for info functions (SQLTables, SQLColumns, etc.)
  *
- * Comments:		See "notice.txt" for copyright and license information.
+ * Comments:        See "notice.txt" for copyright and license information.
  *
  */
 
@@ -15,22 +15,19 @@
 
 #include "psqlodbc.h"
 
-struct TupleListClass_
-{
-	Int4		num_fields;
-	Int4		num_tuples;
-	TupleNode  *list_start,
-			   *list_end,
-			   *lastref;
-	Int4		last_indexed;
+struct TupleListClass_ {
+	Int4 num_fields;
+	Int4 num_tuples;  
+	TupleNode *list_start, *list_end, *lastref;
+	Int4 last_indexed;
 };
 
 #define TL_get_num_tuples(x)	(x->num_tuples)
 
 /* Create a TupleList. Each tuple consits of fieldcnt columns */
 TupleListClass *TL_Constructor(UInt4 fieldcnt);
-void		TL_Destructor(TupleListClass *self);
-void	   *TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno);
-char		TL_add_tuple(TupleListClass *self, TupleNode *new_field);
+void TL_Destructor(TupleListClass *self);  
+void *TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno);
+char TL_add_tuple(TupleListClass *self, TupleNode *new_field);
 
 #endif