第三個(gè)工具類,QueryOperatorUpdate
負(fù)責(zé)處理:直接執(zhí)行sql方式下的,增、刪、改的需求。
用到了之前的DBOperator,主要是封裝其ExecQuery接口。
代碼很簡(jiǎn)單
QueryOperatorUpdate.h
#ifndef __QueryOperatorUpdate_H__#define __QueryOperatorUpdate_H__struct st_MySQL;typedef struct st_mysql MYSQL;namespace common{ namespace db{ class QueryOperatorUpdate { public: QueryOperatorUpdate(); ~QueryOperatorUpdate(); void Release(); // 執(zhí)行sql bool DoOperator(MYSQL *connect, const char *sql); }; }}#endifQueryOperatorUpdate.cpp#include "QueryOperatorUpdate.h"#ifdef WIN32#include <winsock2.h>#endif#include <stdio.h>#include <mysql.h>#include <string.h>#include <stdarg.h>#include "DBOperator.h"namespace common{ namespace db{ QueryOperatorUpdate::QueryOperatorUpdate() { } QueryOperatorUpdate::~QueryOperatorUpdate() { Release(); } void QueryOperatorUpdate::Release() { } bool QueryOperatorUpdate::DoOperator(MYSQL *connect, const char *sql) { if (NULL != connect && NULL != sql) { return DBOperator::ExecQuery(connect, sql); } else { return false; } } }}
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注