点击或拖拽改变大小

SQLErrorInfo 类

X#
描述一个 SQL 错误。
继承层次
Object
  Exception
    Error
      SQLErrorInfo

命名空间:  XSharp.VO.SDK
程序集:  XSharp.VOSQLClasses (在 XSharp.VOSQLClasses.dll 中) 版本:2.22 GA
语法
[TypesChangedAttribute]
 CLASS SQLErrorInfo INHERIT Error
查看代码

SQLErrorInfo 类型公开以下成员。

构造函数
  名称说明
公共方法SQLErrorInfo
构造一个 SQLErrorInfo 对象。
Top
属性
  名称说明
公共属性Arg
A string representing the argument supplied to an operator or function when an argument error occurs.
(继承自 Error。)
公共属性ArgNum
A numeric value representing the number of the argument supplied to an operator or function when an argument error occurs.
(继承自 Error。)
公共属性Args
An array of the arguments supplied to an operator or function when an argument error occurs.
(继承自 Error。)
公共属性ArgType
A numeric value representing the data type of the argument that raised the error.
(继承自 Error。)
公共属性ArgTypeReq
A numeric value representing the expected type of the argument that raised the error.
(继承自 Error。)
公共属性ArgTypeReqType
The system type representing the expected type of the argument that raised the error.
(继承自 Error。)
公共属性ArgTypeType
The system type representing the data type of the argument that raised the error.
(继承自 Error。)
公共属性CallFuncSym
A symbol representing the calling function of the function in which the error occurred.
(继承自 Error。)
公共属性CanDefault
A logical value indicating whether the subsystem can perform default error recovery for the error condition.
(继承自 Error。)
公共属性CanRetry
A logical value indicating whether the subsystem can retry the operation that caused the error condition.
(继承自 Error。)
公共属性CanSubstitute
A logical value indicating whether a new result can be substituted for the operation that produced the error condition.
(继承自 Error。)
公共属性Cargo
A value of any data type unused by the Error system. It is provided as a user-definable slot, allowing arbitrary information to be attached to an Error object and retrieved later
(继承自 Error。)
公共属性Description
A string that describes the error condition.
(继承自 Error。)
公共属性ErrorFlag
一个逻辑值,表示是否刚刚发生了 SQL 错误。
公共属性ErrorList
公共属性ErrorMessage
一个字符串,包含 SQL 错误消息。
公共属性ErrorMessageLen
一个数值,表示 SQL 错误消息的长度。
公共属性FileHandle
A numeric value representing the file handle supplied to a function when an file error occurs.
(继承自 Error。)
公共属性FileName
A string representing the name used to open the file associated with the error condition.
(继承自 Error。)
公共属性FuncPtr
A pointer to the function in which the error occurred.
(继承自 Error。)
公共属性FuncSym
A string representing the name of the function or method in which the error occurred.
(继承自 Error。)
公共属性Gencode
An integer numeric value representing a Visual Objects generic error code.
(继承自 Error。)
公共属性GenCodeText
An string containing the description of the Gencode.
(继承自 Error。)
公共属性MaxSize
A numeric value representing a boundary condition for an operation (such as string overflow or array bound error).
(继承自 Error。)
公共属性MethodSelf
An object representing the SELF of the method in which the error occurred.
(继承自 Error。)
公共属性NativeError
一个数值,表示本地 SQL 错误。
公共属性Operation
A string that describes the operation being attempted when the error occurred.
(继承自 Error。)
公共属性OSCode
A value of 0 indicates that the error condition was not caused by an error from the operating system.
(继承自 Error。)
公共属性OSCodeText
Descripion of the OSCode
(继承自 Error。)
公共属性ReturnCode
一个数值,表示 SQL 返回代码值(例如,SQL_ERROR,SQL_SUCCESS_WITH_INFO 等)。
公共属性Severity
A constant indicating the severity of the error condition.
(继承自 Error。)
公共属性SQLState
一个字符串,包含 SQL 错误状态(例如,S1000,这是一个一般错误)。
公共属性Stack
Call stack from the moment where the error object was created
(继承自 Error。)
公共属性StackTrace (继承自 Error。)
公共属性SubCode
An integer numeric value representing a subsystem-specific error code.
(继承自 Error。)
公共属性SubCodeText
An string containing the description of the SubCode.
(继承自 Error。)
公共属性SubstituteType
A numeric value representing the type of the new result that the error handler substitutes for the operation that produced the error condition.
(继承自 Error。)
公共属性SubSystem
A string representing the name of the subsystem generating the error.
(继承自 Error。)
公共属性Tries
An integer numeric value representing the number of times the failed operation has been attempted.
(继承自 Error。)
Top
方法
  名称说明
公共方法SetStackTrace (继承自 Error。)
公共方法ShowErrorMsg
显示一个 SQL 错误消息。
公共方法Throw
Throw the error.
(继承自 Error。)
公共方法ToString
Creates and returns a string representation of the current exception.
(继承自 Error。)
Top
扩展方法
  名称说明
公共扩展器方法GetInnerException (由 Error 定义。)
Top
备注
当 SQL 类(SQLConnection、SQLStatement、SQLSelect、SQLTable 等)发生错误时,将自动创建一个 SQLErrorInfo 对象。 要检索错误,使用 SQLSelect:ErrInfo 访问。
示例
以下示例捕获收到的错误,并创建一个 SQLErrorInfo 对象:
X#
 1LOCAL oSQLErrorInfo AS OBJECT
 2LOCAL oConnection AS OBJECT
 3LOCAL oSelect AS OBJECT
 4// 创建SQLConnection对象
 5oConnection := SQLConnection{"sample", "dba", "sql"}
 6// 创建SQLSelect对象
 7oSelect := SQLSelect{"SELECT * FROM lab", oConnection}
 8// 测试无效参数
 9IF SQLGetStmtOption(oSelect:StatementHandle, 30000, NULL_PTR) # SQLSuccess
10    // 现在,创建SQLErrorInfo对象以获取
11    // 最后一个错误。 前两个参数是
12    // 可选的,然后是环境句柄,
13    // 连接句柄,然后是
14    // SQLSelect的语句句柄。
15    oSQLErrorInfo := SQLErrorInfo{ , , ;
16                                    oConnection:EnvHandle,;
17                                    oConnection:ConnHandle,;
18                                    oSelect:StatementHandle}
19ENDIF
20
21?oSQLErrorInfo:ErrorFlag
22?oSQLErrorInfo:ErrorMessage
23?oSQLErrorInfo:NativeError
24?oSQLErrorInfo:SQLState
参见