|  | @@ -588,7 +588,7 @@ BOOL CDatabase::QueryBrand(std::vector<STBranch>& vtBrand)
 | 
	
		
			
				|  |  |  	return TRUE;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -BOOL CDatabase::ImportLogo(std::string name, std::string file)
 | 
	
		
			
				|  |  | +BOOL CDatabase::ImportLogo(std::string brand, std::string file, BOOL bQuarter/*=FALSE*/)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |  	if (!PathFileExists(file.c_str()))
 | 
	
		
			
				|  |  |  		return FALSE;
 | 
	
	
		
			
				|  | @@ -597,8 +597,10 @@ BOOL CDatabase::ImportLogo(std::string name, std::string file)
 | 
	
		
			
				|  |  |  	return 0;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -BOOL CDatabase::ExportLogo(std::string name, std::string file)
 | 
	
		
			
				|  |  | +BOOL CDatabase::ExportLogo(std::string brand, std::string file, BOOL bQuarter/*=FALSE*/)
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	return 0;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -941,6 +943,262 @@ BOOL CDatabase::QueryUser(std::vector<STUser>& vtUser)
 | 
	
		
			
				|  |  |  	return TRUE;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +BOOL CDatabase::InsertBranch(const STBranch& branch)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, INSER_BRANCH, branch.name.c_str(), branch.quarter.c_str(), 
 | 
	
		
			
				|  |  | +		branch.address.c_str(), branch.provider.c_str(), branch.chip.c_str(), 
 | 
	
		
			
				|  |  | +		branch.type.c_str(), branch.status.c_str(), branch.note.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("InsertBranch error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::DeleteBranch(std::string branch)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, DEL_BRANCH, branch.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("DeleteBranch error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::UpdateBranch(std::string branch, const STBranch& stBranch)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, MOD_BRANCH, stBranch.quarter.c_str(), stBranch.address.c_str(), 
 | 
	
		
			
				|  |  | +		stBranch.provider.c_str(), stBranch.chip.c_str(), stBranch.type.c_str(), 
 | 
	
		
			
				|  |  | +		stBranch.status.c_str(), stBranch.note.c_str(),branch.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("UpdateBranch error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::QueryBranch(std::vector<STBranch>& vtBranch)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, QUERY_BRANCH)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("QueryBranch error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 获取表数据;
 | 
	
		
			
				|  |  | +	MYSQL_RES* pData = mysql_store_result(m_pConn);
 | 
	
		
			
				|  |  | +	if (pData == NULL) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("QueryBranch error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +	// 统计表字段;
 | 
	
		
			
				|  |  | +	unsigned int nLen = mysql_num_fields(pData);
 | 
	
		
			
				|  |  | +	// 字段长度是否一致;
 | 
	
		
			
				|  |  | +	if (nLen != 8) {
 | 
	
		
			
				|  |  | +		mysql_free_result(pData);
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 打印出字段名称;
 | 
	
		
			
				|  |  | +	TCHAR szLog[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	for (int i = 0; i < nLen; i++) {
 | 
	
		
			
				|  |  | +		_stprintf_s(szLog, _T("字段名称:%s\n"), mysql_fetch_field(pData)->name);
 | 
	
		
			
				|  |  | +		OutputDebugString(szLog);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 遍历数据;
 | 
	
		
			
				|  |  | +	MYSQL_ROW row;
 | 
	
		
			
				|  |  | +	while ((row = mysql_fetch_row(pData)) != NULL) {
 | 
	
		
			
				|  |  | +		STBranch stBranch;
 | 
	
		
			
				|  |  | +		stBranch.name = row[0];
 | 
	
		
			
				|  |  | +		stBranch.quarter = row[1];
 | 
	
		
			
				|  |  | +		stBranch.address = row[2];
 | 
	
		
			
				|  |  | +		stBranch.provider = row[3];
 | 
	
		
			
				|  |  | +		stBranch.chip = row[4];
 | 
	
		
			
				|  |  | +		stBranch.type = row[5];
 | 
	
		
			
				|  |  | +		stBranch.status = row[6];
 | 
	
		
			
				|  |  | +		stBranch.note = row[7];
 | 
	
		
			
				|  |  | +		vtBranch.push_back(stBranch);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 释放内存;
 | 
	
		
			
				|  |  | +	mysql_free_result(pData);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::InsertQBrand(const STQbrand& QBrand)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, INSER_QBRAND, QBrand.soc.c_str(), QBrand.brand.c_str(), QBrand.quarter.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.whitelist.c_str(), QBrand.version.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.oemkey.c_str(), QBrand.approved.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.approveddate.c_str(), QBrand.fingerprint.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.builddate.c_str(), QBrand.gtvs.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.ftpdir.c_str(), QBrand.codedir.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.note.c_str(), QBrand.status.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("InsertQBrand error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::DeleteQBrand(std::string soc, std::string quarter, std::string brand)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, DEL_QBRAND, soc.c_str(), brand.c_str(), quarter.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("DeleteQBrand error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::UpdateQBrand(std::string brand, STQbrand& QBrand)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, MOD_QBRAND, QBrand.soc.c_str(), QBrand.quarter.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.brand.c_str(), QBrand.whitelist.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.version.c_str(), QBrand.approved.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.oemkey.c_str(), QBrand.approveddate.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.fingerprint.c_str(), QBrand.builddate.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.gtvs.c_str(), QBrand.note.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.apps_cfg.c_str(), QBrand.fav_cfg.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.local_cfg.c_str(), QBrand.ftpdir.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.codedir.c_str(), QBrand.pre_apk.c_str(), QBrand.status.c_str(),
 | 
	
		
			
				|  |  | +		brand.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("UpdateQBrand error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::UpdateQBrand(std::string soc, std::string quarter, std::string brand, STQbrand& QBrand)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	TCHAR szSql[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	_stprintf_s(szSql, MOD_QBRAND, 
 | 
	
		
			
				|  |  | +		QBrand.soc.c_str(), QBrand.quarter.c_str(), QBrand.brand.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.whitelist.c_str(), QBrand.version.c_str(), QBrand.approved.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.oemkey.c_str(), QBrand.approveddate.c_str(), QBrand.fingerprint.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.builddate.c_str(), QBrand.gtvs.c_str(), QBrand.note.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.apps_cfg.c_str(), QBrand.fav_cfg.c_str(), QBrand.local_cfg.c_str(),
 | 
	
		
			
				|  |  | +		QBrand.ftpdir.c_str(), QBrand.codedir.c_str(), QBrand.pre_apk.c_str(), QBrand.status.c_str(),
 | 
	
		
			
				|  |  | +		brand.c_str());
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, szSql)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("UpdateQBrand error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +BOOL CDatabase::QueryQBrand(std::vector<STQbrand>& vtQBrand)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CHECKDB;
 | 
	
		
			
				|  |  | +	if (0 != mysql_query(m_pConn, QUERY_QBRAND)) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("QueryServer error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 获取表数据;
 | 
	
		
			
				|  |  | +	MYSQL_RES* pData = mysql_store_result(m_pConn);
 | 
	
		
			
				|  |  | +	if (pData == NULL) {
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +		TRACE1(_T("QueryServer error=%s\n"), m_pError ? m_pError : "");
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +#ifdef _DEBUG
 | 
	
		
			
				|  |  | +	// 统计表字段;
 | 
	
		
			
				|  |  | +	unsigned int nLen = mysql_num_fields(pData);
 | 
	
		
			
				|  |  | +	// 字段长度是否一致;
 | 
	
		
			
				|  |  | +	if (nLen != 19) {
 | 
	
		
			
				|  |  | +		mysql_free_result(pData);
 | 
	
		
			
				|  |  | +		return FALSE;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 打印出字段名称;
 | 
	
		
			
				|  |  | +	TCHAR szLog[MAX_PATH] = { 0 };
 | 
	
		
			
				|  |  | +	for (int i = 0; i < nLen; i++) {
 | 
	
		
			
				|  |  | +		_stprintf_s(szLog, _T("字段名称:%s\n"), mysql_fetch_field(pData)->name);
 | 
	
		
			
				|  |  | +		OutputDebugString(szLog);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +#endif
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 遍历数据;
 | 
	
		
			
				|  |  | +	MYSQL_ROW row;
 | 
	
		
			
				|  |  | +	while ((row = mysql_fetch_row(pData)) != NULL) {
 | 
	
		
			
				|  |  | +		STQbrand QBrand;
 | 
	
		
			
				|  |  | +		QBrand.soc = row[0];
 | 
	
		
			
				|  |  | +		QBrand.quarter = row[1];
 | 
	
		
			
				|  |  | +		QBrand.brand = row[2];
 | 
	
		
			
				|  |  | +		QBrand.whitelist = row[3];
 | 
	
		
			
				|  |  | +		QBrand.version = row[4];
 | 
	
		
			
				|  |  | +		QBrand.oemkey = row[5];
 | 
	
		
			
				|  |  | +		QBrand.approved = row[6];
 | 
	
		
			
				|  |  | +		QBrand.approveddate = row[7];
 | 
	
		
			
				|  |  | +		QBrand.fingerprint = row[8];
 | 
	
		
			
				|  |  | +		QBrand.builddate = row[9];
 | 
	
		
			
				|  |  | +		QBrand.gtvs = row[10];
 | 
	
		
			
				|  |  | +		QBrand.note = row[11];
 | 
	
		
			
				|  |  | +		QBrand.apps_cfg = row[12];
 | 
	
		
			
				|  |  | +		QBrand.fav_cfg = row[13];
 | 
	
		
			
				|  |  | +		QBrand.local_cfg = row[14];
 | 
	
		
			
				|  |  | +		QBrand.ftpdir = row[15];
 | 
	
		
			
				|  |  | +		QBrand.codedir = row[16];
 | 
	
		
			
				|  |  | +		QBrand.pre_apk = row[17];
 | 
	
		
			
				|  |  | +		QBrand.status = row[18];
 | 
	
		
			
				|  |  | +		vtQBrand.push_back(QBrand);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 释放内存;
 | 
	
		
			
				|  |  | +	mysql_free_result(pData);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return TRUE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  // 示例;
 | 
	
		
			
				|  |  |  void test(MYSQL* mysql)
 | 
	
		
			
				|  |  |  {
 | 
	
	
		
			
				|  | @@ -1129,3 +1387,56 @@ void test(MYSQL* mysql)
 | 
	
		
			
				|  |  |  		exit(0);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +void DBTest()
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	CDatabase db;
 | 
	
		
			
				|  |  | +	if (db.Init(_STR_HOST_, _STR_USER_, _STR_PASSWD_, _STR_DBNAME_))
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		if (1) {
 | 
	
		
			
				|  |  | +			db.InserSoc(_T("RT2851C"), _T("RealTealk"), _T("RTK台湾"));
 | 
	
		
			
				|  |  | +			db.InserSoc(_T("RT2851M"), _T("RealTealk2"), _T("RTK台湾"));
 | 
	
		
			
				|  |  | +			std::vector<STSOC> vtSOC;
 | 
	
		
			
				|  |  | +			db.QuerySoc(vtSOC);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			for (std::vector<STSOC>::iterator it = vtSOC.begin(); it != vtSOC.end(); it++) {
 | 
	
		
			
				|  |  | +				TRACE3(_T("name=%s, provider=%s, note=%s\n"), it->name.c_str(), it->provider.c_str(), it->note.c_str());
 | 
	
		
			
				|  |  | +				it->note = _T("xxxx1111xxx");
 | 
	
		
			
				|  |  | +				db.UpdateSoc(it->name, *it);
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if (0) {
 | 
	
		
			
				|  |  | +			CFile file;
 | 
	
		
			
				|  |  | +			BYTE* pImage = NULL;
 | 
	
		
			
				|  |  | +			DWORD dwLength = 0;
 | 
	
		
			
				|  |  | +			if (file.Open(_T("D:\\桌面\\logo\\channels\\AccuWeather.png"), CFile::modeRead))
 | 
	
		
			
				|  |  | +			{
 | 
	
		
			
				|  |  | +				dwLength = file.GetLength();
 | 
	
		
			
				|  |  | +				pImage = new BYTE[dwLength];
 | 
	
		
			
				|  |  | +				file.Read(pImage, dwLength);
 | 
	
		
			
				|  |  | +				file.Close();
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			db.SetBinaryField("update brand set logo = ? where `name`='SCBC'", pImage, dwLength);
 | 
	
		
			
				|  |  | +			if (pImage)
 | 
	
		
			
				|  |  | +				delete[]pImage;
 | 
	
		
			
				|  |  | +			pImage = NULL;
 | 
	
		
			
				|  |  | +			dwLength = 0;
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if (0)
 | 
	
		
			
				|  |  | +		{
 | 
	
		
			
				|  |  | +			BYTE* pImage = NULL;
 | 
	
		
			
				|  |  | +			DWORD dwLength = 0;
 | 
	
		
			
				|  |  | +			db.GetBinaryField("select logo from brand where `name`='SCBC';", (void**)&pImage, dwLength);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			CFile file;
 | 
	
		
			
				|  |  | +			if (file.Open(_T("D:\\11.png"), CFile::modeCreate | CFile::modeWrite))
 | 
	
		
			
				|  |  | +			{
 | 
	
		
			
				|  |  | +				file.Write(pImage, dwLength);
 | 
	
		
			
				|  |  | +				file.Close();
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +}
 |