2 The ODBC layer
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog ODBC Interface
        • The ODBC layer
          • Global configuration
          • Connection management
          • Running SQL queries
          • Transaction management
          • Accessing the database dictionary
          • Getting more information
          • Representing SQL data in Prolog
          • Errors and warnings
            • ODBC messages:‘Success with info'
            • ODBC errors
          • ODBC implementations
          • Remaining issues

2.8 Errors and warnings

ODBC operations return success, error or‘success with info'. This section explains how results from the ODBC layer are reported to Prolog.

2.8.1 ODBC messages:‘Success with info'

If an ODBC operation returns‘with info', the info is extracted from the interface and handled to the Prolog message dispatcher print_message/2. The level of the message is informational and the term is of the form:

odbc(State, Native, Message)
Here, State is the SQL-state as defined in the ODBC API, Native is the (integer) error code of the underlying data source and Message is a human readable explanation of the message.

2.8.2 ODBC errors

If an ODBC operation signals an error, it throws the exception error(odbc(State, Native, Message), _). The arguments of the odbc/3 term are explained in section 2.8.1.

In addition, the Prolog layer performs the normal tests for proper arguments and state, signaling the conventional instantiation, type, domain and resource exceptions.