char *end ;
char *szSql = new char[n*2+256];
memset(szSql ,0 ,n*2+256);
char *sqltemp =new char[200];
memset(sqltemp ,200 ,0);
sprintf(sqltemp ,"INSERT INTO scrlog(KeyLogID ,DoTime ,EID ,PicImage) VALUES(%d ,now(),%d," ,nKeyID ,m_nEID);
strcpy(szSql ,sqltemp );
delete[] sqltemp;
end = szSql;
end += strlen(szSql);
*end++ = '\'';
end += mysql_real_escape_string(m_pData, end, buf, n);
*end++ = '\'';
*end++ = ')';
Log(szSql);
int nflag = mysql_real_query(m_pData ,szSql ,(unsigned int)(end-szSql));
if(nflag != 0)
{
delete[] buf;
delete[] szSql;
buf = NULL ;
szSql = NULL ;
end = NULL ;
throw(mysql_error(m_pData));
return 1;
}
.....................这是一段保存二进制数据的代码 可郁闷的是 它老提示语法错误 !
char *szSql = new char[n*2+256];
memset(szSql ,0 ,n*2+256);
char *sqltemp =new char[200];
memset(sqltemp ,200 ,0);
sprintf(sqltemp ,"INSERT INTO scrlog(KeyLogID ,DoTime ,EID ,PicImage) VALUES(%d ,now(),%d," ,nKeyID ,m_nEID);
strcpy(szSql ,sqltemp );
delete[] sqltemp;
end = szSql;
end += strlen(szSql);
*end++ = '\'';
end += mysql_real_escape_string(m_pData, end, buf, n);
*end++ = '\'';
*end++ = ')';
Log(szSql);
int nflag = mysql_real_query(m_pData ,szSql ,(unsigned int)(end-szSql));
if(nflag != 0)
{
delete[] buf;
delete[] szSql;
buf = NULL ;
szSql = NULL ;
end = NULL ;
throw(mysql_error(m_pData));
return 1;
}
.....................这是一段保存二进制数据的代码 可郁闷的是 它老提示语法错误 !
解决方案 »
- mysql主从复制,使用从库从全库+增量备份时遇到的麻烦,急!!!
- SELECT * FROM User ORDER BY UserName Limit 80000, 20超慢,怎么优化?
- 问一下数据库性能的问题
- mysql的date类存入问题
- 安装mysql4.1出现问题
- 多个文本文件导入数据库
- linux下装mysql的问题
- DECLARE continue handler for not found是什么意思 非要在过程中出现吗
- 字符时间比较!!
- 我使用的是mysql4.1,但里面没有winmysqladmin这个工具啊,怎么回事?是不是省略了?感谢
- 怎么mysql-front不好用了
- 现次跪求跪求跪求
程序员的性福家园
http://shop34183365.taobao.com/
=======================================