[freetds] [PATCH bcp.c:_bcp_read_hostfile] don't trim trailing spaces when all spaces
Craig A. Berry
craigberry at mac.com
Sun Dec 18 23:37:32 EST 2005
When bulking in character data, we currently trim trailing spaces, which
in general seems like the right thing to do with one exception. The
exception is when a field is all spaces; I don't think we should trim
those to nothing because then we end up inserting nulls in what may or
may not be nullable fields. The attached patch changes behavior so that
we only trim trailing spaces when one or more characters is not a space.
The behavior I'm proposing appears to be consistent with what I'm seeing
in an old Sybase client. I have not done any comparison with Microsoft
clients, but I think we can justify the change on the principle of
round-trip integrity. We should be able to bulk out a table, truncate
it, bulk it back in, and get the same thing we started with. If there
are non-nullable fields containing all spaces, that will not be true
before the patch, but it will be true after. Granted, application
validation logic that allows all spaces in a non-nullable field is
arguably lousy, but that's not a battle that bcp should be fighting.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bcp.patch
Url: http://lists.ibiblio.org/pipermail/freetds/attachments/20051218/95e239c1/bcp.bat
More information about the FreeTDS
mailing list