From s.degiorgi@tin.it  Thu Oct 28 17:10:11 1999
Received: from fep03-svc.tin.it (mta03-acc.tin.it [212.216.176.34])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id RAA11479
	for <prolog@swi.psy.uva.nl>; Thu, 28 Oct 1999 17:10:10 +0200 (MET DST)
Received: from w98 ([212.171.65.72]) by fep03-svc.tin.it
          (InterMail v4.01.01.02 201-229-111-106) with SMTP
          id <19991028150838.FPGK11176.fep03-svc@w98>
          for <prolog@swi.psy.uva.nl>; Thu, 28 Oct 1999 17:08:38 +0200
Message-ID: <000f01bf2156$45c362c0$4841abd4@w98>
From: "Stefano De Giorgi" <s.degiorgi@tin.it>
Cc: <prolog@swi.psy.uva.nl>
References: <000c01bf1d7d$fc240600$7843abd4@w98> <3812E082.D571D1D@t-online.de>
Subject: Minimal ODBC interface - I do it
Date: Thu, 28 Oct 1999 17:08:19 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211

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 ---
                                s.degiorgi@tin.it
                            sdegiorgi@tiscalinet.it




