诊断Diagnostics

在 ODBC 中的函数返回以下两种方式的诊断信息。Functions in ODBC return diagnostic information in two ways. 返回代码指示总体成功或失败的函数,而诊断记录提供有关该函数的详细的信息。The return code indicates the overall success or failure of the function, while diagnostic records provide detailed information about the function. 即使该函数成功,则返回至少一个诊断记录的标头记录。At least one diagnostic record - the header record - is returned even if the function succeeds.

在开发时使用的诊断信息来捕获中硬编码的 SQL 语句的编程错误,如无效句柄和语法错误。Diagnostic information is used at development time to catch programming errors such as invalid handles and syntax errors in hard-coded SQL statements. 它用于在运行时捕获用户输入的 SQL 语句中的运行时错误和警告,例如数据截断,访问冲突和语法错误。It is used at run time to catch run-time errors and warnings such as data truncation, access violations, and syntax errors in SQL statements entered by the user.

本部分包含以下主题。This section contains the following topics.