There are several ways that can be used to extract information from or modify a table in a data source. Users can access a table using the relation level interface or view level interface which XSB provides or they can have their SQL statements executed directly without having XSB process it. In general, uses are required to firstly use odbc_import/2 to give XSB the information about columns in the table of interest, expect for the cases such as direct execution of SQL statements and data dictionary operations, etc. and XSB will automatically assert data dictionary informationsome other ODBC interface predicates can cause XSB to do this too. The Prolog predicate listing/2 can be used if it's available to see the asserted data dictionary information at any time.
The syntax of odbc_import/2 is as follows:
where 'TableName' is the name of the table that is desired for accessing and 'PredicateName' is the name of the predicate for future table operations from XSB. 'FIELD1', 'FIELD2', ... , 'FIELDn' are the exact attribute namescase sensitive as defined in the table schema. The chosen columns define the view and the order of arguments for the database predicate 'PredicateName'.
For example, to create a link to the Test table through the 'test' predicate:
| ?- odbc_import('Test'('TId','TName','Length','Price'),test). yes