如何在MYSQL BLOB字段中保存Blob数据? [英] How to save the blob data in MYSQL BLOB field?

查看:2117
本文介绍了如何在MYSQL BLOB字段中保存Blob数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Am使用以下代码从存储在本地磁盘中的图像文件中获取Blob数据.我想将该Blob数据保存到数据库的Blob字段中.

CLongBinary m_BLOBImage;
	CFileStatus fileStatus;
	strfile.GetStatus(fileStatus);
        CString m_BLOBName = strfile.GetFileTitle();
        m_BLOBImage.m_dwDataLength = fileStatus.m_size;
	SIZE_T dwbytes=(SIZE_T)fileStatus.m_size;
        HGLOBAL hGlobal		= GlobalAlloc(GPTR,dwbytes);
        m_BLOBImage.m_hData = GlobalLock(hGlobal);
	strfile.Read(dbImages.m_BLOBImage.m_hData,(UINT)fileStatus.m_size);



如何使用CRecordSet将在m_BlobImage.m_hData中找到的此blob数据保存到数据库中的blob字段中.创建一个单独的文件,仅将链接/psth保存到该文件. ->性能


Am using the following code to get the blob data from the image file stored in the local disk.. I want to save that blob data into the blob field of database.

CLongBinary m_BLOBImage;
	CFileStatus fileStatus;
	strfile.GetStatus(fileStatus);
        CString m_BLOBName = strfile.GetFileTitle();
        m_BLOBImage.m_dwDataLength = fileStatus.m_size;
	SIZE_T dwbytes=(SIZE_T)fileStatus.m_size;
        HGLOBAL hGlobal		= GlobalAlloc(GPTR,dwbytes);
        m_BLOBImage.m_hData = GlobalLock(hGlobal);
	strfile.Read(dbImages.m_BLOBImage.m_hData,(UINT)fileStatus.m_size);



How to use the CRecordSet to save this blob data found in m_BlobImage.m_hData to the blob field in the database.

解决方案

if the data is big it may be better to create a seperate file and only save the link/psth to it. ->performance


这篇关于如何在MYSQL BLOB字段中保存Blob数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆