I am having trouble storing a "string" of charaters (encoded from a whole number value) in a blob field. I can produce the character sequence with php functions. However, the database seems to add a few characters to the string value I supply between quotes in an UPDATE query . Does any php function predict what is happening in the UPDATE statement here so that I can retrieve to same sequence I intended to store?
I am building a web application that saves and retrieves data from mySQL - often as a series of numeric values (of specific data type and size) laid down in blob fields.
Retieval from blob fields is straight-forward using SELECT SQL in a mysql_query() - I can divide up the field result as though it was a string.
Laying down a predictable series of numeric values in a bolb field is difficult but possible using LOAD DATA INFILE. The numeric value can be encoded into bytes - values ranging 0 - 255, each byte is understood to require multiplication by 256 to the power of its position - 1 in the sequence. The value of each byte can be converted to a character - sometimes escaped with slashes:
Using LOAD DATA INFILE is clearly inelegant for single assignments but an UPDATE query just seems to add bytes to the blob which I don't understand.
As I said, is there any php functions that can predictably reproduce what happened to the blob field or even decode it back?
UPDATE statement with blob fields
No replies to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users