Remove unneeded with statements
[gnadelite.git] / tests / t2.adb
blob49df429e6539107edb9499f627515b6fa7107657
1 ------------------------------------------------------------------------------
2 -- GnadeLite --
3 -- --
4 -- Copyright (C) 2008 --
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 Ada.Text_IO;
24 with DB.SQLite;
26 with Morzhol.Logs;
28 procedure T2 is
30 use Ada;
32 Handle : DB.SQLite.Handle;
33 begin
34 Morzhol.Logs.Set (Morzhol.Logs.Information, False);
35 Morzhol.Logs.Set (Morzhol.Logs.Warnings, False);
36 Morzhol.Logs.Set (Morzhol.Logs.Error, False);
39 Handle.Connect (DB.SQLite.In_Memory_Database);
41 Handle.Execute
42 ("create table t ('a' integer, 'b' integer);"
43 & "insert into t (a, b) values (1, 2);"
44 & "insert into t (a, b) values (3, 4);");
46 declare
47 Iter : DB.SQLite.Iterator;
48 Line : DB.String_Vectors.Vector;
49 begin
50 Handle.Prepare_Select
51 (Iter, "select * from t");
53 while Iter.More loop
54 Iter.Get_Line (Line);
56 if DB.String_Vectors.Element (Line, 1) /= "" then
57 Text_IO.Put (DB.String_Vectors.Element (Line, 1));
58 Text_IO.Put (DB.String_Vectors.Element (Line, 2));
59 end if;
60 Line.Clear;
61 end loop;
62 Iter.End_Select;
63 end;
65 Handle.Close;
67 end T2;