日期:2014-05-16 浏览次数:20863 次
DataBase_IsErrorOccur = FALSE;
NETDATABASE_MYSQLHANDLE st_hDatabaseMySQL;
memset(&st_hDatabaseMySQL,'\0',sizeof(st_hDatabaseMySQL));
if (!m_hNetComponents.NetEngine_LibHandleEx_Get(xhNet,&st_hDatabaseMySQL))
{
return FALSE;
}
//撤消自动提交模式
if (0 != mysql_autocommit(&st_hDatabaseMySQL.st_MySQL,FALSE))
{
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_CANCEAUTOCOMMIT;
return FALSE;
}
//执行SQL语句
if (0 != mysql_query(&st_hDatabaseMySQL.st_MySQL,lpszSQLQuery))
{
printf("数据库查询错误:%s,SQL语句:%s\n",mysql_error(&st_hDatabaseMySQL.st_MySQL),lpszSQLQuery);
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_ISFAILED;
return FALSE;
}
//如果没有成功
if (0 != mysql_commit(&st_hDatabaseMySQL.st_MySQL))
{
//回滚事务
mysql_rollback(&st_hDatabaseMySQL.st_MySQL);
mysql_autocommit(&st_hDatabaseMySQL.st_MySQL,TRUE);
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_COMMIT;
return FALSE;
}
//恢复自动提交模式
if (0 != mysql_autocommit(&st_hDatabaseMySQL.st_MySQL,TRUE))
{
DataBase_IsErrorOccur = TRUE;
DataBase_dwErrorCode = ERROR_HELPCOMPONENTS_DATABASE_MYSQL_EXEC_AUTOCOMMIT;
return FALSE;
}
return TRUE;
(gdb) bt
#0 0xb7767424 in __kernel_vsyscall ()
#1 0xb74f71df in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb74fa825 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0xb753439a in ?? () from /lib/i386-linux-gnu/libc.so.6
#4 0xb753eee2 in ?? () from /lib/i386-linux-gnu/libc.so.6
#5 0xb72b3e9e in my_no_flags_free (ptr=0x0) at /export/home2/tmp/cteam/bs/connector-c-32bit/src/mysql-connector-c-6.0.2/mysys/my_malloc.c:65
#6 0xb72952f6&