哪位大侠知道:如何用 MySql++ 存取 Blob 字段啊?就是二进制字段,最好给个例子,不胜感激。。。 本帖最后由 HackerJLY 于 2013-01-29 09:58:14 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 百度很多啊http://www.cnblogs.com/haichang/archive/2011/04/03/2004359.html 读取搞定了void CprjMySqlPlusPlusTestDlg::OnBnClickedbtnbinaryread(){ // TODO: 在此添加控件通知处理程序代码 CString strTemp; mysqlpp::Connection ConnectionThis; bool bReturn = false; CString strMsg; size_t i; size_t j; char * pchar = NULL; const char * pconstchar = NULL; WCHAR * pwchar = NULL; string stringTemp; ostringstream ostringstreamThis; Face FaceThis; int iId = 0; int iLength = 0; void * pvoid = NULL; mysqlpp::sql_blob_null sql_blob_null_This; structTest structTestThis; //================================================================================================== //-------------------------------------------------------------------------------------------------- // Connect to the sample database. bReturn = ConnectionThis.connect("world", "localhost", "root", "root"); //ConnectionThis. if (!bReturn) { strTemp = ConnectionThis.error(); strMsg.Format(L"ConnectionThis.connect failed : %s", strTemp); MessageBox(strMsg); return; } m_strInfo.Empty(); // Retrieve a subset of the sample stock table set up by resetdb mysqlpp::Query QueryThis = ConnectionThis.query(); QueryThis << "SELECT * FROM FACE_LOG WHERE LOG_ID = 20"; mysqlpp::StoreQueryResult StoreQueryResultThis = QueryThis.store(); if(!StoreQueryResultThis) { strTemp = QueryThis.error(); strMsg.Format(L"QueryThis.store failed : %s", strTemp); MessageBox(strMsg); return; } sql_blob_null_This = StoreQueryResultThis[i][1]; iLength = sql_blob_null_This.data.length(); pconstchar = (const char *)sql_blob_null_This.data.data(); memcpy(&structTestThis, pconstchar, iLength); return;} MySQL数据库的查询速度每秒大约可以达到多少? mysql查表记录合并 MySql 导入文本如何禁止排序 数据库java时间不一致 MySQL NOT NULL / NULL 为什么我的mysql执行mysql_install_db后没有初始化数据库呢 救命!中文“纪璞”插入mysql的数据库,居然出错!为什么? linux环境下用c api成功连接过mysql的请进 升级到3.23.51后的错误提示! Struts链接数据库,出现一个问题,求助! 帮忙看下这个SQL语句怎么写呢?谢谢 MySQL性能偏低,请大牛帮分析
void CprjMySqlPlusPlusTestDlg::OnBnClickedbtnbinaryread()
{
// TODO: 在此添加控件通知处理程序代码
CString strTemp; mysqlpp::Connection ConnectionThis; bool bReturn = false; CString strMsg; size_t i; size_t j; char * pchar = NULL; const char * pconstchar = NULL; WCHAR * pwchar = NULL; string stringTemp;
ostringstream ostringstreamThis; Face FaceThis; int iId = 0; int iLength = 0; void * pvoid = NULL; mysqlpp::sql_blob_null sql_blob_null_This; structTest structTestThis;
//==================================================================================================
//--------------------------------------------------------------------------------------------------
// Connect to the sample database. bReturn = ConnectionThis.connect("world", "localhost", "root", "root");
//ConnectionThis.
if (!bReturn)
{
strTemp = ConnectionThis.error();
strMsg.Format(L"ConnectionThis.connect failed : %s", strTemp);
MessageBox(strMsg);
return;
} m_strInfo.Empty(); // Retrieve a subset of the sample stock table set up by resetdb
mysqlpp::Query QueryThis = ConnectionThis.query(); QueryThis << "SELECT * FROM FACE_LOG WHERE LOG_ID = 20";
mysqlpp::StoreQueryResult StoreQueryResultThis = QueryThis.store();
if(!StoreQueryResultThis)
{
strTemp = QueryThis.error();
strMsg.Format(L"QueryThis.store failed : %s", strTemp);
MessageBox(strMsg);
return;
} sql_blob_null_This = StoreQueryResultThis[i][1]; iLength = sql_blob_null_This.data.length(); pconstchar = (const char *)sql_blob_null_This.data.data(); memcpy(&structTestThis, pconstchar, iLength); return;
}