freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: "Thompson, Bill D (London)" <ThompBil AT exchange.uk.ml.com>
- To: "'TDS Development Group'" <freetds AT franklin.oit.unc.edu>
- Subject: RE: Losing last character of TEXT fields
- Date: Wed, 10 Jul 2002 13:38:16 +0100
Freddy,
here's a lttle .txt document I'm working with, which describes the relvant
aspects of dblib dbconvert() and ctlib cs_convert()
As far as dbconvert goes, I (hope I) implemented the destlen functionality
in tds_convert_any().
As you may be aware though, not all the tds_convert_x functions in convert.c
use the tds_convert_any function.
This includes tds_convert_text(), hence (in my view) some of the problems
that have occurred - the handling of return data should be in one place
only!
<<destlen.txt>>
Bill
dbconvert precis (Sybase)
-------------------------
destlen - The length, in bytes, of the destination variable.
destlen is ignored for fixed-length datatypes.
For a SYBCHAR, SYBBOUNDARY or SYBSENSITIVITY destination,
the value of destlen must be the total length of the destination
buffer space.
The following table describes special values for destlen:
Special values for destlen (dbconvert)
destlen Applicable To Meaning
-1 SYBCHAR, SYBBOUNDARY, There is sufficient space available.
SYBSENSITIVITY The string will be trimmed of
trailing blanks
and given a terminating null.
-2 SYBCHAR There is sufficient space available.
The string will not be trimmed of
trailing blanks,
but will be given a terminating null.
Notes: SYBBOUNDARY and SYBSENSITIVITY destinations are always null-terminated.
dbconvert precis (Microsoft)
----------------------------
destlen - The length, in bytes, of the destination variable.
This length is used for the following desttype data type tokens:
SQLCHAR, SQLVARCHAR, SQLTEXT
SQLBINARY, SQLVARBINARY, SQLIMAGE
SQLINTN, SQLFLTN, SQLMONEYN, SQLDATETIMN
The destlen is ignored for all fixed-length, non-NULL data types.
When dest points to a DBCHAR string or a DBBINARY array,
the value of destlen must be the total length of the destination
buffer space,
or -1 to indicate that there is sufficient space available.
Note that when dest points to a DBCHAR string,
a destlen of -1 causes the character string to be given a
terminating null.
cs_convert precis
-----------------
destfmt - A pointer to a CS_DATAFMT structure describing the destination data
format.
The following table lists the fields in *destfmt that are used.
Field Name Set It To
---------- ---------
datatype A type constant representing the desired destination datatype
(CS_CHAR_TYPE, CS_BINARY_TYPE, and so on).
maxlength The length of the destdata buffer.
locale A pointer to a CS_LOCALE structure containing localization
values for the destination data, or NULL to use localization values from
*context.
format A bit mask of the following symbols:
For character and text destinations only,
use CS_FMT_NULLTERM to null-terminate the data,
or CS_FMT_PADBLANK to pad to the full length of the variable
with spaces.
For character, binary, text, and image destinations,
use CS_FMT_PADNULL to pad to the full length of the variable
with nulls.
When converting from a character source to a character
destination,
For any type of destination, use CS_FMT_UNUSED if no format
information is being provided.
my notes: obviously FMT_PADBLANK and FMT_PADNULL should be mutually
exclusive, although their
implementaion as bitmaps means it is possible to specify
both(!)
-
RE: Losing last character of TEXT fields
, (continued)
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Michael Peppler, 07/09/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/09/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/09/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/09/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/09/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/10/2002
- RE: Losing last character of TEXT fields, Bill Thompson, 07/10/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/10/2002
- RE: Losing last character of TEXT fields, Thompson, Bill D (London), 07/10/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/10/2002
- RE: Losing last character of TEXT fields, Thompson, Bill D (London), 07/10/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/10/2002
- RE: Losing last character of TEXT fields, James K . Lowden, 07/10/2002
- RE: Losing last character of TEXT fields, Thompson, Bill D (London), 07/10/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/10/2002
- RE: Losing last character of TEXT fields, ZIGLIO Frediano, 07/10/2002
- RE: Losing last character of TEXT fields, Lowden, James K, 07/10/2002
- RE: Losing last character of TEXT fields, Eric Deutsch, 07/10/2002
- RE: Losing last character of TEXT fields, Brian Bruns, 07/10/2002
Archive powered by MHonArc 2.6.24.