"ocaml_beginners"::[] close a PGSQL connection

View: New views
1 Messages — Rating Filter:   Alert me  

"ocaml_beginners"::[] close a PGSQL connection

by Mihamina Rakotomandimby-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
To get the result of a query, I use:

open Postgresql
(* ... *)
let results requete =
   let c = new Postgresql.connection ~host:"localhost"
                                     ~user:"mihamina"
                                     ~dbname:"db_molanga" ()
     in
       let r = c#exec requete
       in
         c#finish;
         r;;

I would like to close the connection (c#finish) after executing.
Is this an acceptable way to do things?

Thank you.

--
       Architecte Informatique chez Blueline/Gulfsat:
    Administration Systeme, Recherche & Developpement
                                    +261 34 29 155 34