Skip to content
Prev 207397 / 398506 Next

Setting thevalue of max in calls to sqlGetResults

I have compiled and linked a 64 bit version of R (R 2.9.2) and the
corresponding unix ODBC 64 bit package

When issuing a SqlQuery, I get the following error
Error in .Call(C_RODBCFetchRows, attr(channel, "handle_ptr"), max,
buffsize,  :
  negative length vectors are not allowed
I know I can replace the call to sqlQuery with calls to its component
functions odbcQuery and sqlGetResults to get the same result (and the same
error)
nullstring=NA, na.strings="NA", believeNRows=TRUE, dec=getOption("dec"))
Which returns the same error, namely:
Error in .Call(C_RODBCFetchRows, attr(channel, "handle_ptr"), max,
buffsize,  :
  negative length vectors are not allowed
However, if I modify the value of max=0 (which means there is no limit to
the number of rows that can retrieved) to another value, the function
returns the correct value:
nullstring=NA, na.strings="NA", believeNRows=TRUE, dec=getOption("dec"))
              SYSDATE
1 2010-01-24 15:10:02
The issue is that, before issuing the query, I don't know how the size of
the resulting data frame. My question is: Is there a way to obtain the
value of the resulting data frame and using that as an argument to the max
parameter?

Alexander Chelminsky
Principal
CSC

GBS | p: +1 781 290 1620 | f: +1 781 890 1208 | m: +1 617 650 5453 |
achelminsky at csc.com | www.csc.com

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose.