56,677
社区成员
发帖
与我相关
我的任务
分享
m_pMysql = mysql_init(m_pMysql);
if (m_pMysql==NULL)
{
return false;
}
if(mysql_real_connect(m_pMysql,t_DBIp,t_DBUser,t_DBPasswd,t_DBName,t_DBPort,NULL,0))
{
if (mysql_query(m_pMysql,"set names utf8;")==0)
{
cout<<"OK"<<endl;
}
}
MYSQL_STMT *m_pStmt;
MYSQL_BIND m_ParamBind[8];
int t_store[8];
my_bool is_null[8];
const char *error = NULL;
memset( m_ParamBind ,0, sizeof(m_ParamBind) );
memset( t_store ,0, sizeof(t_store) );
//memset( is_null ,0, sizeof(is_null) );
n32 err = 0;
n8 quary[] = "call insert_dailytasks(?,?,?,?,?,?,?,?)";
for (int i=0; i<8; ++i)
{
t_store[i] = 10;
}
for (int a_nIdx=1; a_nIdx<8; ++a_nIdx)
{
m_ParamBind[a_nIdx].buffer = (void*)&t_store[a_nIdx];
m_ParamBind[a_nIdx].buffer_type = MYSQL_TYPE_LONG;
m_ParamBind[a_nIdx].is_null = &is_null[a_nIdx];
m_ParamBind[a_nIdx].length = 0;
is_null[a_nIdx] = 0;
}
unsigned long long t_RoleID = 578;
m_ParamBind[0].buffer_type = MYSQL_TYPE_LONGLONG;
m_ParamBind[0].buffer = (void*)&t_RoleID;
m_ParamBind[0].is_null = &is_null[0];
is_null[0] = 0;
m_pStmt = mysql_stmt_init(m_pMysql);
mysql_stmt_prepare(m_pStmt,quary,strlen(quary));
mysql_stmt_param_count(m_pStmt);
mysql_stmt_bind_param(m_pStmt, m_ParamBind);
//一执行到下面的语句就崩溃
mysql_stmt_execute(m_pStmt);