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

« back to all changes in this revision

Viewing changes to fcl/db/unmaintained/ddg/createds.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
    This file is part of the Free Pascal run time library.
 
3
    Copyright (c) 1999-2000 by Michael Van Canneyt, member of the
 
4
    Free Pascal development team
 
5
 
 
6
    Creates a flat datafile for use with testds.
 
7
 
 
8
    See the file COPYING.FPC, included in this distribution,
 
9
    for details about the copyright.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
 
 
15
 **********************************************************************}
 
16
program createds;
 
17
 
 
18
{$mode delphi}
 
19
 
 
20
uses ddg_rec,sysutils;
 
21
 
 
22
Type IndexFile = File Of Longint;
 
23
 
 
24
Var F : TDDGDataFile;
 
25
    I : Integer;
 
26
    S : String;
 
27
    L : IndexFile;
 
28
    TableName : String;
 
29
    IndexName : String;
 
30
    ARec : TDDGData;
 
31
 
 
32
begin
 
33
  If ParamCount<>1 then
 
34
    begin
 
35
    Writeln('Usage: createds tablename');
 
36
    Halt(1);
 
37
    end;
 
38
  TableName:=ChangeFileExt(paramstr(1),'.ddg');
 
39
  IndexName:=ChangeFileExt(TableName,'.ddx');
 
40
  Assign(F,TableName);
 
41
  Rewrite(F);
 
42
  For I:=1 to 100 do
 
43
    begin
 
44
    S:=Format('This is person %d.',[i]);
 
45
    With Arec Do
 
46
      begin
 
47
      Name:=S;
 
48
      height:=I*0.001;
 
49
      LongField:=i*4;
 
50
      ShoeSize:=I;
 
51
      WordField:=i*2;
 
52
      DateTimeField:=Now;
 
53
      TimeField:=Time;
 
54
      DateField:=Date;
 
55
      Even:=(I mod 2) = 0
 
56
      end;
 
57
    Write(F,ARec);
 
58
    end;
 
59
  Close(F);
 
60
  Assign(L,IndexName);
 
61
  Rewrite(L);
 
62
  For I:=0 to 100-1 do
 
63
    Write(L,I);
 
64
  Close(L);
 
65
end.