Ada Programming/Libraries/Database/GWindows

From Wikibooks, open books for an open world
Jump to: navigation, search

Ada Lovelace 1838.jpg

Library functions[edit]

David Botton created GNATCOM project to help Ada interoperate with Windows COM Object. The GWindows project is based on GNATCOM. It is used to create Windows Graphics User Interface.

The database package is a subset of the GWindows project. It is very easy and useful.

Library links[edit]

Author  
David Botton
Homepage  
http://www.gnavi.org/index.php?Command=Class&ClassID=GWindowsWin32&Title=GWindows
Project Info  
GWindows
Library Document 
http://www.gnavi.org/gwindows/ref/gwindows-databases.html
CVS Archive  
- missing -
Download  
http://www.gnavi.org

Sample code[edit]

with Gnatcom.Initialize;
with Gnatcom.Types;
with Gnatcom.Variant;
with Gwindows.Databases;  use Gwindows.Databases;
with Ada.Text_IO;         use Ada.Text_IO;
with Ada.Strings;
with Ada.Strings.Fixed;
with Ada.Exceptions;
with System;

procedure Test is
     Connection : Database_Type;
     Recordset  : Recordset_Type;  
     customer   : Gnatcom.Types.Variant; 
begin
     Gnatcom.Initialize.Initialize_Com;

     -- make connection
     Open (Connection,
        "DSN=Northwind","your ID","your password");

     -- make Recordset(ResultSet)
     Open (Recordset,
        Connection,
        "SELECT * from Orders",
        Dynamic,
        Optimistic);

     -- start to process your bussiness solution
     while not Eof (Recordset) loop
        customer := Field_Value(Recordset,"customerId");
        Process (customer);       -- your customer procedure
        Move_Next (Recordset);
     end loop;

     -- release database resource
     Gwindows.Databases.Close(Recordset);
end Test;

See also[edit]

Wikibook[edit]

Ada Reference Manual[edit]

-- none apply --