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

Peripheral Links

Header And Logo

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

Site Navigation

Search for
  Advanced Search

Bug in SQLColumns



The specification for SQLColumns states:

Column 16 CHAR_OCTET_LENGTH (INTEGER) 
Contains the maximum length in octets for a character data type column.
For Single Byte character sets, this is the same as COLUMN_SIZE. For
all other data types it is NULL.

However, as currently implemented in psqlodbc-08.02.0300, it is always
encoded as NULL.  Patch attached.

-- 
Tilghman
--- info.c.old	2007-07-27 18:04:07.000000000 -0500
+++ info.c	2007-07-27 18:04:16.000000000 -0500
@@ -2329,7 +2329,10 @@
 			set_tuplefield_null(&tuple[COLUMNS_COLUMN_DEF]);
 			set_tuplefield_int2(&tuple[COLUMNS_SQL_DATA_TYPE], sqltype);
 			set_tuplefield_null(&tuple[COLUMNS_SQL_DATETIME_SUB]);
-			set_tuplefield_null(&tuple[COLUMNS_CHAR_OCTET_LENGTH]);
+			if (the_type == PG_TYPE_CHAR || the_type == PG_TYPE_CHAR2 || the_type == PG_TYPE_CHAR4 || the_type == PG_TYPE_CHAR8 || the_type == PG_TYPE_NAME || the_type == PG_TYPE_BPCHAR || the_type == PG_TYPE_VARCHAR || the_type == PG_TYPE_TEXT || the_type == PG_TYPE_BYTEA || the_type == PG_TYPE_LO_UNDEFINED)
+				set_tuplefield_int4(&tuple[COLUMNS_CHAR_OCTET_LENGTH], pgtype_buffer_length(stmt, the_type, PG_STATIC, PG_STATIC));
+			else
+				set_tuplefield_null(&tuple[COLUMNS_CHAR_OCTET_LENGTH]);
 			set_tuplefield_int4(&tuple[COLUMNS_ORDINAL_POSITION], ordinal);
 			set_tuplefield_string(&tuple[COLUMNS_IS_NULLABLE], "No");
 #endif /* ODBCVER */


Home | Main Index | Thread Index

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