Subject: Minimal ODBC interface - I do it

From: "Stefano De Giorgi" <[email-masked]>
Date: Thu, 28 Oct 1999 17:08:19 +0200

Thanks Uwe & Paul.

     Are you interested in very poor ODBC interface,
made by myself , wich supply three predicates in foreign library:

         - odbc_connect(DSN,UID,PWD)
                    one connection at time;
         - odbc_disconnect.
         - odbc_query(SqlQuery,R)
                    like Prodata db_sql_select/3 without HDBC argument
                    but with full unification

I make a Prolog layer, to put over this library, wich supply:

     - db_connect(DSN,UID,PWD)
     - db_connect(DSN)
            % For db with no pwd setted (default with Access)

     - db_disconnect
            % remove preds asserted and dictionary.

     - db_attach(Functor,Table)
            % succeed only if Table contains at least one row
            % Now I have no time to look at ODBC API function to
            % get the number of cols of a table, and to implement
            % it. Then I use a short cut to get the n° of cols.
     - db_attach(Functor,Table,Cols)
            % succeed even if Table is empty,
            % but even if Table doesn't exist.
     - db_detach(Table)
            % remove predicate asserted for Table

     - db_view(Funct,Query)
     - db_del_view(Funct,Arity)

     - db_select(SqlQuery,R)

     - db_preds(Type)  % show predicate asserted for Type = table or view

I tested for few time but seems to work well for my needs.

Regards,
                         ---  Stefano De Giorgi ---
                                [email-masked]
                            [email-masked]