zozlak / RODBCext

14 stars 10 forks source link

Support for reading varchar(max) column types #9

Closed zozlak closed 7 years ago

zozlak commented 8 years ago

On reading data from a database columns of type varchar(max) (used e.g. in Ms SQL Server) are treated as varchar(255). Longer values are simply truncated.

This is because varchar(max) reports its length as 0 which cause RODBC to use its default buffer length of 255 characters.

It should be investigated how to encourage RODBC to use longer default buffer or to extend it when data are truncated.

zozlak commented 7 years ago

Solved with 359506b3f51996151c95b09d10171c5c654844d4 (release 0.3.0)

I am pretty sure it is all I can do without rewriting RODBC functions actually fetching data.

Now if the driver does not provide column size, DEFAULT_BUFF_SIZE is assumed (at the moment 64kB) and the column size cap is set to MAX_BUFF_SIZE (at the moment 16MB).

If someone needs more, it is always possible to adjust these constants in src/RODBCext.h and rebuild the package.