1 ------------------------------------------------------------------------------
4 -- Copyright (C) 2006 --
5 -- Pascal Obry - Olivier Ramonat --
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. --
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. --
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 ------------------------------------------------------------------------------
26 DB_Error
: exception renames DB
.DB_Error
;
28 type Handle
is new DB
.Handle
with private;
32 overriding
procedure Connect
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
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
55 type Iterator
is new DB
.Iterator
with private;
57 overriding
procedure Prepare_Select
59 Iter
: in out Standard
.DB
.Iterator
'Class;
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
81 type Handle
is new DB
.Handle
with record
82 H
: GNU
.DB
.SQLite3
.Handle
;
85 type Iterator
is new DB
.Iterator
with record
87 S
: aliased GNU
.DB
.SQLite3
.Statement
;