返回首页

gbase数据、南大通用产品文档:GBase8aENGINES

更新日期:2024年09月11日

功能说明
关于引擎的信息。
表结构说明
表5- 211 表结构信息说明:




ENGINE
引擎名称
SUPPORT
数据库是否支持使用

GBase 8a MPP Cluster 产品手册
5 数据库管理指南
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1466




COMMENT
对于引擎的简单介绍
TRANSACTIONS
是否支持事务处理[YES|NO]
XA
是否支持分布式事务处理[YES|NO]
SAVEPOINTS
是否支持事务的savepoint 回滚方式

代表GBase 数据源中只进且只读的数据流,此类不能被继承。对于该类所
有成员的列表,参考 GBaseDataReader 成员。

继承层次
System.Object
|__ System.MarshalByRefObject
|__ System.Data.Common.DbDataReader
|__ GBase.Data.GBaseClient.GBaseDataReader


语法
[ Visual Basic ]
Public NotInheritable Class GBaseDataReader _

Inherits DbDataReader _

Implements IDataReader, IDisposable, IDataRecord
[ C# ]
public sealed class GBaseDataReader : DbDataReader,

IDataReader, IDisposable, IDataRecord

必要条件
命名空间:GBase.Data.GBaseClient

线程安全性
这个类型的公共静态成员(在Visual Basic 中为 Shared)对于多线程操
作是保证线程安全的,对于实例不保证线程安全性。

注释

GBase 8a 程序员手册ADO.NET 篇


- 204 -

南大通用数据技术股份有限公司
要创建一个GBaseDataReader,用户必须调用GBaseCommand 对象的
ExecuteReader 方法。
IsClosed 和 RecordsAffected 是唯一能够在GBaseDataReader 关闭后调
用的属性。尽管RecordsAffected 属性可以在GBaseDataReader 存在的任何时
间访问,也总是在调用了Close 之后才调用RecordsAffected 来保证获得准确
的返回值。
由于GBaseDataReader 提供只进的只读数据访问方式,如果用户试图修改
使用诸如GetValue 返回的数值,就会出现警告。

示例
下面的例子演示创建了GBaseDataReader 对象后,使用GBaseDataReader
对象读取数据并将结果打印到控制台。
[Visual Basic]
Public Sub ReadGsData(gsConnString As String)
Dim
gsSelectQuery
As
String
=
"SELECT
OrderID,
CustomerID
FROM"_
&"Orders"
Dim gsConnection As New GBaseConnection(gsConnString)
Dim gsCommand As New GBaseCommand(gsSelectQuery, gsConnection)
gsConnection.Open()
Dim gsReader As GBaseDataReader
gsReader = gsCommand.ExecuteReader()
' Always call Read before accessing data.
While gsReader.Read()
Console.WriteLine((gsReader.GetInt32(0) & ", " &_
gsReader.GetString(1)))
End While
' always call Close when done reading.
gsReader.Close()
' Close the connection when done with it.
gsConnection.Close()
End Sub 'ReadGsData




GBase 8a 程序员手册ADO.NET 篇
南大通用数据技术股份有限公司

- 205 -
[C#]
public void ReadGsData(string gsConnString)
{
string
gsSelectQuery
=
"SELECT
OrderID,
CustomerID
FROM
Orders";
GBaseConnection gsConnection = new
GBaseConnection(gsConnString);
GBaseCommand gsCommand = new
GBaseCommand(gsSelectQuery,gsConnection);
gsConnection.Open();
GBaseDataReader gsReader;
gsReader = gsCommand.ExecuteReader();
//Always call Read before accessing data.
while (gsReader.Read())
{
Console.WriteLine(gsReader.GetInt32(0) + ", " +
gsReader.GetString(1));
}
// always call Close when done reading.
gsReader.Close();
// Close the connection when done with it.
gsConnection.Close();
}

有两种方法启用 ODBC 应用程序的 AUTOFREE 功能。
使用 SQLSetConnectAttr 设置 SQL_INFX_ATTR_AUTO_FREE 属性时,可以在 C2 和
C5 之间
(包括两者)
的任何连接状态中进行设置,
而只有当语句处于 S1 (分配)
状态时,
才可以使用 SQLSetStmtAttr 设置 SQL_INFX_ATTR_AUTO_FREE 属性。可以通过使用
SQLGetConnectAttr 或 SQLSetStmtAttr 检索 SQL_INFX_ATTR_AUTO_FREE 属性的值。

可以是使用以下方法启用 ODBC 应用程序的 AUTOFREE 功能:
 使用 SQLSetConnectAttr 设置 SQL_INFX_ATTR_AUTO_FREE 属性。
当您使用 SQLSetConnectAttr启用该属性时,该连接的所有的新的语句都会继承该值。
更改该属性的唯一方法是设置每一条语句并将它重新设置为语句的属性。
连接属性缺
省为 DISABLED 。

GBase 8s ODBC Driver 程序员指南
南大通用数据技术股份有限公司
- 190 -
 使用 SQLSetStmtAttr 设置 SQL_INFX_ATTR_AUTO_FREE 属性。