56,687
社区成员
发帖
与我相关
我的任务
分享
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;
}