Ver Mensaje Individual
  #6  
Antiguo 13-10-2007
pcicom pcicom is offline
Miembro
 
Registrado: may 2003
Ubicación: MONTERREY MEXICO
Posts: 253
Reputación: 22
pcicom Va por buen camino
Sorry..

Pense que eran las FBLIB

Código Delphi [-]

  1 {$IFDEF FPC}
  2  {$MODE DELPHI}
  3 {$ENDIF}
  4 program select;
  5
  6 {$IFNDEF LINUX}
  7 {$APPTYPE CONSOLE}
  8 {$ENDIF}
  9
 10 uses
 11   SysUtils, FBLDatabase,FBLTransaction,FBLDsql,FBLExcept,FBLTextGridExport;
 12 var
 13  MyDb: TFBLDatabase;
 14  MyTr: TFBLTransaction;
 15  MyDsql: TFBLDsql;
 16  DatabaseFile: string;
 17  c1,c2:String;
 18  cServ,cPass:String;
 19 begin
 20
 21
 22   cServ := paramstr(1);
 23   cPass := paramstr(2);
 24   if (cServ='') and (cPass='') then
 25     writeln('Usar:   testFDB  ');
 26
 27
 28
 29
 30   if cServ='int3' then
 31   begin
 32      writeln('DEBUGGIN HALT  int3 INT3');
 33      halt(0);
 34   end;
   if cPass='int3' then
 36         halt(0);
 37
 38   if cPass='' then
 39   begin
 40     cPass := cServ;
 41     cServ := 'localhost';
 42   end
 43   ELSE
 44   begin
 45     if cServ='' then cServ := 'localhost';
 46     if cPass='' then cPass := '';
 47   end;
 48
 49
 50
 51   MyDb:=TFBLDatabase.Create(nil);
 52   MyTr:=TFBLTransaction.Create(nil);
 53   MyDsql:=TFBLdsql.Create(nil);
 54   {$IFDEF LINUX}
 55     DatabaseFile := '/opt/firebird/data/MIBASE.fdb';
 56   {$ELSE}
 57     DatabaseFile := GetCurrentDir + '\MIBASE.fdb';
 58   {$ENDIF}
 59   writeln(DatabaseFile);
 60   try
 61    MyTr.Database:=MyDb;
 62    MyDsql.Transaction:=MyTr;
 63    MyDb.DBFile:=DatabaseFile;
 64    MyDb.User:='sysdba';
 65    MyDb.Password:=cPass;
 66    {$IFDEF LINUX}
 67    // under linux and firebird 1.5
 68    MyDb.Protocol := ptTcpIp;
 69    MyDb.Host := cServ;
 70    {$ENDIF}
    try
 72      Mydb.Connect;
 73      MyTr.StartTransaction;
 74      MyDsql.SQL.Text := 'SELECT * FROM clientes';
 75      MyDsql.ExecSQL;
 76      WriteLn('Database server version :' + MyDb.Version);
 77      WriteLn('Database client version :' + Mydb.ClientVersion);
 78      try
 79        while not MyDsql.EOF do
 80        begin
 81          c1 := MyDsql.FieldbyNameasString('cliente');
 82          c2 := MyDsql.FieldbyNameasString('nombre');
 83          MydSql.Next;
 84          WRITELN(c1+' '+c2);
 85        end;
 86      finally
 87        mYdSQL.Close;
 88      end;
 89      MyDSql.Close;
 90     except
 91     on E:EFBLError do
 92       begin
 93         WriteLn('ISC_ERROR :' + IntToStr(E.ISC_ErrorCode));
 94         WriteLn(E.Message);
 95       end;
 96     end;
 97   finally
 98    MyDsql.Free;
 99    MyTr.Free;
100    MyDb.Free;
101   end;
102 end.
__________________
Poco ha de saber el que no pregunta.. Yo por eso soy un pregunton

Última edición por pcicom fecha: 13-10-2007 a las 06:14:45.
Responder Con Cita