Bug in SQLColumns
am 28.07.2007 01:08:09 von Tilghman Lesher--Boundary-00=_ZrnqGBPtxFofs6O
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
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
--Boundary-00=_ZrnqGBPtxFofs6O
Content-Type: text/plain;
charset="us-ascii";
name="20070727__octet_length.diff.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="20070727__octet_length.diff.txt"
--- 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 */
--Boundary-00=_ZrnqGBPtxFofs6O
Content-Type: text/plain
Content-Disposition: inline
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org
--Boundary-00=_ZrnqGBPtxFofs6O--