List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:October 12 2007 6:22am
Subject:Re: varchar field > 65K
View as plain text  
John Gehring wrote:
> I am adding records to my MySQL database that contains a column of type
> 'mediumtext' (call it ColA). The amount of data is roughly 75K bytes. If I
> use the SELECT ... INTO OUTFILE ... statement to get the data, I
> successfully get all the data of the record. However, if I use a select
> statement within an embedded application (using mysql++), the data from ColA
> is truncated at 65K bytes.

Things to check:

- What character set are you using?  Unicode character representations 
may do surprising things when processed by naive code.  See chapter 6 in 
the user manual.

- "65K" bothers me.  Are you using SI suffixes here -- 65,000 bytes -- 
or do you mean that it's actually getting over the special 64K boundary?

- Are you sure you don't need a BLOB column here?  Or, at least treating 
it with the precautions due a BLOB column?  See examples/load_jpeg.cpp 
and examples/cgi_jpeg.cpp.

> I see quite a bit of documentation for the mysql
> embedded library related to binding data for result sets. But I don't see
> anyplace in the mysql++ code that uses that functionality (like
> mysql_stmt_bind_result()).

Yes, but there's no requirement to use those APIs.  MySQL++ takes the 
traditional approach: it uses text representations of data, in plain old 
SQL forms.  You must use BLOBs to get bit-for-bit accuracy, and even 
then, it goes across the wire in escaped text form.

> Am I missing something, or does the mysql++
> library have a limit on how large a field of data can be returned from a
> select statement?

MySQL++ imposes no limits above what the underlying C API does.  That's 
not to say that you can't abuse the library to make it truncate data, 
just that there are proper ways to get the data without truncation.
varchar field > 65KJohn Gehring12 Oct
  • Re: varchar field > 65KWarren Young12 Oct