Re: [R] RODBC: longest string is truncated

From: Jerome Asselin <jerome.asselin_at_crchum.qc.ca>
Date: Thu 12 Oct 2006 - 01:34:00 GMT

On Wed, 11 Oct 2006 18:00:12 -0400
  "Yeh, Richard C" <richard.c.yeh@bankofamerica.com> wrote:
> Dear Jerome,
>
> Sorry, I'm not running your configuration. I cannot
>reproduce this
> problem with Sybase Adaptive Server IQ 12.6 and R 2.3.1
>+ RODBC 1.1.7 on
> WinXP SP2 or Linux 2.4.21-32.0.1.ELsmp #1 SMP Tue May 17
>17:52:23 EDT
> 2005 i686 i686 i386 GNU/Linux.
>
> -- ASIQ uses STRING() to mean CONCAT()
> -- ASIQ doesn't have the 'TEXT' data type
> CREATE TABLE test500
> (
> a VARCHAR(600) -- explicit length
> )
> GO
> INSERT INTO test500
> SELECT STRING(REPEAT('a',499),'1') -- should be a
>length-500 string
> GO
> INSERT INTO test500
> SELECT STRING(REPEAT('a',499),'12')
> GO
> INSERT INTO test500
> SELECT STRING(REPEAT('a',499),'123')
> GO
> SELECT LENGTH(a) FROM test500
> -- returns 500, 501, 502
>
> Then, in R (either platform):
>
>> library(RODBC)
>> channel = odbcConnect('DSN', believeNRows=FALSE) #
> believeNRows=FALSE required for ASIQ
>> b = sqlQuery(channel,"SELECT a FROM test500")
>> nchar(as.vector(b[[1]]))
> [1] 500 501 502

Thanks for the test. Seems like not all database engines are affected. I've tried your test on R 2.4.0 with RODBC 1.1-7 and MySQL 4.1.21 on Gentoo Linux. As with RHEL, I still observe:

> nchar(as.vector(b[[1]]))
[1] 500 501 501

Can anyone confirm the same?

Regards,
Jerome

-- 
Jerome Asselin, M.Sc., Agent de recherche, RHCE
CHUM -- Centre de recherche
3875 rue St-Urbain, 3e etage // Montreal QC  H2W 1V1
Tel.: 514-890-8000 Poste 15914; Fax: 514-412-7106

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu Oct 12 11:41:25 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 12 Oct 2006 - 02:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.