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

« back to all changes in this revision

Viewing changes to fcl/db/odbc/testenv.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
 
program testenv;
2
 
{$mode objfpc}
3
 
{$h+}
4
 
uses fpodbc,Classes;
5
 
 
6
 
Var
7
 
  I,J : Integer;
8
 
  List,Options : TStringList;
9
 
  Env : TODBCEnvironment;
10
 
  UseDefault : Boolean;
11
 
 
12
 
begin
13
 
   useDefault:=(ParamCount>0) and (Paramstr(1)='-d');
14
 
   If UseDefault then
15
 
     Env:=DefaultEnvironment
16
 
   else
17
 
     Env:=TODBCEnvironment.Create(Nil);
18
 
  try
19
 
    Writeln('Handle is : ',Env.Handle);
20
 
    List:=TStringlist.Create;
21
 
    Options:=TStringList.Create;
22
 
    Writeln('List of drivers :');
23
 
    Env.GetDriverNames(List);
24
 
    Writeln('Count : ',List.Count);
25
 
    For I:=0 to List.Count-1 do
26
 
       Writeln(i:2,' : ',List[i]);
27
 
    Writeln('List of driver options :');
28
 
    For I:=0 to List.Count-1 do
29
 
      begin
30
 
      Env.GetDriverOptions(List[i],Options);
31
 
      Writeln('Options for driver ',List[i],' : ');
32
 
      For J:=0 to Options.Count-1 do
33
 
        Writeln('  ',Options[j]);
34
 
      end;
35
 
    Env.GetDataSourceNames(List,dtBoth,True);
36
 
    Writeln('List of datasource names : ');
37
 
    For I:=0 to List.Count-1 do
38
 
      writeln(i,' : ',List[i]);
39
 
    List.free;
40
 
    options.Free;
41
 
  finally
42
 
    If not UseDefault then
43
 
      env.free;
44
 
  end;
45
 
end.