|
fastdo
0.6.16
|
数据库连接接口 更多...
#include <eiendb_base.hpp>

Public 成员函数 | |
| virtual | ~IDbConnection () |
| virtual bool | connect () |
| 连接数据库 更多... | |
| virtual bool | close () |
| 关闭连接 更多... | |
| virtual void | alive () |
| 确保该连接有效(还活着) 更多... | |
| virtual bool | selectDb (winux::String const &database) |
| 选定要操作的数据库 更多... | |
| virtual bool | setLinkCharset (winux::String const &charset) |
| 设置连接校验字符集 更多... | |
| virtual bool | createDb (winux::String const &database) |
| 创建一个库 更多... | |
| virtual bool | dropDb (winux::String const &database) |
| 删除数据库 更多... | |
| virtual size_t | affectedRows () |
| 受影响的行数 更多... | |
| virtual size_t | insertId () |
| 获得最后一次完成记录插入时的ID值 更多... | |
| virtual int | errNo () |
| 获得错误号 更多... | |
| virtual winux::String | error () |
| 获得错误信息 更多... | |
| virtual winux::SharedPointer< IDbResult > | query (winux::String const &sql) |
| 查询数据结果 更多... | |
| virtual winux::SharedPointer< IDbResult > | query (winux::SharedPointer< IDbStatement > stmt) |
| 查询数据结果 更多... | |
| virtual bool | exec (winux::String const &sql) |
| 不需要数据的查询 更多... | |
| virtual bool | exec (winux::SharedPointer< IDbStatement > stmt) |
| 不需要数据的查询 更多... | |
| virtual winux::String | escape (winux::String const &str, winux::String const &addQuote="\'") |
| 普通文本转成SQL语句安全的文本,用做SQL语句的字符串 更多... | |
| virtual winux::String | escape (void const *buf, size_t size, winux::String const &addQuote="\'") |
| 二进制数据转成SQL语句安全的文本,用做SQL语句的字符串 更多... | |
| virtual winux::SharedPointer< IDbResult > | listDbs () |
| 获得所有数据库的一个结果集 更多... | |
| virtual winux::SharedPointer< IDbResult > | listFields (winux::String const &tableName) |
| 获得数据库里某表所有字段的一个结果集 更多... | |
| virtual winux::SharedPointer< IDbResult > | listTables () |
| 获得数据库里所有表的一个结果集 更多... | |
| virtual winux::String | tableDdl (winux::String const &tableName) |
| 取得一张表的DDL 更多... | |
| virtual winux::String | symbolQuotes (winux::String const &str, bool periodAsSeparator=true) |
| 加入标识符的引用标记。如表名、字段名等等 更多... | |
| virtual size_t | loadSqlFile (winux::IFile *sqlFile, winux::StringArray *arrSql) |
| 加载SQL文件到一个字符串数组,返回语句条数 更多... | |
| virtual size_t | getPrimaryKey (winux::String const &tableName, winux::StringArray *arrKeyColumn) |
| 取得表的主键,返回主键字段数 更多... | |
| virtual winux::SharedPointer< IDbStatement > | buildStmt (winux::String const &sql, winux::Mixed const ¶ms=winux::mxNull) |
| 构造一个语句对象 更多... | |
| virtual | operator bool () const =0 |
| 判断一个连接是否有效 更多... | |
数据库连接接口
在文件 eiendb_base.hpp 第 65 行定义.
|
inlinevirtual |
在文件 eiendb_base.hpp 第 67 行定义.
|
virtual |
连接数据库
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
关闭连接
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
确保该连接有效(还活着)
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
选定要操作的数据库
| database | 数据库名 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
设置连接校验字符集
| charset | 字符集 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
创建一个库
| database | 数据库名 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
删除数据库
| database | 数据库名 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
受影响的行数
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
获得最后一次完成记录插入时的ID值
您可以用执行SQL里的LAST_INSERT_ID()代替此函数
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
获得错误号
| 0 | 没有错误 |
| 非0 | 出错。可用error()查看错误信息 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
获得错误信息
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
查询数据结果
| sql | string |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
查询数据结果
| stmt | SharedPointer<IDbStatement> |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
不需要数据的查询
这函数可以用来执行INSERT、UPDATE、DROP等等一些不需要查询数据的操作
| sql | string |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
不需要数据的查询
这函数可以用来执行INSERT、UPDATE、DROP等等一些不需要查询数据的操作
| stmt | SharedPointer<IDbStatement> |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
普通文本转成SQL语句安全的文本,用做SQL语句的字符串
| str | String 需要换码的字符串 |
| addQuote | String 表示需要在首尾加上的引号,为空则不加 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
二进制数据转成SQL语句安全的文本,用做SQL语句的字符串
| buf | void const * |
| size | size_t |
| addQuote | winux::String const & |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
获得所有数据库的一个结果集
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
获得数据库里某表所有字段的一个结果集
| tableName | 表名 |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
获得数据库里所有表的一个结果集
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
取得一张表的DDL
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
加入标识符的引用标记。如表名、字段名等等
| str | 数据库各种对象标识符 |
| periodAsSeparator | 句点是否当作分隔符,默认true |
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
加载SQL文件到一个字符串数组,返回语句条数
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
取得表的主键,返回主键字段数
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
virtual |
构造一个语句对象
被 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 重载.
|
pure virtual |
判断一个连接是否有效
在 eiendb::PgsqlConnection, eiendb::SqliteConnection , 以及 eiendb::MysqlConnection 内被实现.