Hi There,
I am trying to insert blob in table and then retrieve it from table using
Linux shell. Here is script that i used.

Load Blob into DB and Retrieve it using linux shell.
# add firmware into DB
ACTION="insert into FIRMWARE
(firmwarename, releasedate, bootcodename, usermanualname, releasenotes,
checksum, hwrevision, comments, dependencyfwid)
values (\"$FWNAME\", \"$RELDATE\", \"$BOOTNAME\", \"$MANUAL\",
LOAD_FILE(\"$FW/$1/$BRNOTES\"), \"$CHECK\", \"$HWREV\", \"$COMMENT\",
$FWDEPID);
VALUE=`echo "$ACTION" | mysql -u$APMU -p$APMPW -h$HOSTDB -D$APMDB`
if [ $? != 0 ]; then
echo $ACTION >> $LOG
echo $VALUE >> $LOG
echo [DBERR-002] >> $LOG
continue
fi

select length(firmwareimage) from FIRMWARE where firmwareid=129;


+-----------------------+
| length(firmwareimage) |
+-----------------------+
|               3763016 |
+-----------------------+

It shows the correct size of binary file

# get  blob from Database

ACTION="select firmwareimage from FIRMWARE where status !='Deleted' and
firmwareid=$1 ;"
VALUE=`echo "$ACTION" | mysql -u$APMU -p$APMPW -h$HOSTDB -D$APMDB`
if [ $? != 0 ]; then
echo $ACTION >> $LOG
echo [DBERR-001] >> $LOG
continue
fi
echo $VALUE > /tmp/tmp_129.bin

[EMAIL PROTECTED] tmp]# diff ts_129.bin tmp_129.bin
Binary files ts_129.bin and tmp_129.bin differ

Retrieved binary file size increases. Does anyone know about this issue and
how to fix it.


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

Reply via email to