📄 iconnection.h
字号:
/**
* IConnection.h
*
* @author aizy
* @date 2004-11-24
*/
#ifndef _DB_ICONNECTION_H_
#define _DB_ICONNECTION_H_
#include <vector>
#include <string>
#include "IStatement.h"
#include "ICallableStatement.h"
namespace db {
/**
* 数据库连接接口
*/
class IConnection {
protected:
virtual ~IConnection(){};
public:
/**
* 创建CallableStatement
* 注意:该函数只负责创建ICallableStatement,不负责对其进行释放;
* 调用者需要在外部进行释放,调用ICallableStatement的Close函数
* 进行释放。
*
* @param sql sql语句
* @return ICallableStatement
* @throw SqlException 数据库访问错误时抛出该异常
*/
virtual ICallableStatement *PrepareCall(const std::string &sql) = 0;
/**
* 创建IStatement
* 注意:该函数只负责创建IStatement,不负责对其进行释放;
* 调用者需要在外部进行释放,调用IStatement的Close函数
* 进行释放。
*
* @return IStatement
* @throw SqlException 数据库访问错误时抛出该异常
*/
virtual IStatement *CreateStatement() = 0;
/**
* 关闭连接
* 注意:该函数内部需要释放IConnection实例
*/
virtual void Close() = 0;
/**
* 设置提交模式
*/
virtual void SetAutoCommit(bool autoCommit) = 0;
/**
* 取提交模式
*/
virtual bool GetAutoCommit() = 0;
/**
* 提交在该连接上所做的所有操作
*/
virtual void Commit() = 0;
/**
* 回滚在该连接上所做的所有操作
*/
virtual void Rollback() = 0;
};
}
#endif //_DB_ICONNECTION_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -