~ubuntu-branches/ubuntu/feisty/fpc/feisty

« back to all changes in this revision

Viewing changes to fcl/db/sqldb/examples/gfiltertable.pp

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2007-01-27 20:08:50 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070127200850-9mrptaqqjsx9nwa7
Tags: 2.0.4-5
* Fixed Build-Depends.
* Add myself to Uploaders in debian/control.
* Make sure that the sources are really patched before building them.
* Build unit 'libc' on powerpc too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(******************************************************************************
 
2
 *                                                                            *
 
3
 *  (c) 2005 CNOC v.o.f.                                                      *
 
4
 *                                                                            *
 
5
 *  File:        gFilterTable.pp                                              *
 
6
 *  Author:      Joost van der Sluis (joost@cnoc.nl)                          *
 
7
 *  Description: SQLDB example and test program                               *
 
8
 *  License:     GPL                                                          *
 
9
 *                                                                            *
 
10
 ******************************************************************************)
 
11
 
 
12
program gFilterTable;
 
13
 
 
14
{$mode objfpc}{$H+}
 
15
 
 
16
uses
 
17
  Classes,
 
18
  sqldb,
 
19
  SqldbExampleUnit;
 
20
 
 
21
begin
 
22
  ReadIniFile;
 
23
 
 
24
  CreateFConnection;
 
25
  CreateFTransaction;
 
26
  CreateFQuery;
 
27
 
 
28
  with Fquery do
 
29
    begin
 
30
 
 
31
    ReadOnly := True;
 
32
 
 
33
    SQL.Clear;
 
34
    SQL.Add('select * from FPDEV');
 
35
 
 
36
    Writeln('Id;Name;Email;birthdate');
 
37
 
 
38
    Filter := 'id > 4';
 
39
    Filtered := True;
 
40
 
 
41
    Open;
 
42
 
 
43
    while not eof do
 
44
      begin
 
45
      write(fieldbyname('ID').asstring+';');
 
46
      write(fieldbyname('Name').asstring+';');
 
47
      write(fieldbyname('Email').asstring+';');
 
48
      writeln(fieldbyname('Birthdate').asstring);
 
49
      next;
 
50
      end;
 
51
 
 
52
    Filter := 'id < 5';
 
53
    First;
 
54
 
 
55
    while not eof do
 
56
      begin
 
57
      write(fieldbyname('ID').asstring+';');
 
58
      write(fieldbyname('Name').asstring+';');
 
59
      write(fieldbyname('Email').asstring+';');
 
60
      writeln(fieldbyname('Birthdate').asstring);
 
61
      next;
 
62
      end;
 
63
 
 
64
    close;
 
65
 
 
66
    end;
 
67
 
 
68
  Fquery.Free;
 
69
  Ftransaction.Free;
 
70
  Fconnection.Free;
 
71
end.
 
72