Index: odbcapi30.c
===================================================================
RCS file: /cvsroot/psqlodbc/psqlodbc/odbcapi30.c,v
retrieving revision 1.34
diff -c -r1.34 odbcapi30.c
*** odbcapi30.c	20 Oct 2005 13:06:10 -0000	1.34
--- odbcapi30.c	26 Jan 2006 17:03:26 -0000
***************
*** 422,441 ****
  	switch (Attribute)
  	{
  		case SQL_ATTR_CONNECTION_POOLING:
! 			switch ((SQLUINTEGER) Value)
  			{
! 			 	case SQL_CP_OFF:
! 					EN_unset_pooling(env);
! 					ret = SQL_SUCCESS;
! 					break;
  #if defined(WIN_MULTITHREAD_SUPPORT) || defined(POSIX_MULTITHREAD_SUPPORT)
! 				case SQL_CP_ONE_PER_DRIVER:
! 					EN_set_pooling(env);
! 					ret = SQL_SUCCESS;
! 					break;
  #endif /* WIN_MULTITHREAD_SUPPORT */
! 				default:
! 					ret = SQL_SUCCESS_WITH_INFO;
  			}
  			break;
  		case SQL_ATTR_CP_MATCH:
--- 422,442 ----
  	switch (Attribute)
  	{
  		case SQL_ATTR_CONNECTION_POOLING:
! 			if (Value == (PTR) SQL_CP_OFF)
  			{
! 				EN_unset_pooling(env);
! 				ret = SQL_SUCCESS;
! 			}
  #if defined(WIN_MULTITHREAD_SUPPORT) || defined(POSIX_MULTITHREAD_SUPPORT)
! 			else if (Value == (PTR) SQL_CP_ONE_PER_DRIVER)
! 			{
! 				EN_set_pooling(env);
! 				ret = SQL_SUCCESS;
! 			}
  #endif /* WIN_MULTITHREAD_SUPPORT */
! 			else
! 			{
! 				ret = SQL_SUCCESS_WITH_INFO;
  			}
  			break;
  		case SQL_ATTR_CP_MATCH:
***************
*** 443,456 ****
  			ret = SQL_SUCCESS;
  			break;
  		case SQL_ATTR_ODBC_VERSION:
! 			if ((SQLUINTEGER) Value == SQL_OV_ODBC2)
  				EN_set_odbc2(env);
  			else
  				EN_set_odbc3(env);
  			ret = SQL_SUCCESS;
  			break;
  		case SQL_ATTR_OUTPUT_NTS:
! 			if ((SQLUINTEGER) Value == SQL_TRUE)
  				ret = SQL_SUCCESS;
  			else
  				ret = SQL_SUCCESS_WITH_INFO;
--- 444,457 ----
  			ret = SQL_SUCCESS;
  			break;
  		case SQL_ATTR_ODBC_VERSION:
! 			if (Value == (PTR) SQL_OV_ODBC2)
  				EN_set_odbc2(env);
  			else
  				EN_set_odbc3(env);
  			ret = SQL_SUCCESS;
  			break;
  		case SQL_ATTR_OUTPUT_NTS:
! 			if (Value == (PTR) SQL_TRUE)
  				ret = SQL_SUCCESS;
  			else
  				ret = SQL_SUCCESS_WITH_INFO;
Index: options.c
===================================================================
RCS file: /cvsroot/psqlodbc/psqlodbc/options.c,v
retrieving revision 1.60
diff -c -r1.60 options.c
*** options.c	25 Nov 2005 10:43:25 -0000	1.60
--- options.c	26 Jan 2006 17:03:27 -0000
***************
*** 484,489 ****
--- 484,490 ----
  
  				CC_set_error(conn, CONN_UNSUPPORTED_OPTION, "Unknown connect option (Set)");
  				sprintf(option, "fOption=%d, vParam=%ld", fOption, vParam);
+ #ifdef WIN32
  				if (fOption == 30002 && vParam)
  				{
  					int	cmp;
***************
*** 507,512 ****
--- 508,514 ----
  						return SQL_SUCCESS;
  					}
  				}
+ #endif
  				CC_log_error(func, option, conn);
  				return SQL_ERROR;
  			}
Index: pgapi30.c
===================================================================
RCS file: /cvsroot/psqlodbc/psqlodbc/pgapi30.c,v
retrieving revision 1.27
diff -c -r1.27 pgapi30.c
*** pgapi30.c	2 Dec 2005 11:00:43 -0000	1.27
--- pgapi30.c	26 Jan 2006 17:03:27 -0000
***************
*** 475,481 ****
  	switch (FieldIdentifier)
  	{
  		case SQL_DESC_ARRAY_SIZE:
! 			opts->size_of_rowset = (SQLUINTEGER) Value;
  			return ret;
  		case SQL_DESC_ARRAY_STATUS_PTR:
  			opts->row_operation_ptr = Value;
--- 475,481 ----
  	switch (FieldIdentifier)
  	{
  		case SQL_DESC_ARRAY_SIZE:
! 			opts->size_of_rowset = (SQLUINTEGER) ((unsigned long) Value);
  			return ret;
  		case SQL_DESC_ARRAY_STATUS_PTR:
  			opts->row_operation_ptr = Value;
***************
*** 484,493 ****
  			opts->row_offset_ptr = Value;
  			return ret;
  		case SQL_DESC_BIND_TYPE:
! 			opts->bind_size = (SQLUINTEGER) Value;
  			return ret;
  		case SQL_DESC_COUNT:
! 			column_bindings_set(opts, (SQLUINTEGER) Value, FALSE);
  			return ret;
  
  		case SQL_DESC_TYPE:
--- 484,493 ----
  			opts->row_offset_ptr = Value;
  			return ret;
  		case SQL_DESC_BIND_TYPE:
! 			opts->bind_size = (SQLUINTEGER) ((unsigned long) Value);
  			return ret;
  		case SQL_DESC_COUNT:
! 			column_bindings_set(opts, (SQLUINTEGER) ((unsigned long) Value), FALSE);
  			return ret;
  
  		case SQL_DESC_TYPE:
***************
*** 532,538 ****
  	{
  		case SQL_DESC_TYPE:
  			reset_a_column_binding(opts, RecNumber);
! 			opts->bindings[row_idx].returntype = (Int4) Value;
  			break;
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
  			switch (opts->bindings[row_idx].returntype)
--- 532,538 ----
  	{
  		case SQL_DESC_TYPE:
  			reset_a_column_binding(opts, RecNumber);
! 			opts->bindings[row_idx].returntype = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
  			switch (opts->bindings[row_idx].returntype)
***************
*** 541,547 ****
  				case SQL_C_TYPE_DATE:
  				case SQL_C_TYPE_TIME:
  				case SQL_C_TYPE_TIMESTAMP:
! 				switch ((Int4) Value)
  				{
  					case SQL_CODE_DATE:
  						opts->bindings[row_idx].returntype = SQL_C_TYPE_DATE;
--- 541,547 ----
  				case SQL_C_TYPE_DATE:
  				case SQL_C_TYPE_TIME:
  				case SQL_C_TYPE_TIMESTAMP:
! 				switch ((Int4) ((long) Value))
  				{
  					case SQL_CODE_DATE:
  						opts->bindings[row_idx].returntype = SQL_C_TYPE_DATE;
***************
*** 557,563 ****
  			}
  			break;
  		case SQL_DESC_CONCISE_TYPE:
! 			opts->bindings[row_idx].returntype = (Int4) Value;
  			break;
  		case SQL_DESC_DATA_PTR:
  			opts->bindings[row_idx].buffer = Value;
--- 557,563 ----
  			}
  			break;
  		case SQL_DESC_CONCISE_TYPE:
! 			opts->bindings[row_idx].returntype = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_DATA_PTR:
  			opts->bindings[row_idx].buffer = Value;
***************
*** 574,586 ****
  			opts->bindings[row_idx].used = Value;
  			break;
  		case SQL_DESC_OCTET_LENGTH:
! 			opts->bindings[row_idx].buflen = (Int4) Value;
  			break;
  		case SQL_DESC_PRECISION:
! 			opts->bindings[row_idx].precision = (Int2)((Int4) Value);
  			break;
  		case SQL_DESC_SCALE:
! 			opts->bindings[row_idx].scale = (Int4) Value;
  			break;
  		case SQL_DESC_ALLOC_TYPE: /* read-only */
  		case SQL_DESC_DATETIME_INTERVAL_PRECISION:
--- 574,586 ----
  			opts->bindings[row_idx].used = Value;
  			break;
  		case SQL_DESC_OCTET_LENGTH:
! 			opts->bindings[row_idx].buflen = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_PRECISION:
! 			opts->bindings[row_idx].precision = (Int2)((long) Value);
  			break;
  		case SQL_DESC_SCALE:
! 			opts->bindings[row_idx].scale = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_ALLOC_TYPE: /* read-only */
  		case SQL_DESC_DATETIME_INTERVAL_PRECISION:
***************
*** 650,656 ****
  	switch (FieldIdentifier)
  	{
  		case SQL_DESC_ARRAY_SIZE:
! 			opts->paramset_size = (SQLUINTEGER) Value;
  			return ret;
  		case SQL_DESC_ARRAY_STATUS_PTR:
  			opts->param_operation_ptr = Value;
--- 650,656 ----
  	switch (FieldIdentifier)
  	{
  		case SQL_DESC_ARRAY_SIZE:
! 			opts->paramset_size = (SQLUINTEGER) ((unsigned long) Value);
  			return ret;
  		case SQL_DESC_ARRAY_STATUS_PTR:
  			opts->param_operation_ptr = Value;
***************
*** 659,668 ****
  			opts->param_offset_ptr = Value;
  			return ret;
  		case SQL_DESC_BIND_TYPE:
! 			opts->param_bind_type = (SQLUINTEGER) Value;
  			return ret;
  		case SQL_DESC_COUNT:
! 			parameter_bindings_set(opts, (SQLUINTEGER) Value, FALSE);
  			return ret;
  
  		case SQL_DESC_TYPE:
--- 659,668 ----
  			opts->param_offset_ptr = Value;
  			return ret;
  		case SQL_DESC_BIND_TYPE:
! 			opts->param_bind_type = (SQLUINTEGER) ((unsigned long) Value);
  			return ret;
  		case SQL_DESC_COUNT:
! 			parameter_bindings_set(opts, (SQLUINTEGER) ((unsigned long) Value), FALSE);
  			return ret;
  
  		case SQL_DESC_TYPE:
***************
*** 682,688 ****
  	{
  		case SQL_DESC_TYPE:
  			reset_a_parameter_binding(opts, RecNumber);
! 			opts->parameters[para_idx].CType = (Int4) Value;
  			break;
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
  			switch (opts->parameters[para_idx].CType)
--- 682,688 ----
  	{
  		case SQL_DESC_TYPE:
  			reset_a_parameter_binding(opts, RecNumber);
! 			opts->parameters[para_idx].CType = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
  			switch (opts->parameters[para_idx].CType)
***************
*** 691,697 ****
  				case SQL_C_TYPE_DATE:
  				case SQL_C_TYPE_TIME:
  				case SQL_C_TYPE_TIMESTAMP:
! 				switch ((Int4) Value)
  				{
  					case SQL_CODE_DATE:
  						opts->parameters[para_idx].CType = SQL_C_TYPE_DATE;
--- 691,697 ----
  				case SQL_C_TYPE_DATE:
  				case SQL_C_TYPE_TIME:
  				case SQL_C_TYPE_TIMESTAMP:
! 				switch ((Int4) ((long) Value))
  				{
  					case SQL_CODE_DATE:
  						opts->parameters[para_idx].CType = SQL_C_TYPE_DATE;
***************
*** 707,713 ****
  			}
  			break;
  		case SQL_DESC_CONCISE_TYPE:
! 			opts->parameters[para_idx].CType = (Int4) Value;
  			break;
  		case SQL_DESC_DATA_PTR:
  			opts->parameters[para_idx].buffer = Value;
--- 707,713 ----
  			}
  			break;
  		case SQL_DESC_CONCISE_TYPE:
! 			opts->parameters[para_idx].CType = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_DATA_PTR:
  			opts->parameters[para_idx].buffer = Value;
***************
*** 720,735 ****
  			}
  			break;
  		case SQL_DESC_OCTET_LENGTH:
! 			opts->parameters[para_idx].buflen = (Int4) Value;
  			break;
  		case SQL_DESC_OCTET_LENGTH_PTR:
  			opts->parameters[para_idx].used = Value;
  			break;
  		case SQL_DESC_PRECISION:
! 			opts->parameters[para_idx].precision = (Int2) ((Int4) Value);
  			break;
  		case SQL_DESC_SCALE:
! 			opts->parameters[para_idx].scale = (Int2) ((Int4) Value);
  			break;
  		case SQL_DESC_ALLOC_TYPE: /* read-only */
  		case SQL_DESC_DATETIME_INTERVAL_PRECISION:
--- 720,735 ----
  			}
  			break;
  		case SQL_DESC_OCTET_LENGTH:
! 			opts->parameters[para_idx].buflen = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_OCTET_LENGTH_PTR:
  			opts->parameters[para_idx].used = Value;
  			break;
  		case SQL_DESC_PRECISION:
! 			opts->parameters[para_idx].precision = (Int2) ((long) Value);
  			break;
  		case SQL_DESC_SCALE:
! 			opts->parameters[para_idx].scale = (Int2) ((long) Value);
  			break;
  		case SQL_DESC_ALLOC_TYPE: /* read-only */
  		case SQL_DESC_DATETIME_INTERVAL_PRECISION:
***************
*** 815,821 ****
  			ipdopts->param_processed_ptr = (UInt4 *) Value;
  			return ret;
  		case SQL_DESC_UNNAMED: /* only SQL_UNNAMED is allowed */
! 			if (SQL_UNNAMED !=  (SQLUINTEGER) Value)
  			{
  				ret = SQL_ERROR;
  				DC_set_error(desc, STMT_INVALID_DESCRIPTOR_IDENTIFIER,
--- 815,821 ----
  			ipdopts->param_processed_ptr = (UInt4 *) Value;
  			return ret;
  		case SQL_DESC_UNNAMED: /* only SQL_UNNAMED is allowed */
! 			if (SQL_UNNAMED !=  (SQLUINTEGER) ((unsigned long) Value))
  			{
  				ret = SQL_ERROR;
  				DC_set_error(desc, STMT_INVALID_DESCRIPTOR_IDENTIFIER,
***************
*** 823,829 ****
  			}
  			return ret;
  		case SQL_DESC_COUNT:
! 			parameter_ibindings_set(ipdopts, (SQLUINTEGER) Value, FALSE);
  			return ret;
  		case SQL_DESC_TYPE:
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
--- 823,829 ----
  			}
  			return ret;
  		case SQL_DESC_COUNT:
! 			parameter_ibindings_set(ipdopts, (SQLUINTEGER) ((unsigned long) Value), FALSE);
  			return ret;
  		case SQL_DESC_TYPE:
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
***************
*** 842,848 ****
  	{
  		case SQL_DESC_TYPE:
  			reset_a_iparameter_binding(ipdopts, RecNumber);
! 			ipdopts->parameters[para_idx].SQLType = (Int4) Value;
  			break;
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
  			switch (ipdopts->parameters[para_idx].SQLType)
--- 842,848 ----
  	{
  		case SQL_DESC_TYPE:
  			reset_a_iparameter_binding(ipdopts, RecNumber);
! 			ipdopts->parameters[para_idx].SQLType = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_DATETIME_INTERVAL_CODE:
  			switch (ipdopts->parameters[para_idx].SQLType)
***************
*** 851,857 ****
  				case SQL_TYPE_DATE:
  				case SQL_TYPE_TIME:
  				case SQL_TYPE_TIMESTAMP:
! 				switch ((Int4) Value)
  				{
  					case SQL_CODE_DATE:
  						ipdopts->parameters[para_idx].SQLType = SQL_TYPE_DATE;
--- 851,857 ----
  				case SQL_TYPE_DATE:
  				case SQL_TYPE_TIME:
  				case SQL_TYPE_TIMESTAMP:
! 				switch ((Int4) ((long) Value))
  				{
  					case SQL_CODE_DATE:
  						ipdopts->parameters[para_idx].SQLType = SQL_TYPE_DATE;
***************
*** 867,879 ****
  			}
  			break;
  		case SQL_DESC_CONCISE_TYPE:
! 			ipdopts->parameters[para_idx].SQLType = (Int4) Value;
  			break;
  		case SQL_DESC_PARAMETER_TYPE:
! 			ipdopts->parameters[para_idx].paramType = (Int2) ((Int4) Value);
  			break;
  		case SQL_DESC_SCALE:
! 			ipdopts->parameters[para_idx].decimal_digits = (Int2) ((Int4) Value);
  			break;
  		case SQL_DESC_ALLOC_TYPE: /* read-only */
  		case SQL_DESC_CASE_SENSITIVE: /* read-only */
--- 867,879 ----
  			}
  			break;
  		case SQL_DESC_CONCISE_TYPE:
! 			ipdopts->parameters[para_idx].SQLType = (Int4) ((long) Value);
  			break;
  		case SQL_DESC_PARAMETER_TYPE:
! 			ipdopts->parameters[para_idx].paramType = (Int2) ((long) Value);
  			break;
  		case SQL_DESC_SCALE:
! 			ipdopts->parameters[para_idx].decimal_digits = (Int2) ((long) Value);
  			break;
  		case SQL_DESC_ALLOC_TYPE: /* read-only */
  		case SQL_DESC_CASE_SENSITIVE: /* read-only */
***************
*** 1541,1552 ****
  	{
  #if (ODBCVER >= 0x0351)
  		case SQL_ATTR_ANSI_APP:
! 			if ((SQLUINTEGER)Value == SQL_AA_TRUE)
  				conn->unicode = 0;
  			break;
  #endif
  		case SQL_ATTR_METADATA_ID:
! 			conn->stmtOptions.metadata_id = (SQLUINTEGER) Value;
  			break;
  		case SQL_ATTR_ASYNC_ENABLE:
  		case SQL_ATTR_AUTO_IPD:
--- 1541,1552 ----
  	{
  #if (ODBCVER >= 0x0351)
  		case SQL_ATTR_ANSI_APP:
! 			if (Value == (PTR) SQL_AA_TRUE)
  				conn->unicode = 0;
  			break;
  #endif
  		case SQL_ATTR_METADATA_ID:
! 			conn->stmtOptions.metadata_id = (SQLUINTEGER) ((unsigned long) Value);
  			break;
  		case SQL_ATTR_ASYNC_ENABLE:
  		case SQL_ATTR_AUTO_IPD:
***************
*** 1556,1562 ****
  			CC_set_error(conn, STMT_OPTION_NOT_FOR_THE_DRIVER, "Unsupported connect attribute (Set)");
  			return SQL_ERROR;
  		default:
! 			ret = PGAPI_SetConnectOption(ConnectionHandle, (UWORD) Attribute, (UDWORD) Value);
  	}
  	return ret;
  }
--- 1556,1562 ----
  			CC_set_error(conn, STMT_OPTION_NOT_FOR_THE_DRIVER, "Unsupported connect attribute (Set)");
  			return SQL_ERROR;
  		default:
! 			ret = PGAPI_SetConnectOption(ConnectionHandle, (UWORD) Attribute, (UDWORD) ((unsigned long) Value));
  	}
  	return ret;
  }
***************
*** 1693,1702 ****
  			return SQL_ERROR;
  
  		case SQL_ATTR_METADATA_ID:		/* 10014 */
! 			stmt->options.metadata_id = (SQLUINTEGER) Value;
  			break;
  		case SQL_ATTR_APP_ROW_DESC:		/* 10010 */
! 			if (SQL_NULL_HDESC == Value)
  			{
  				stmt->ard = &(stmt->ardi);
  			}
--- 1693,1702 ----
  			return SQL_ERROR;
  
  		case SQL_ATTR_METADATA_ID:		/* 10014 */
! 			stmt->options.metadata_id = (SQLUINTEGER) ((unsigned long) Value);
  			break;
  		case SQL_ATTR_APP_ROW_DESC:		/* 10010 */
! 			if ((PTR) SQL_NULL_HDESC == Value)
  			{
  				stmt->ard = &(stmt->ardi);
  			}
***************
*** 1706,1712 ****
  			}
  			break;
  		case SQL_ATTR_APP_PARAM_DESC:	/* 10011 */
! 			if (SQL_NULL_HDESC == Value)
  			{
  				stmt->apd = &(stmt->apdi);
  			}
--- 1706,1712 ----
  			}
  			break;
  		case SQL_ATTR_APP_PARAM_DESC:	/* 10011 */
! 			if ((PTR) SQL_NULL_HDESC == Value)
  			{
  				stmt->apd = &(stmt->apdi);
  			}
***************
*** 1722,1728 ****
  			SC_get_APDF(stmt)->param_offset_ptr = (UInt4 *) Value;
  			break;
  		case SQL_ATTR_PARAM_BIND_TYPE:	/* 18 */
! 			SC_get_APDF(stmt)->param_bind_type = (SQLUINTEGER) Value;
  			break;
  		case SQL_ATTR_PARAM_OPERATION_PTR:		/* 19 */
  			SC_get_APDF(stmt)->param_operation_ptr = Value;
--- 1722,1728 ----
  			SC_get_APDF(stmt)->param_offset_ptr = (UInt4 *) Value;
  			break;
  		case SQL_ATTR_PARAM_BIND_TYPE:	/* 18 */
! 			SC_get_APDF(stmt)->param_bind_type = (SQLUINTEGER) ((unsigned long) Value);
  			break;
  		case SQL_ATTR_PARAM_OPERATION_PTR:		/* 19 */
  			SC_get_APDF(stmt)->param_operation_ptr = Value;
***************
*** 1734,1740 ****
  			SC_get_IPDF(stmt)->param_processed_ptr = (UInt4 *) Value;
  			break;
  		case SQL_ATTR_PARAMSET_SIZE:	/* 22 */
! 			SC_get_APDF(stmt)->paramset_size = (SQLUINTEGER) Value;
  			break;
  		case SQL_ATTR_ROW_BIND_OFFSET_PTR:		/* 23 */
  			SC_get_ARDF(stmt)->row_offset_ptr = (UInt4 *) Value;
--- 1734,1740 ----
  			SC_get_IPDF(stmt)->param_processed_ptr = (UInt4 *) Value;
  			break;
  		case SQL_ATTR_PARAMSET_SIZE:	/* 22 */
! 			SC_get_APDF(stmt)->paramset_size = (SQLUINTEGER) ((unsigned long) Value);
  			break;
  		case SQL_ATTR_ROW_BIND_OFFSET_PTR:		/* 23 */
  			SC_get_ARDF(stmt)->row_offset_ptr = (UInt4 *) Value;
***************
*** 1749,1758 ****
  			SC_get_IRDF(stmt)->rowsFetched = (UInt4 *) Value;
  			break;
  		case SQL_ATTR_ROW_ARRAY_SIZE:	/* 27 */
! 			SC_get_ARDF(stmt)->size_of_rowset = (SQLUINTEGER) Value;
  			break;
  		default:
! 			return PGAPI_SetStmtOption(StatementHandle, (UWORD) Attribute, (UDWORD) Value);
  	}
  	return SQL_SUCCESS;
  }
--- 1749,1758 ----
  			SC_get_IRDF(stmt)->rowsFetched = (UInt4 *) Value;
  			break;
  		case SQL_ATTR_ROW_ARRAY_SIZE:	/* 27 */
! 			SC_get_ARDF(stmt)->size_of_rowset = (SQLUINTEGER) ((unsigned long) Value);
  			break;
  		default:
! 			return PGAPI_SetStmtOption(StatementHandle, (UWORD) Attribute, (UDWORD) ((unsigned long) Value));
  	}
  	return SQL_SUCCESS;
  }
