According to this page in the online manual
http://www.mysql.com/doc/en/C_API_Prepared_statement_datatypes.html, the
length element of the MYSQL_BIND structure when set to 0 will treat the
buffer element as a NULL terminated string.  

If I do such a thing, prepare some query, bind some columns and execute
it, the string values inserted into the database are not correct.  What
it looks like it is doing is when length is 0, it uses buffer_length
instead of doing a strlen( buffer ).

To see this, try inserting some data with setting length, run a query
like SELECT CONCAT( 'x', <col>, 'x' ) FROM <table>;  You get back values
like xVALUEx

Now try inserting some data leaving length set to 0 and rerun the same
query as above and you get:

xVALUE   

The trailing x never gets displayed

So my question is, is this a bug in the API, a bug in the documentation,
or just an unfinished feature?  


--
Nathaniel Blanchard
Developer
Sane Solutions, LLC
401-295-4809 ext 142
401-295-4154 fax
[EMAIL PROTECTED]

This e-mail message may contain confidential information. If you are not
the intended recipient, any use, dissemination, distribution or copying
of this e-mail message is strictly prohibited. If you have received this
message in error, please immediately notify the sender and delete this
e-mail message from your computer.
 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to