以下是 LDbDriver 类成员的表格,按访问修饰符分类:
Public 成员:
| 成员 | 说明 |
|---|---|
| LDbDriver(LObject *parent = nullptr); | 构造函数,创建一个 LDbDriver 对象。|
| ~LDbDriver(); | 析构函数,销毁一个 LDbDriver 对象。|
| bool isOpen() const; | 判断数据库连接是否开启。|
| bool isOpenError() const; | 判断打开数据库连接是否出错。|
| bool beginTransaction(); | 开始事务。|
| bool commitTransaction(); | 提交事务。|
| bool rollbackTransaction(); | 回滚事务。|
| LVector tables(LSql::TableType tableType) const; | 返回数据库中的表的名称列表。|
| LDbIndex primaryIndex(const LString &tableName) const; | 返回指定表的主索引。|
| LDbRecord record(const LString &tableName) const; | 返回指定表的字段名。|
| LString formatValue(const LDbField& field, bool trimStrings = false) const; | 返回数据库字段的值的字符串表示形式。|
| LString escapeIdentifier(const LString &identifier, IdentifierType type) const; | 返回根据数据库规则转义的标识符。|
| LString sqlStatement(StatementType type, const LString &tableName, const LDbRecord &rec, bool preparedStatement) const; | 使用 'rec' 中的值为表 'tableName' 生成类型为 'type' 的 SQL 语句。|
| LDbError lastError() const; | 返回数据库发生的最后一个错误的信息。|
| LVariant handle() const; | 返回一个包装在变体类型中的数据库的句柄。|
| virtual bool hasFeature(DriverFeature f) const = 0; | 判断驱动程序是否支持某种功能。|
| virtual void close() = 0; | 关闭数据库连接。|
| virtual LDbResult *createResult() const = 0; | 在数据库上创建一个空的 SQL 结果集。|
| virtual bool open(const LString& db, const LString& user = LString(), const LString& password = LString(), const LString& host = LString(), int port = -1, const LString& connOpts = LString()) = 0; | 根据用户名、密码、主机名、端口号和连接选项打开数据库连接。|
| virtual bool subscribeToNotification(const LString &name); | 订阅数据库的事件通知。|
| virtual bool unsubscribeFromNotification(const LString &name); | 取消已订阅的数据库事件通知。|
| virtual LVector subscribedToNotifications() const; | 返回当前订阅的事件通知的名称列表。|
| virtual bool isIdentifierEscaped(const LString &identifier, IdentifierType type) const; | 判断标识符 'identifier' 是否已根据数据库规则进行转义。|
| virtual LString stripDelimiters(const LString &identifier, IdentifierType type) const; | 返回删除了头尾分隔符的标识符。|
| void setNumericalPrecisionPolicy(LSql::NumericalPrecisionPolicy precisionPolicy); | 设置此驱动程序创建的查询类对象使用的默认数值精度策略。|
| LSql::NumericalPrecisionPolicy numericalPrecisionPolicy() const; | 返回数据库连接的当前默认精度策略。|
| DbmsType dbmsType() const; | 获取当前数据库的类型。|
| virtual bool cancelQuery(); | 取消当前正在进行的 SQL 查询。|
Protected 成员:
| 成员 | 说明 |
|---|---|
| void setOpen(bool o); | 设置数据库打开状态 'isOpen' 标志。|
| void setOpenError(bool e); | 设置数据库打开错误 'isopen' 标志。|
| void setLastError(const LDbError& e); | 设置数据库上发生的最后一个错误 'error' 的值。|
Private 成员:
| 成员 | 说明 |
|---|---|
| LDbDriver(const LDbDriver &) = delete; | 删除拷贝构造函数。|
| LDbDriver &operator=(const LDbDriver &) = delete; | 删除赋值运算符。