Please Help, can't read Blob data from MySql
Posted: Mon Nov 02, 2015 8:22 am
Hi All i have been trying to read a BLOB field from my Mysql database and display it in a datagrid.
I have loaded the blob field using MySql "load value from file" function when you right click on the BLOB field in the MySql result grid.
When i read the BLOB field i get funny characters like ÿØÿà.
see code below.
When i look at the value that is read into MyPicture it is ÿØÿà, should it not be the name of the Picture file, or am i missing something here?
I have loaded the blob field using MySql "load value from file" function when you right click on the BLOB field in the MySql result grid.
When i read the BLOB field i get funny characters like ÿØÿà.
see code below.
Code: Select all
on mouseUp
get_database_data
end mouseUp
command get_database_data
global gConnectionID, gDetailList
put revOpenDatabase("MySQL","xxxxxxxxxxxx:3307","xxxxxxx","xxxxxxxx","xxxxxxx") into gConnectionID
put "SELECT UserName, MyPicture From PotUser" into tDetails
put revQueryDatabaseBLOB( gConnectionID, tDetails) into gDetailList
ConvertSQLCursorToArray gDetailList, theDataGridArray
revCloseCursor gDetailList
revCloseDatabase gConnectionID
set the dgData of group "DataGrid1" to theDataGridArray
end get_database_data
Code: Select all
command ConvertSQLCursorToArray pCursor, @pOutArrayA
local i
local theFields
local theError
## Get the names of all the columns in the database cursor
put revDatabaseColumnNames(pCursor) into theFields
if theFields begins with "revdberr," then
put item 2 to -1 of theFields into theError
end if
if theError is empty then
put 0 into i
## Loop through all rows in cursor
repeat until revQueryIsAtEnd(pCursor)
add 1 to i
## Move all fields in row into next dimension of the array
repeat for each item theField in theFields
if theField = "MyPicture" Then
put revDatabaseColumnNamed(pCursor, theField) into pOutArrayA[i][ theField ]
else
put revDatabaseColumnNamed(pCursor, theField) into pOutArrayA[i][ theField ]
end if
end repeat
revMoveToNextRecord pCursor
end repeat
end if
return theError
end ConvertSQLCursorToArray