SQL2DBinaryWaveToTextWave and TextWave format

I am storing test results directly from Igor to MySQL database. For certain data (large 2D matrices) it felt convenient to compress data to BLOB format and just throw one column into the database. This is done using SQL2DBinaryWaveToTextWave() and then back with SQLTextWaveTo2DBinaryWave() commands. Everything works smoothly: uploading and downloading data from the database with Igor is super simple.

But now I would like to be able to read the data also with PHP web interface when there is no access to Igor, and now the previous design decisions don't feel that clever. The problem is with the TextWave format, which should be converted to readable form without using Igor (i.e. SQLTextWaveTo2DBinaryWave commands). Is this TextWave format unique Igor thing? Are there means to get a grip on this conversion?
Have you checked the contents of
Igor Pro Folder\Technical Notes\Igor Tech Notes\TN003 Igor binary format
already?
This documents the Igor binary format. Although I don't know if this is the format used by the SQL* operations.
The help for SQL2DBinaryWaveToTextWave says:
Quote:
SQL2DBinaryWaveToTextWave does not care about the number of rows and columns or data type of the input numeric wave. It treats each column merely as an array of bytes to be stored in a row of the output text wave.


So what is stored in the database is raw data. For example, if your 2D wave is 5 rows by 3 columns, single-precision floating point, then each record in the database will consist of 20 bytes (5 rows by 4 bytes per single-precision floating point value).

When you read it back into Igor using SQLTextWaveTo2DBinaryWave, Igor creates as 2D wave of type unsigned byte. You then must redimension it to the correct data type. This is explained in the help for SQLTextWaveTo2DBinaryWave. This is analogous to what you need to do in PHP - read a record as unsigned byte data and then reinterpret it as whatever data type it really is.
Thanks a lot thomas_braun and hrodstein! So, the problem was actually really easy to solve with your help. I just got confused what is happening under the hood when SQL2DBinaryWaveToTextWave etc are executed. In PHP simple unpack() with correct format does the trick.