home *** CD-ROM | disk | FTP | other *** search
- {*******************************************************************}
- { }
- { Vita Voom Software }
- { Console demo }
- { }
- { Copyright (c) 1998-2003 Vita Voom Software }
- { ALL RIGHTS RESERVED }
- {*******************************************************************}
- { }
- { This project is a simple demonstration of how to make a console }
- { mode application using pgExpress. }
- { }
- { Please refer to the Readme.txt file for details. }
- { }
-
- program Console;
-
- {$APPTYPE CONSOLE}
-
- uses
- SysUtils,
- SqlExpr;
-
- var
- Conn: TSQLConnection;
- Dataset: TSQLDataset;
- Count: Integer;
- begin
- WriteLn('Starting pgExpress console demo...');
- WriteLn;
- Conn := nil;
- Dataset := nil;
- Count := 0;
- try
- Conn := TSQLConnection.Create(nil);
- Conn.LoadParamsOnConnect := True;
- Conn.ConnectionName := 'PGEConnection';
- // Set your password below if needed
- //Conn.Params.Add('Password=xxxx')
- Dataset := TSQLDataset.Create(Conn);
- with Dataset do
- begin
- SQLConnection := Conn;
- CommandType := ctQuery;
- CommandText := 'select * from pg_type where typtype=''b''';
- Open;
- if not Eof then
- WriteLn('Types registered in you server:');
- while not Eof do
- begin
- WriteLn(Dataset.FieldByName('typname').AsString);
- Next;
- Inc(Count);
- end;
- WriteLn;
- WriteLn('Total: ', Count, ' record(s).');
- end;
- finally
- Dataset.Free;
- Conn.Free;
- end;
- end.
-