At 16:48 -0600 3/7/02, Kenneth Hylton wrote:
>I've posted this twice before - third time might be the charmer...
>Can anybody help me?
>I am using the C API and am returning a result set from a table with a BLOB
>type item in it.
>When I populate the BLOB fields initially (with all the same data) the
>length is returned properly when I issue SELECT * FROM <table> and decode
>the result set column metadata.
>Meaning, that if I put , "This Blob's for you!" in the column, the value of
>MYSQL_FIELDS.length = 65535 (max of BLOB type) and MYSQL_FIELDS.max_length =
>When I update a few rows and put, "That's OK man, but you still can't have
>my BLOB!" in a few columns, the values for the length of the fields are
>returned funny, or at least, I don't understand why they are returning they
>way they are.
>Meaning the value of the new column length are all set to
>MYSQL_FIELDS.length = 65535 (again, max of BLOB type) and
>MYSQL_FIELDS.max_length = 49. Problem is, this is even on the unchaged
>A little experimentation showed that if I select on only unchanged rows, the
>length is returned as 21. But, if the result set has one of the changed
>rows in it, the length of all blob fields is returned as 49, when (at least
>to me) it should be 21 or 49.
>In other words, it returns as the BLOB max_length value the value of the
>longest blob in the result set, NOT the max_length of each row. I inserted
Right. That's how it's supposed to work.
length = length of the underlying column type, as defined in the CREATE
max_length = length of the longest value actually present in the result set.
Neither of them indicate anything about particular values present in a
given row. If you want that, use mysql_fetch_lengths() to get a pointer
to an array of the lengths of the columns in the current row of the result
>(and updated) some records in the table with BLOB contents "It's all about
>the BLOB" and I see the same result. It returns not the length of the BLOB
>for the row, but the length of the longest BLOB field in the result set.
>We are running MySQL 3.23.46-Max on RedHat 7.2 Question:
>1) How do I get the actual length of the BLOB column in the row,
>without storing a separate column to maintain BLOB length manually?
>2) If this is not a problem because there is some other way to tell
>where the BLOB buffer ends, please let me know.