返回首页

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

更新日期:2024年09月11日

GBA-01BR-0004
错误码
错误标识
错误信息
GBA-01BR-0004

GBase config file open Error

GBase 8a MPP Cluster 产品手册
7 附录
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
1672
错误出现原因
打开gbase 配置文件失败
分析与建议
检查文件是否存在

开始一个数据库事务。

语法
[Visual Basic]
Public Function BeginTransaction As GBaseTransaction
[C#]
public GBaseTransaction BeginTransaction()


返回值
代表新事务的对象。

注释
这个命令等价于在GBase 数据库中执行BEGIN TRANSACTION 命令,用户必
须使用 Commit 方法提交事务,使用Rollback 方法回滚事务。
如果用户没有指定一个隔离级别,会使用默认的隔离级别。要使用



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

- 171 -
BeginTransaction 指定一个隔离级别,
可以使用带有IsolationLevel 的重载函
数。

异常
InvalidOperationException 异常
异常类型
条 件
InvalidOperationException
不支持并发事务。

示例
下面的例子中演示了如何使用BeginTransaction 的Commit 和 Rollback
方法。
[Visual Basic]
Public Sub RunTransaction(gsConnString As String)
Dim gsConnection As New GBaseConnection(gsConnString)
gsConnection.Open()
Dim gsCommand As GBaseCommand = gsConnection.CreateCommand()
Dim gsTrans As GBaseTransaction
' Start a local transaction
gsTrans = gsConnection.BeginTransaction()
' Must assign both transaction object and connection
' to Command object for a pending local transaction
gsCommand.Connection = gsConnection
gsCommand.Transaction = gsTrans
Try
gsCommand.CommandText
=
"Insert
into
Test
(id,
desc)
VALUES"
_ &" (100, 'Description')"
gsCommand.ExecuteNonQuery()
gsCommand.CommandText
=
"Insert
into
Test
(id,
desc)
VALUES"
_ &" (101, 'Description')"
gsCommand.ExecuteNonQuery()
gsTrans.Commit()
Console.WriteLine("Both records are written to
database.")
Catch e As Exception
Try

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


- 172 -

南大通用数据技术股份有限公司
gsTrans.Rollback()
Catch ex As GBaseException
If Not gsTrans.Connection Is Nothing Then
Console.WriteLine("An exception of type " + _
ex.GetType().ToString()
+
"
was
encountered
while
attempting
to
roll
back the transaction.")
End If
End Try
Console.WriteLine("An exception of type " +
e.GetType().ToString() + "was encountered while inserting the data.")
Console.WriteLine("Neither record was written to
database.")
Finally
gsConnection.Close()
End Try
End Sub
[C#]
public void RunTransaction(string gsConnString)
{
GBaseConnection gsConnection = new
GBaseConnection(gsConnString);
gsConnection.Open();
GBaseCommand gsCommand = gsConnection.CreateCommand();
GBaseTransaction gsTrans;
// Start a local transaction
gsTrans = gsConnection.BeginTransaction();
// Must assign both transaction object and connection
// to Command object for a pending local transaction
gsCommand.Connection = gsConnection;
gsCommand.Transaction = gsTrans;
try
{
gsCommand.CommandText
=
"insert
into
Test
(id,
desc)
VALUES
(100, 'Description')";
gsCommand.ExecuteNonQuery();
gsCommand.CommandText
=
"insert
into
Test
(id,
desc)
VALUES



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

- 173 -
(101, 'Description')";
gsCommand.ExecuteNonQuery();
gsTrans.Commit();
Console.WriteLine("Both
records
are
written
to
database.");
}
catch(Exception e)
{
try
{
gsTrans.Rollback();
}
catch (SqlException ex)
{
if (gsTrans.Connection != null)
{
Console.WriteLine("An exception of type " +
ex.GetType() +" was encountered while attempting to roll back the
transaction.");
}
}
Console.WriteLine("An exception of type " + e.GetType() +
" was encountered while inserting the data.");
Console.WriteLine("Neither record was written to
database.");
}
finally
{
gsConnection.Close();
}
}

语法
Logistic 回归的训练函数的语法如下:
logregr_train( source_table,
out_table,
dependent_varname,
independent_varname,
max_iter,
optimizer,
tolerance
)
参数说明

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

source_table:含训练数据的输入表。

out_table:保存训练结果的结果表。

dependent_varname:因变量的列名。因变量列应为布尔值,非布尔值会在处
理过程中被隐式转换为布尔值。

independent_varname:自变量的列名,数组类型。

max_iter:最大的迭代次数。

optimizer:迭代过程中使用的优化器。

tolerance:容忍度。两次迭代的对数似然差小于该值则结束迭代。
结果表说明
训练函数成功执行后,会创建保存模型信息的结果表,结果表包含如下字段用来
表示模型信息:

coef:相关系数,用于预测。

log_likelihood:对数似然值,训练中评估模型的参数。

std_err:相关系数的标准差。

z_stats:相关系数的z-统计量。

num_rows_processed:处理的数据行数。

num_missing_rows_skipped:略过的数据行数。

num_iterations:迭代次数。
摘要表说明
训练结束还会生出一个摘要表,其名为为结果表表名加上”_summary”,摘要表的
字段说明如下:

method:挖掘算法名称,为logregr。

source_table:输入表名。

out_table:结果表名。

dependent_varname:因变量名。

independent_varname:自变量名。

optimizer_params:优化器参数,最大迭代次数、容忍度等。

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

num_failed_groups:训练失败的分组数。

num_rows_processed:处理的数据行数。

num_missing_rows_skipped:略过的数据行数。