Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
"segment fault " when using mysql++

"segment fault " when using mysql++

2007-08-01       - By Warren Young

 Back
I'm replying to you both personally and to the MySQL++ mailing list,
where this message is on topic.  Please reply only on the list, not to
me directly.

wangxu wrote:
> below is my code;these code works very fine until, the length of the
> field "content"  exceeds 300000,

How certain are you about this threshold?  It seems a very odd number
for a computer to care about.  If you'd said 65536 bytes, or 16.7 MB,
I'd put a lot more credence in your assertion.

>                mysqlpp::Row r;
>                while (r = res.fetch_row()) {
>                        printf (r["content"]);
>              }

I'm not sure it's the problem, but you really shouldn't use printf() for
this.  The main reason is that printf() will scan the resulting string
for % signs and try to interpret them as formatting options.  If it
finds any, it will then try to find varargs, and fail; this would easily
explain your segfault.  The byte count does affect the chances that this
will happen, so maybe that's where your perception that it's data size
related comes from.

Other reasons not to use printf() with MySQL++ data types are
inefficiency and type safety.

See examples/cgi_jpeg.cpp for the right way to emit bulk MySQL++ to stdout.



--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql@(protected)