Add mk.install to .gitignore
[gnadelite.git] / src / db-sqlite.ads
blob9f5a98980465f08b626b7781c1059f81eac4b3aa
1 ------------------------------------------------------------------------------
2 -- GnadeLite --
3 -- --
4 -- Copyright (C) 2006 --
5 -- Pascal Obry - Olivier Ramonat --
6 -- --
7 -- This library is free software; you can redistribute it and/or modify --
8 -- it under the terms of the GNU General Public License as published by --
9 -- the Free Software Foundation; either version 2 of the License, or (at --
10 -- your option) any later version. --
11 -- --
12 -- This library is distributed in the hope that it will be useful, but --
13 -- WITHOUT ANY WARRANTY; without even the implied warranty of --
14 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
15 -- General Public License for more details. --
16 -- --
17 -- You should have received a copy of the GNU General Public License --
18 -- along with this library; if not, write to the Free Software Foundation, --
19 -- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. --
20 ------------------------------------------------------------------------------
22 with GNU.DB.SQLite3;
24 package DB.SQLite is
26 DB_Error : exception renames DB.DB_Error;
28 type Handle is new DB.Handle with private;
30 -- Open / Close
32 overriding procedure Connect
33 (DB : in out Handle;
34 Name : in String;
35 User : in String := "";
36 Password : in String := "");
37 -- Open the database named Name
39 overriding procedure Close (DB : in out Handle);
40 -- Close the current database
42 -- Transaction
44 overriding procedure Begin_Transaction (DB : in Handle);
45 -- Start a new transaction, do not support embedded transactions
47 overriding procedure Commit (DB : in Handle);
48 -- Commit the current transaction
50 overriding procedure Rollback (DB : in Handle);
51 -- Rollback the current transaction
53 -- Statement
55 type Iterator is new DB.Iterator with private;
57 overriding procedure Prepare_Select
58 (DB : in Handle;
59 Iter : in out Standard.DB.Iterator'Class;
60 SQL : in String);
61 -- Prepare a select statement (SQL must be a select command)
63 overriding procedure Get_Line
64 (Iter : in out Iterator;
65 Result : out String_Vectors.Vector);
66 -- Returns the current row and move to the next one
68 overriding function More (Iter : in Iterator) return Boolean;
69 -- Returns True if there is more data (row) to fetch
71 overriding procedure End_Select (Iter : in out Iterator);
73 overriding procedure Execute (DB : in Handle; SQL : in String);
74 -- Execute SQL request into DB
76 overriding function Last_Insert_Rowid (DB : in Handle) return String;
77 -- Returns the Id of the last inserted row id
79 private
81 type Handle is new DB.Handle with record
82 H : GNU.DB.SQLite3.Handle;
83 end record;
85 type Iterator is new DB.Iterator with record
86 H : Handle;
87 S : aliased GNU.DB.SQLite3.Statement;
88 Col : Natural;
89 More : Boolean;
90 end record;
92 end DB.SQLite;