错误消息
本主题描述 GBase 8s ODBC Driver 错误消息。
本主题提供以下信息:
- 诊断 SQLSTATE 值
- 映射到 GBase 8s 错误消息的 SQLSTATE 值
- GBase 8s ODBC Driver 错误消息映射到特定的 SQLSTATE 值
有关错误消息的描述,请使用 finderr 实用程序。
诊断 SQLSTATE 值
每个 GBase 8s ODBC Driver 函数可以返回对应于 GBase 8s 错误码的 SQLSTATE 值。
函数可以返回从实现特定的情况中产生的额外的 SQLSTATE 值。SQLError 返回由 GLS 和 SQL Access Group SQL CAE 规范(1992)定义的 SQLSTATE 值。
SQLSTATE 值是由两个字符类值和三个字符的子类值组成的字符串。类值 01 表示警告,并伴随一个 SQL_SUCCESS_WITH_INFO 返回码。01 以外的的类值(类 IM 除外)表示错误,并伴随一个 SQL_ERROR 返回码。IM 类表示由 GBase 8s ODBC Driver 实现派生的警告和错误。任何类中的子类值 000 都是给定类中实现定义的条件。ANSI SQL-92 定义了类和子类值的分配。
将 SQLSTATE 值映射到 GBase 8s 错误消息
查看 GBase 8s ODBC Driver 可以返回的 SQLSTATE 值。
下表映射 GBase 8s ODBC Driver 可以返回的 SQLSTATE 值。
SQL_SUCCESS 的返回值通常表示函数执行成功,尽管 SQLSTATE 00000 也表示成功。
SQLSTATE | 错误消息 | 从这里返回 |
---|---|---|
01 000 | General warning | 所有的 GBase 8s ODBC Driver 函数,除了:SQLAllocEnv SQLError |
01002 | Disconnect error | SQLDisconnect |
01004 | Data truncated | SQLBrowseConnect SQLColAttributes SQLDataSources SQLDescribeCol SQLDriverConnect SQLDrivers SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLGetCursorName SQLGetData SQLGetInfo SQLNativeSql SQLPutData SQLSetPos |
01006 | Privilege not revoked | SQLExecDirect SQLExecute |
01S00 | Invalid connection string attribute | SQLBrowseConnect SQLDriverConnect |
01S01 | Error in row | SQLExtendedFetch SQLSetPos |
01S02 | Option value changed | SQLSetConnectOption SQLSetStmtOption |
01S03 | No rows updated or deleted | SQLExecDirect SQLExecute SQLSetPos |
01S04 | More than one row updated or deleted | SQLExecDirect SQLExecute SQLSetPos |
07001 | Wrong number of parameters | SQLExecDirect SQLExecute |
07006 | Restricted data type attribute violation | SQLBindParameter SQLExtendedFetch SQLFetchSQLGetData |
08001 | Unable to connect to data source | SQLBrowseConnect SQLConnect SQLDriverConnect |
08002 | Connection in use | SQLBrowseConnect SQLConnect SQLDriverConnect SQLSetConnectOption |
08003 | Connection not open | SQLAllocStmt SQLDisconnect SQLGetConnectOption SQLGetInfo SQLNativeSql SQLSetConnectOption SQLTransact |
08004 | Data source rejected establishment of connection | SQLBrowseConnect SQLConnect SQLDriverConnect |
08007 | Connection failure during transaction | SQLTransact |
08S01 | Communication link failure | SQLBrowseConnect SQLColumnPrivileges SQLColumns SQLConnect SQLDriverConnect SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLForeignKeys SQLFreeConnect SQLGetData SQLGetTypeInfo SQLParamData SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutDataSQL SetConnectOption SQLSetStmtOption SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables |
21S01 | Insert value list does not match column list | SQLExecDirect SQLPrepare |
21S02 | Degree of derived table does not match column list | SQLExecDirect SQLPrepare SQLSetPos |
22001 | String data right truncation | SQLPutData |
22003 | Numeric value out of range | SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLGetData SQLGetInfo SQLPutData SQLSetPos |
22005 | Error in assignment | SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLGetData SQLPrepare SQLPutData SQLSetPos |
22008 | Datetime field overflow | SQLExecDirect SQLExecute SQLExtendedFetch SQLFetchSQLGetData SQLPutDataSQLSetPos |
22012 | Division by zero | SQLExecDirect SQLExecute SQLExtendedFetch SQLFetchSQLGetData |
22026 | String data, length mismatch | SQLParamData |
23000 | Integrity constraint violation | SQLExecDirect SQLExecute SQLSetPos |
24000 | Invalid cursor state | SQLColAttributes SQLColumnPrivileges SQLColumns SQLDescribeCol SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLForeignKeys SQLGetData SQLGetStmtOption SQLGetTypeInfo SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLSetCursorName SQLSetPos SQLSetStmtOption SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables |
25000 | Invalid transaction state | SQLDisconnect |
28000 | Invalid authorization specification | SQLBrowseConnect SQLConnectS QLDriverConnect |
34000 | Invalid cursor name | SQLExecDirect SQLPrepare SQLSetCursorName |
37000 | Syntax error or access violation | SQLExecDirect SQLNativeSql SQLPrepare |
3C000 | Duplicate cursor name | SQLSetCursorName |
40001 | Serialization failure | SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch |
42000 | Syntax error or access violation | SQLExecDirect SQLExecute SQLPrepare SQLSetPos |
70100 | Operation aborted | SQLCancel |
IM001 | Driver does not support this function | 所有的 ODBC 函数,除了: SQLAllocConnect SQLAllocEnv SQLDataSources SQLDrivers SQLError SQLFreeConnect SQLFreeEnv SQLGetFunctions |
IM002 | Data source name not found and no default driver specified | SQLBrowseConnect SQLConnect SQLDriverConnect |
IM003 | Specified driver could not be loaded | SQLBrowseConnect SQLConnect SQLDriverConnect |
IM004 | Driver's SQLAllocEnv failed | SQLBrowseConnect SQLConnect SQLDriverConnect |
IM005 | Driver's SQLAllocConnect failed | SQLBrowseConnect SQLConnect SQLDriverConnect |
IM006 | Driver's SQLSetConnectOption failed | SQLBrowseConnect SQLConnect SQLDriverConnect |
IM007 | No data source or driver specified; dialog prohibited | SQLDriverConnect |
IM008 | Dialog failed | SQLDriverConnect |
IM009 | Unable to load translation shared library (DLL) | SQLBrowseConnect SQLConnect SQLDriverConnect SQLSetConnectOption |
IM010 | Data source name too long | SQLBrowseConnect SQLDriverConnect |
IM011 | Driver name too long | SQLBrowseConnect SQLDriverConnect |
IM012 | DRIVER keyword syntax error | SQLBrowseConnect SQLDriverConnect |
IM013 | Trace file error | All ODBC functions. |
S0001 | Base table or view already exists | SQLExecDirectSQLPrepare |
S0002 | Base table not found | SQLExecDirectSQLPrepare |
S0011 | Index already exists | SQLExecDirectSQLPrepare |
S0012 | Index not found | SQLExecDirectSQLPrepare |
S0021 | Column already exists | SQLExecDirectSQLPrepare |
S0022 | Column not found | SQLExecDirectSQLPrepare |
S0023 | No default for column | SQLSetPos |
S1000 | General error | 所有的 ODBC 函数 |
S1001 | Memory allocation failure | 所有的 ODBC 函数,除了: SQLAllocEnv SQLError SQLFreeConnect SQLFreeEnv |
S1002 | Invalid column number | SQLBindCol SQLColAttributes SQLDescribeCol SQLExtendedFetchS QLFetch SQLGetData |
S1003 | Program type out of range | SQLBindCol SQLBindParameter SQLGetData |
S1004 | SQL data type out of range | SQLBindParameter SQLGetTypeInfo |
S1008 | Operation canceled | 所有可以执行异步的 ODBC 函数:SQLColAttributes SQLColumnPrivileges SQLColumns SQLDescribeCol SQLDescribeParam SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLForeignKeys SQLGetData SQLGetTypeInfo SQLMoreResults SQLNumParams SQLNumResultCols SQLParamData SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutData SQLSetPos SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables |
S1009 | Invalid argument value | SQLAllocConnect SQLAllocStmt SQLBindCol SQLBindParameter SQLExecDirect SQLForeignKeys SQLGetData SQLGetInfo SQLNativeSql SQLPrepare SQLPutData SQLSetConnectOption SQLSetCursorName SQLSetPos SQLSetStmtOption |
S1010 | Function sequence error | SQLBindCol SQLBindParameter SQLColAttributes SQLColumnPrivileges SQLColumns SQLDescribeCol SQLDisconnect SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLForeignKeys SQLFreeConnect SQLFreeEnv SQLFreeStmt SQLGetConnectOption SQLGetCursorName SQLGetData SQLGetFunctions SQLGetStmtOption SQLGetTypeInfo SQLMoreResults SQLNumParams SQLNumResultColsS QLParamData SQLParamOptions SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutData SQLRowCount SQLSetConnectOption SQLSetCursorName SQLSetPos SQLSetScrollOptions SQLSetStmtOption SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables SQLTransact |
S1011 | Operation invalid at this time | SQLGetStmtOption SQLSetConnectOption SQLSetStmtOption |
S1012 | Invalid transaction operation code specified | SQLTransact |
S1015 | No cursor name available | SQLGetCursorName |
S1090 | Invalid string or buffer length | SQLBindCol SQLBindParameter SQLBrowseConnect SQLColAttributes SQLColumnPrivileges SQLColumns SQLConnect SQLDataSources SQLDescribeCol SQLDriverConnect SQLDrivers SQLExecDirect SQLExecute SQLForeignKeys SQLGetCursorName SQLGetData SQLGetInfo SQLNativeSql SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutData SQLSetCursorName SQLSetPos SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables |
S1091 | Descriptor type out of range | SQLColAttributes |
S1092 | Option type out of range | SQLFreeStmt SQLGetConnectOption SQLGetStmtOption SQLSetConnectOption SQLSetStmtOption |
S1093 | Invalid parameter number | SQLBindParameter |
S1094 | Invalid scale value | SQLBindParameter |
S1095 | Function type out of range | SQLGetFunctions |
S1096 | Information type out of range | SQLGetInfo |
S1097 | Column type out of range | SQLSpecialColumns |
S1098 | Scope type out of range | SQLSpecialColumns |
S1099 | Nullable type out of range | SQLSpecialColumns |
S1100 | Uniqueness option type out of range | SQLStatistics |
S1101 | Accuracy option type out of range | SQLStatistics |
S1103 | Direction option out of range | SQLDataSources SQLDrivers |
S1104 | Invalid precision value | SQLBindParameter |
S1105 | Invalid parameter type | SQLBindParameter |
S1106 | Fetch type out of range | SQLExtendedFetch |
S1107 | Row value out of range | SQLExtendedFetch SQLParamOptions SQLSetPos SQLSetScrollOptions |
S1108 | Concurrency option out of range | SQLSetScrollOptions |
S1109 | Invalid cursor position | SQLExecute SQLExecDirect SQLGetData SQLGetStmtOption SQLSetPos |
S1110 | Invalid driver completion | SQLDriverConnect |
S1111 | Invalid bookmark value | SQLExtendedFetch |
S1C00 | Driver not capable | SQLBindCol SQLBindParameter SQLColAttributes SQLColumnPrivileges SQLColumns SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLForeignKeys SQLGetData SQLTablePrivileges SQLGetInfo SQLGetStmtOption SQLGetTypeInfo SQLPrepare SQLPrimaryKeys SQLTransact SQLProcedures SQLSetConnectOption SQLSetPosSQL SQLTables SQLSetStmtOption SQLSpecialColumns SQLStatistics SQLTransact SetScrollOptions SQLProcedureColumns SQLGetConnectOption |
S1T00 | Time-out expired | SQLBrowseConnect SQLColAttributes SQLColumnPrivileges SQLColumns SQLConnect SQLDescribeCol SQLDriverConnect SQLExecDirect SQLExecute SQLExtendedFetch SQLFetch SQLForeignKeys SQLGetData SQLGetInfo SQLGetTypeInfo SQLMoreResults SQLNumParams SQLNumResultCols SQLParamData SQLPrepare SQLPrimaryKeys SQLProcedureColumns SQLProcedures SQLPutData SQLSetPos SQLSpecialColumns SQLStatistics SQLTablePrivileges SQLTables |
将 GBase 8s 错误消息映射到 QLSTATE 值
本节的余下部分描述了 GBase 8s ODBC Driver 函数的诊断 SQLSTATE 值。
每个 SQLSTATE 值的返回码是 SQL_ERROR,否则是表示其它信息的描述。当函数返回 SQL_SUCCESS_WITH_INFO 或 SQL_ERROR,可以调用 SQLError 获取 SQLSTATE 值。
已弃用的和新的 GBase 8s ODBC Driver API
在 Version 4.10 中,许多 ODBC API 已被弃用,它们的函数都转移到新的 API 中。
只更改了名称;没有更改功能。下表列出了弃用的和新的 API。
表 1. 弃用的和新的 ODBC API
弃用的 ODBC API | 新的 ODBC API |
---|---|
SQLAllocConnect | SQLAllocHandle |
SQLAllocEnv | SQLAllocHandle |
SQLAllocStmt | SQLAllocHandle |
SQLColAttributes | SQLColAttribute |
SQLError | SQLGetDiagRec |
SQLExtendedFetch | SQLFetch, SQLFetchScroll |
SQLFreeConnect | SQLFreeHandle |
SQLFreeEnv | SQLFreeHandle |
SQLFreeStmt | SQLFreeHandle |
SQLGetConnectOption | SQLGetConnectAttr |
SQLGetStmtOption | SQLGetStmtAttr |
SQLSetConnectOption | SQLSetConnectAttr |
SQLSetPos | SQLBulkOperations |
SQLSetStmtOption | SQLSetStmtAttr |
SQLTransact | SQLEndTran |
SQLAllocConnect (仅限核心级别)
本表描述了 SQLAllocConnect 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
SQLAllocEnv(仅限核心级别)
SQLAllocEnv 为环境句柄 ,并初始化驱动程序调用级别接口,以供应用程序使用。
应用程序必须在调用其它驱动程序函数之前调用 SQLAllocEnv。
驱动程序在调用 SQLAllocEnv 之后不能直接返回 SQLSTATE 值,因为没有有效的句柄在调用 SQLError。
存在两个级别的 SQLAllocEnv 函数,一个在驱动程序管理器中(如果使用的话),一个在驱动程序中。在应用程序调用 SQLConnect 、SQLBrowseConnect 或 SQLDriverConnect 之前,驱动程序管理器不会调用驱动程序级别的函数。如果在驱动程序级别 SQLAllocEnv 函数中发生了错误,则驱动程序管理器层 SQLConnect 、SQLBrowseConnect 或 SQLDriverConnect 函数返回 SQL_ERROR。随后对使用 henv 、SQL_NULL_HDBC 和 SQL_NULL_HSTMT 的 SQLError 调用返回 SQLSTATE IM004 (驱动程序 SQLAllocEnv 函数失败),在以下驱动程序的错误之后:
- SQLSTATE S1000(一般错误)
- GBase 8s ODBC Driver SQLSTATE 值,它的范围是从 S1000 到 S19ZZ。
例如,SQLSTATE S1001(内存分配失败)表示从驱动程序管理器到驱动程序级别 SQLAllocEnv 的调用返回 SQL_ERROR,并且驱动程序管理器中的 henv 被设置为 SQL_NULL_HENV。
SQLAllocStmt(仅限核心级别)
SQLAllocStmt 为使用 hdbc 指定的连接的语句句柄分配内存。
应用程序必须在提交 SQL 语句之前调用 SQLAllocStmt。
下表描述了 SQLAllocStmt 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08003 | -11017 | Connection not open |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
SQLBindCol (仅限核心级别)
SQLBindCol 为结果集中的列分配存储和 GBase 8s ODBC Driver C 数据类型。
SQLBindCol 按如下方式分配存储:
- 一个存储缓冲区,用于接收一列数据的内容
- 存储缓冲区的长度
- 一个存储位置,用于接收访存操作返回的数据列的实际长度
- 将 GBase 8s SQL 数据类型转换为 GBase 8s ODBC driver C 数据类型
下表描述了 SQLBindCol 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1002 | -11062 | Invalid column number |
S1003 | -11063 | Program type out of range |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
应用程序可以调用 SQLBindCol 将列绑定到新的存储位置,而不管数据是否已经被存取。新的绑定替换旧的绑定列以及其它绑定列。新的绑定不会应用到已经访存的数据;它会在下次调用 SQLFetch 、SQLExtendedFetch 或 SQLSetPos 时发生作用。
SQLBindParameter(仅限一级)
SQLBindParameter 将缓冲区绑定到 SQL 语句中的参数标记。
下表描述了 SQLBindParameter 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
07006 | -11013 | Restricted data type attribute violation |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1003 | -11063 | Program type out of range |
S1004 | -11064 | SQL data type out of range |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1093 | -11074 | Invalid parameter number |
S1094 | -11075 | Invalid scale value |
S1104 | -11084 | Invalid precision value |
S1105 | -11085 | Invalid parameter type |
S1C00 | -11092 | Driver not capable |
SQLBrowseConnect(仅限二级)
SQLBrowseConnect 支持发现和枚举连接到数据源所需的属性和属性值的迭代方法。
每次调用 SQLBrowseConnect 都会返回连续的属性和属性值。枚举所有的级别,完成到数据源的连接,并返回新连接到数据源的返回码的 SQLBrowseConnect 字符串。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
01S00 | -11005 | Invalid connection string attribute |
08001 | -11015 | Unable to connect to data source |
08002 | -11016 | Connection in use |
08S01 | -11020 | Communication-link failure |
28000 | -11033 | Invalid authorization specification |
IM002 | -11041 | Data source not found and no default driver specified |
IM003 | -11042 | Specified driver could not be loaded |
IM004 | -11043 | Driver's SQLAllocEnv failed |
IM005 | -11044 | Driver's SQLAllocConnect failed |
IM006 | -11045 | Driver's SQLSetConnectOption failed |
IM009 | -11048 | Unable to load translation shared library (DLL) |
IM010 | -11049 | Data-source name too long |
IM011 | -11050 | Driver name too long |
IM012 | -11051 | DRIVER keyword syntax error |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1090 | -11071 | Invalid string or buffer length |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11303 | Input connection string too large |
S1000 | -11317 | Invalid connectdatabase value specified |
S1000 | -11318 | Invalid vmbcharlenexact value specified |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLCancel(仅限核心级别)
SQLCancel 取消 hstmt 或查询的处理。
下表描述了此该函数的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01S05 | -11010 | Cancel treated as FreeStmt/Close. |
70100 | -11039 | Operation aborted |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
SQLColAttributes (仅限核心级别)
SQLColAttributes 返回结果集章列的描述符消息。
它不能用于返回标记列的信息(列 0)。描述符消息作为字符串,32 位描述符相关值或整数值返回。
下表描述了 SQLColAttributes 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1002 | -11062 | Invalid column number |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1091 | -11072 | Descriptor type out of range |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
SQLColAttributes 可以返回 SQLPrepare 或 SQLExecute 在 SQLPrepare 之后,SQLExecute 之前调用的任何 SQLSTATE。具体取决于数据源何时评估与 hstmt 关联的 SQL 语句。
SQLColumnPrivileges (仅限二级)
SQLColumnPrivileges 返回指定表的列和相关权限的列表。驱动程序将返回信息作为在指定的 hstmt 上设置的结果。
下表描述了 SQLColumnPrivileges 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLColumns(仅限一级)
SQLColumns 返回指定表的列名。驱动程序将此信息作为指定 hstmt 上的结果集返回。
下表描述了SQLColumns 的 SQLSTATE 和错误消息。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLConnect(仅限核心级别)
SQLConnect 加载驱动程序并建立到数据源的连接。
连接句柄引用存储有关连接的所有信息,包括状态、事务状态和错误消息。
下表描述了 SQLConnect 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08001 | -11015 | Unable to connect to data source |
08002 | -11016 | Connection in use |
08S01 | -11020 | Communication-link failure |
28000 | -11033 | Invalid authorization specification |
IM002 | -11041 | Data source not found and no default driver specified |
IM003 | -11042 | Specified driver could not be loaded |
IM004 | -11043 | Driver's SQLAllocEnv failed |
IM005 | -11044 | Driver's SQLAllocConnect failed |
IM006 | -11045 | Driver's SQLSetConnectOption failed |
IM009 | -11048 | Unable to load translation shared library (DLL) |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1090 | -11071 | Invalid string or buffer length |
S1T00 | -11094 | Time-out expired |
S1000 | -11302 | Insufficient connection information was supplied |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLDataSources (仅限二级)
SQLDataSources 列出数据源名称。
下表描述了 SQLDataSources 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1090 | -11071 | Invalid string or buffer length |
S1103 | -11083 | Direction option out of range |
SQLDescribeCol (仅限核心级别)
SQLDescribeCol 返回结果集中一列的详细信息(列名、类型、精度、小数位数和它是否具有 NULL 值)。
它不能用于返回有关标记列(列 0)的信息。
下表描述了 SQLDescribeCol 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1002 | -11062 | Invalid column number |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1T00 | -11094 | Time-out expired |
当在 SQLPrepare 之后 SQLExecute 之前调用 SQLDescribeCol 时,SQLDescribeCol 可以返回 SQLPrepare 或 SQLExecute 返回的任何 SQLSTATE。具体取决于数据源何时评估与 hstmt 关联的 SQL 语句。
SQLDisconnect
SQLDisconnect 关闭与指定连接句柄关联的连接。
下表描述了 SQLDisconnect 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01002 | -11002 | Disconnect error |
08003 | -11017 | Connection not open |
25000 | -11032 | Invalid transaction state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
用法
如果应用程序在 SQLBrowseConnect 返回 SQL_NEED_DATA 之后调用 SQLDisconnect ,则在返回不同的返回码之前,驱动程序取消连接浏览过程并返回 hdbc 到未连接状态。
如果应用程序在未完成的事务与连接句柄关联时调用 SQLDisconnect,则驱动程序返回 SQLSTATE 25000 (无效的事务状态),指示该事务没有变更,连接仍就打开。未完成的事务是没有提交或回滚的 SQLTransact。
如果应用程序在是否与连接相关联 hstmt 之前调用 SQLDisconnect,则驱动程序在它从数据源断开连接后释放剩余的 hstmt。然而,如果一个或多个与连接关联的 hstmts 仍在异步执行,则 SQLDisconnect 返回 SQL_ERROR ,其中 SQLSTATE 的值为 S1010(函数序列错误)。
SQLDriverConnect (仅限一级)
SQLDriverConnect 等同于 SQLConnect。
它支持需要更多连接信息的数据源,而不是只需要 SQLConnect 对话框中的三个参数的数据源,这三个参数提示用户所有连接信息和未定义数据源名称的数据源。
SQLDriverConnect 提供以下连接选项:
- 可以使用包含数据源,一个或多个用户 ID,一个或多个密码和数据源需要的其他信息的连接字符串建立连接。
- 可以使用部分连接字符串建立连接,或者不使用其他信息。在这种情况中,GBase 8s ODBC Driver 可以提示用户提供连接信息。
建立连接后,SQLDriverConnect 连接字符串完成。应用程序可以使用此字符串进行后续的连接请求。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
01S00 | -11005 | Invalid connection string attribute |
08001 | -11015 | Unable to connect to data source |
08002 | -11016 | Connection in use |
08S01 | -11020 | Communication-link failure |
28000 | -11033 | Invalid authorization specification |
IM002 | -11041 | Data source not found and no default driver specified |
IM003 | -11042 | Specified driver could not be loaded |
IM004 | -11043 | Driver's SQLAllocEnv failed |
IM005 | -11044 | Driver's SQLAllocConnect failed |
IM006 | -11045 | Driver's SQLSetConnectOption failed |
IM007 | -11046 | No data source or driver specified; dialog prohibited |
IM008 | -11047 | Dialog failed |
IM009 | -11048 | Unable to load translation shared library |
IM010 | -11049 | Data-source name too long |
IM011 | -11050 | Driver name too long |
IM012 | -11051 | DRIVER keyword syntax error |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1090 | -11071 | Invalid string or buffer length |
S1110 | -11090 | Invalid driver completion |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11302 | Insufficient connection information was supplied |
S1000 | -11303 | Input connection string too large |
S1000 | -11317 | Invalid connectdatabase value specified |
S1000 | -11318 | Invalid vmbcharlenexact value specified |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLDrivers (仅限一级)
SQLDrivers 列出驱动程序描述和驱动程序属性关键字。
下表描述了SQLDrivers 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1090 | -11071 | Invalid string or buffer length |
S1103 | -11083 | Direction option out of range |
SQLError(仅限核心级别)
SQLError 返回错误或状态信息。
SQLError 不会传送它本身的错误值。当 SQLError 检索到任何错误消息,会返回 SQL_NO_DATA_FOUND(sqlstate 等于 00000)。如果 SQLError 由于任何可以返回 SQL_ERROR 的原因而无法访问错误,则 SQLError 返回 SQL_ERROR,但是不会发布任何错误值。如果错误消息的缓冲区太小,则 SQLError 返回 SQL_SUCCESS_WITH_INFO,但是仍不会返回 SQLError 的 SQLSTATE 值。
为了确定在错误消息中是否发生截断,应用程序可以将 cbErrorMsgMax 与写入 pcbErrorMsg 的消息文本的实际长度进行比较。
SQLExecDirect(仅限核心级别)
如果语句中存在任何参数,则 SQLExecDirect 通过使用参数标记变量的当前值来执行预备的语句。
SQLExecDirect 是提交一次性执行的 SQL 语句的最快方法。
下表描述了 SQLExecDirect 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
01006 | -11004 | Privilege not revoked |
01S03 | -11008 | No rows updated or deleted |
01S04 | -11009 | More than one row updated or deleted |
07001 | -11012 | Wrong number of parameters |
07S01 | -11014 | Invalid use of default parameter |
08S01 | -11020 | Communication-link failure |
21S01 | -11021 | Insert value list does not match column list |
21S02 | -11022 | Degree of derived table does not match column list |
22003 | -11025 | Numeric value out of range |
22005 | -11026 | Error in assignment |
22008 | -11027 | Datetime field overflow |
22012 | -11028 | Division by zero |
23000 | -11030 | Integrity-constraint violation |
24000 | -11031 | Invalid cursor state |
34000 | -11034 | Invalid cursor name |
37000 | -11035 | Syntax error or access violation |
40001 | -11037 | Serialization failure |
42000 | -11038 | Syntax error or access violation |
S0001 | -11053 | Base table or view already exists |
S0002 | -11054 | Base table not found |
S0011 | -11055 | Index already exists |
S0012 | -11056 | Index not found |
S0021 | -11057 | Column already exists |
S0022 | -11058 | Column not found |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1109 | -11089 | Invalid cursor position |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLExecute(仅限核心级别)
如果语句中有任何参数标记,则 SQLExecute 通过使用当前参数标记变量的值来执行准备好的语句。
下表描述了 SQLExecute 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
01006 | -11004 | Privilege not revoked |
01S03 | -11008 | No rows updated or deleted |
01S04 | -11009 | More than one row updated or deleted |
07001 | -11012 | Wrong number of parameters |
07S01 | -11014 | Invalid use of default parameter. |
08S01 | -11020 | Communication-link failure |
22003 | -11025 | Numeric value out of range |
22005 | -11026 | Error in assignment |
22008 | -11027 | Datetime field overflow |
22012 | -11028 | Division by zero |
23000 | -11030 | Integrity constraint violation |
24000 | -11031 | Invalid cursor state |
40001 | -11037 | Serialization failure |
42000 | -11038 | Syntax error or access violation |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1109 | -11089 | Invalid cursor position |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLExecute 可以返回 SQLPrepare 基于数据源评估与 hstmt 关联的 SQL 语句时返回的 SQLSTATE。
SQLExtendedFetch (仅限二级)
SQLExtendedFetch 扩展 SQLFetch 的功能。
SQLExtendedFetch 通过以下方式扩展功能:
- 为每个绑定列返回数组形式的行集数据(一行或多行)。
- 根据滚动类型参数的设置滚动结果。
SQLExtendedFetch 与 SQLSetStmtOption 一起使用。
要一次向前获取一行数据,应用程序会调用 SQLFetch。
下表描述了 SQLExtendedFetch 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
01S01 | -11006 | Error in row |
07006 | -11013 | Restricted data type attribute violation |
08S01 | -11020 | Communication-link failure |
22002 | -11024 | Indicator value required but not supplied |
22003 | -11025 | Numeric value out of range |
22005 | -11026 | Error in assignment |
22008 | -11027 | Datetime field overflow |
22012 | -11028 | Division by zero |
24000 | -11031 | Invalid cursor state |
40001 | -11037 | Serialization failure |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1002 | -11062 | Invalid column number |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1106 | -11086 | Fetch type out of range |
S1107 | -11087 | Row value out of range |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11307 | In SQLExtendedFetch, only SQL_FETCH_NEXT is supported for SQL_SCROLL_Forward_only cursors |
如果发生与整个行集相关的错误,例如 SQLSTATE S1T00 (超时),则驱动程序返回 SQL_ERROR 和适当的 SQLSTATE。行集缓冲区的的内容未定义,游标位置不变。
如果发生与单个行相关的错误,则驱动程序执行以下操作:
- 将行 rgfRowStatus 数组中的元素设置为 SQL_ROW_ERROR
- 在错误队列中发布 SQLSTATE 01S01(行中的错误)
- 在错误队列中的 SQLSTATE 01S01(行中的错误)之后,发布零个或多个附加的 SQLSTATE 值
驱动程序处理错误或警告之后,它继续行集中剩余的操作,并返回 SQL_SUCCESS_WITH_INFO。因此,对于与单个行相关的每个错误,错误队列包含 SQLSTATE 01S01(行中的错误),后跟零个或多个附加的 SQLSTATE 值。
驱动程序处理该错误之后,它访存行集中的剩余的行,并返回 SQL_SUCCESS_WITH_INFO。因此,对于返回错误的每一行,错误队列包含 SQLSTATE 01S01(行中的错误),后跟零个或多个附加的 SQLSTATE 值。
如果行集包含已经访存的行,则当首次访存行时,驱动程序不需要返回错误的 SQLSTATE 值。但是,对于最初返回错误的每一行,它需要返回 SQLSTATE 01S01(行中的错误),和 SQL_SUCCESS_WITH_INFO。例如,维护高速缓存的静态游标可能会缓存行状态信息(因此,它可以确定哪一行包含错误),但是不能缓存与错误相关的 SQLSTATE。
错误行不会影响相关游标的移动。例如,假定结果集大小为 100,行集大小为 10。如果当前行集是从 11 到 20 的行,并且 11 行的 rgfRowStatus 数组中的元素是 SQL_ROW_ERROR,则使用 SQL_FETCH_NEXT 访存类型调用 SQLExtendedFetch 仍然返回 21 到 30 行。
如果驱动程序返回任何警告,例如 SQLSTATE 01004(数据截断),则在返回适用于整个行或行集中位置行的警告,然后返回特定行的错误信息。它返回关于这些行的任何其它错误信息的特定行的警告。
SQLFetch(仅限核心级别)
SQLFetch 访存结果集的一行数据。
驱动程序返回使用 SQLBindCol 绑定到存储位置的所有列的数据。
下表描述了 SQLFetch 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
07006 | -11013 | Restricted data-type attribute violation |
08S01 | -11020 | Communication-link failure |
22002 | -11024 | Indicator value required but not supplied |
22003 | -11025 | Numeric value out of range |
22005 | -11026 | Error in assignment |
22008 | -11027 | Datetime field overflow |
22012 | -11028 | Division by zero |
24000 | -11031 | Invalid cursor state |
40001 | -11037 | Serialization failure |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1002 | -11062 | Invalid column number |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
SQLForeignKeys(仅限二级)
SQLForeignKeys 返回外键列表。
SQLForeignKeys 返回以下任一一项:
- 指定表中外键列表(指定表中的指向其它表中主键的列)
- 其它表中引用指定表中主键的外键列表
驱动程序将返回每个列表作为在指定的 hstmt 上设置的结果。
下表描述了 SQLForeignKeys 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication link failure |
24000 | -11031 | Invalid cursor state |
IM001 | -11040 | Driver does not support this function |
S1000 | -11060 | General error |
S1001 | -11061 | Memory allocation failure |
S1008 | -11065 | Operation canceled |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Timeout expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLFreeConnect (仅限核心级别)
SQLFreeConnect 释放连接句柄并释放所有与句柄相关联的内存。
下表描述了 SQLFreeConnect 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
S1000 | -11060 | General error |
S1010 | -11067 | Function-sequence error |
SQLFreeEnv(仅限核心级别)
SQLFreeEnv 释放环境句柄和与环境句柄相关联的内存。
下表描述了 SQLFreeEnv 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1010 | -11067 | Function-sequence error |
SQLFreeStmt(仅限核心级别)
SQLFreeStmt 停止与特定 hstmt 关联的句柄,关闭与 hstmt 关联的打开游标,丢弃暂挂的结果,以及(可选)释放所有与语句句柄关联的资源。
下表描述了 SQLFreeStmt 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
S1092 | -11073 | Option type out of range |
SQLGetConnectOption(仅限一级)
SQLGetConnectOption 返回当前连接选项的设置。
下表描述了 SQLGetConnectOption 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08003 | -11017 | Connection not open |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
S1092 | -11073 | Option type out of range |
S1C00 | -11092 | Driver not capable |
SQLGetCursorName(仅限核心级别)
SQLGetCursorName 返回与指定的 hstmt 相关联的游标名称。
下表描述了 SQLGetCursorName 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
S1015 | -11070 | No cursor name available |
S1090 | -11071 | Invalid string or buffer length |
SQLGetData(仅限一级)
SQLGetData 返回当前行中单个未绑定列的结果数据。
应用程序在调用 SQLGetData 之前,必须调用 SQLFetch 或 SQLExtendedFetch 和(可选)SQLSetPos 来定位一行数据的游标。对某些列可以使用 SQLBindCol,对相同行中的其它列使用 SQLGetData。该函数可以用于从字符、二进制或数据源特定的数据类型(例如,来自 SQL_LONGVARBINARY 或 SQL_LONGVARCHAR 列的数据)的列中检索字符或二进制数据。
下表描述了 SQLGetData 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
07006 | -11013 | Restricted data- type attribute violation |
08S01 | -11020 | Communication-link failure |
22002 | -11024 | Indicator value required but not supplied |
22003 | -11025 | Numeric value out of range |
22005 | -11026 | Error in assignment |
22008 | -11027 | Datetime-field overflow |
22012 | -11028 | Division by zero |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1002 | -11062 | Invalid column number |
S1003 | -11063 | Program type out of range |
S1008 | -11065 | Operation canceled |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1109 | -11089 | Invalid cursor position |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
SQLGetFunctions(仅限一级)
SQLGetFunctions 返回有关驱动程序是否支持指定函数的信息。
下表描述了 SQLGetFunctions 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -1101 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
S1095 | -11076 | Function type out of range |
SQLGetInfo(仅限一级)
SQLGetInfo 返回与 hdbc 关联的驱动程序和数据源的一般信息。
下表描述了 SQLGetInfo 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
08003 | -11017 | Connection not open |
22003 | -11025 | Numeric value out of range |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
S1090 | -11071 | Invalid string or buffer length |
S1096 | -11077 | Information type out of range |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
SQLGetStmtOption(仅限一级)
SQLGetStmtOption 返回当前语句选项的设置。
下表描述了 SQLGetStmtOption 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
S1011 | -11068 | Operation invalid at this time |
S1092 | -11073 | Option type out of range |
S1109 | -11089 | Invalid cursor position |
S1C00 | -11092 | Driver not capable |
SQLGetTypeInfo(仅限一级)
SQLGetTypeInfo 返回有关数据源支持的数据类型的信息。
驱动程序以 SQL 结果集的格式返回信息。
下表描述了 SQLGetTypeInfo 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1004 | -11064 | SQL data type out of range |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11305 | SQLGetTypeInfo supported for FORWARD_ONLY cursors |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLMoreResults(仅限二级)
SQLMoreResults 确定在包含 SELECT 、UPDATE 、INSERT 或 DELETE 语句的 hstmt 上是否有更多结果可用。如果是,则初始化这些结果的处理。
下表描述了 SQLMoreResults 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
SQLNativeSql(仅限二级)
SQLNativeSql 返回驱动程序翻译的 SQL 字符串。
下表描述了SQLNativeSql 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
08003 | -11017 | Connection not open |
37000 | -11035 | Syntax error or access violation |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
S1090 | -11071 | Invalid string or buffer length |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
用法
以下示例显示 SQLNativeSql 返回包含刻度函数 LENGTH 的输入 SQL 字符串的信息:
SELECT {fn LENGTH(NAME)} FROM EMPLOYEE
GBase 8s 可能返回以下翻译的 SQL 字符串:
SELECT length(NAME) FROM EMPLOYEE
SQLNumParams(仅限二级)
SQLNumParams 返回 SQL 语句中参数的数量。
下表描述了SQLNumParams 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1T00 | -11094 | Time-out expired |
SQLNumResultCols(仅限核心级别)
SQLNumResultCols 返回结果集中的列数。
下表描述了 SQLNumResultCols 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1T00 | -11094 | Time-out expired |
SQLNumResultCols 可以返回在 SQLPrepare 之后,SQLExecute 之前调用 SQLNumResultCols 时,SQLPrepare 或 SQLExecute 返回的任何 SQLSTATE ,这取决于数据源何时评估与 hstmt 关联的 SQL 语句。
SQLParamData(仅限一级)
当执行语句时,同时使用 SQLParamData 和 SQLPutData 来提供参数数据。
下表描述了 SQLParamData 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
22026 | -11029 | String data, length mismatch |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
如果在发送 SQL 语句中的参数数据时调用 SQLParamData,则会返回被调用来执行语句的函数(SQLExecute 或 SQLExecDirect)所返回的任何 SQLSTATE。如果在为使用 SQLSetPos 更新或添加的列发送数据时调用它,则它返回 SQLSetPos 返回的任何 SQLSTATE。
SQLParamOptions(仅限核心和二级)
SQLParamOptions 允许应用程序为由 SQLBindParameter 分配的一组参数指定多个值。
为一组参数指定多个值的函数对用于批量插入和其它需要数据源多次使用各种参数值处理相同 SQL 语句的工作很有用。例如,应用程序可以为与 INSERT 语句关联的参数集指定三个值,然后再次执行 INSERT 语句来执行三次插入操作。
下表列出了 SQLParamOptions 返回的 SQLSTATE 值,并解释了该函数内容中的每个值;在驱动程序管理器返回的每个 SQLSTATE 的描述之前都包含注释 (DM)。除非另有说明,否则与每个 SQLSTATE 值关联的返回码都是 SQL_ERROR。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | General warning | |
S1000 | General error | |
S1001 | Memory-allocation failure | |
S1010 | Function-sequence error | |
S1107 | Row value out of range |
SQLPrepare
SQLPrepare 准备要执行的 SQL 字符串。
下表描述了 SQLPrepare 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
21S01 | -11021 | Insert value list does not match column list |
21S02 | -11022 | Degree of derived table does not match column list |
22005 | -11026 | Error in assignment |
24000 | -11031 | Invalid cursor state |
34000 | -11034 | Invalid cursor name |
37000 | -11035 | Syntax error or access violation |
42000 | -11038 | Syntax error or access violation |
S0001 | -11053 | Base table or view already exists |
S0002 | -11054 | Base table not found |
S0011 | -11055 | Index already exists |
S0012 | -11056 | Index not found |
S0021 | -11057 | Column already exists |
S0022 | -11058 | Column not found |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLPrimaryKeys(仅限二级)
SQLPrimaryKeys 返回组成表的主键的列的名称。
驱动程序将此信息返回为结果集。该函数不支持在单个调用中返回多个表的主键。
下表描述了 SQLPrimaryKeys 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLProcedureColumns(仅限二级)
SQLProcedureColumns 返回输入和输出参数的列表,和组成特定过程的结果集的列。
驱动程序将返回的信息作为特定 hstmt 的结果集。
下表描述了 SQLProcedureColumns 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication link failure |
24000 | -11031 | Invalid cursor state |
IM001 | -11040 | Driver does not support this function |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLProcedures(仅限二级)
SQLProcedures 返回特定数据源中过程名称的列表,
Procedure 是一个通用术语,用于描述可执行对象,或可以使用输入和输出参数启动的命名实体,并且可以返回类似于 SELECT 语句返回结果的结果集。
下表描述了 SQLProcedures 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLPutData(仅限一级)
SQLPutData 允许应用程序在执行时将参数或列的数据发送到驱动程序。
该函数可以将字符或二进制数据值以字符、二进制或数据源指定的数据类型(如 SQL_LONGVARBINARY 或 SQL_LONGVARCHAR 的参数)的形式发送到列。
下表描述了 SQLPutData 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01004 | -11003 | Data truncated |
07S01 | -11014 | Invalid use of default parameter |
08S01 | -11020 | Communication-link failure |
22001 | -11023 | String data right truncation |
22003 | -11025 | Numeric value out of range |
22005 | -11026 | Error in assignment |
22008 | -11027 | Datetime-field overflow |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1T00 | -11094 | Time-out expired |
应用程序可以使用 SQLPutData 将字符 C 数据的各个部分发送到具有字符、二进制或数据源指定的数据类型的列,或者将二进制 C 数据发送到具有字符、二进制或数据源指定的数据类型的列。如果在任何其他条件下多次调用 SQLPutData,则会返回 SQL_ERROR 和 SQLSTATE 22003 (数值超出范围)。
SQLRowCount(仅限核心级别)
SQLRowCount 通过在 SQLSetPos 中的 SQL_UPDATE、SQL_ADD 或 SQL_DELETE 操作返回受 UPDATE、INSERT 或 DELETE语句影响的行数。
下表描述了 SQLRowCount 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
SQLSetConnectOption(仅限一级)
SQLSetConnectOption 设置管理连接方面的选项。
下表描述了 SQLSetConnectOption 的 SQLSTATE 和错误消息。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01S02 | -11007 | Option value changed |
08002 | -11016 | Connection in use |
08003 | -11017 | Connection not open |
08S01 | -11020 | Communication-link failure |
IM009 | -11048 | Unable to load translation shared library (DLL) |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1011 | -11068 | Operation invalid at this time |
S1092 | -11073 | Option type out of range |
S1C00 | -11092 | Driver not capable |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
当 fOption 是语句选项时,SQLSetConnectOption 可以返回 SQLSetStmtOption 返回的任何 SQLSTATE。
SQLSetCursorName(仅限核心级别)
SQLSetCursorName 将游标描述与活动的 hstmt 关联。
如果应用程序不能调用 SQLSetCursorName,那么驱动程序会根据 SQL 语句处理的需要生成游标名称。
下表描述了SQLSetCursorName 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
24000 | -11031 | Invalid cursor state |
34000 | -11034 | Invalid cursor name |
3C000 | -11036 | Duplicate cursor name |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
SQLSetStmtOption(仅限一级)
SQLSetStmtOption 设置与 hstmt 相关的选项。
要为所有与特定 hdbc 关联的语句设置选项,应用程序可以调用 SQLSetConnectOption。
下表描述了 SQLSetStmtOption 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
01S02 | -11007 | Option value changed |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1009 | -11066 | Invalid argument value |
S1010 | -11067 | Function-sequence error |
S1011 | -11068 | Operation invalid at this time |
S1092 | -11073 | Option type out of range |
S1C00 | -11092 | Driver not capable |
SQLSpecialColumns(仅限一级)
SQLSpecialColumns 检索有关列的信息。
SQLSpecialColumns 检索有关指定表的以下信息:
- 唯一标识表中的一行的最佳列集
- 通过事务更新行中的值时,自动更新的列
下表描述了 SQLSpecialColumns 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1097 | -11078 | Column type out of range |
S1098 | -11079 | Scope type out of range |
S1099 | -11080 | Nullable type out of range |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLStatistics(仅限一级)
SQLStatistics 检索有关单个表的统计信息和与该表相关联的索引信息。
驱动程序将此消息作为结果集返回。
下表描述了 SQLStatistics 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory- allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1100 | -11081 | Uniqueness option type out of range |
S1101 | -11082 | Accuracy option type out of range |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLTablePrivileges(仅限二级)
SQLTablePrivileges 返回表和与每个表相关的特权的列表。
驱动程序将此信息作为指定 hstmt 上的结果集。
下表描述了 SQLTablePrivileges 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLTables(仅限一级)
SQLTables 返回存储在指定数据源中表的名称。
驱动程序将此信息作为结果集返回。
下表描述了 SQLTables 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08S01 | -11020 | Communication-link failure |
24000 | -11031 | Invalid cursor state |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1008 | -11065 | Operation canceled |
S1010 | -11067 | Function-sequence error |
S1090 | -11071 | Invalid string or buffer length |
S1C00 | -11092 | Driver not capable |
S1T00 | -11094 | Time-out expired |
S1C00 | -11300 | SQL_DEFAULT_PARAM not supported |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |
S1000 | -11310 | Create and Drop must be executed within a ServerOnly Connection |
S1000 | -11320 | Syntax error |
S1000 | -11323 | The statement contained an escape clause not supported by this database driver |
SQLTransact(仅限核心级别)
SQLTransact 为与连接关联的 hstmts 上的所有活动操作请求提交或回滚。
SQLTransact 还可以请求对与 henv 关联的所有连接执行提交或回滚操作。
下表描述了 SQLTransact 的 SQLSTATE 和错误值。
SQLSTATE | 错误值 | 错误消息 |
---|---|---|
01000 | -11001 | General warning |
08003 | -11017 | Connection not open |
S1000 | -11060 | General error |
S1001 | -11061 | Memory-allocation failure |
S1010 | -11067 | Function-sequence error |
S1012 | -11069 | Invalid transaction operation code specified |
S1C00 | -11092 | Driver not capable |
08S01 | -11301 | A protocol error has been detected. Current connection is closed. |