1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
Program project1;
{$mode objfpc}{$H+}
{$ifdef windows}
{$apptype console}
{$endif}
Uses
{$IFDEF UNIX}
{$IFDEF UseCThreads}
cthreads,
{$ENDIF}
{Widestring manager needed for widestring support}
cwstring,
{$ENDIF}
{$IFDEF WINDOWS}
Windows, {for setconsoleoutputcp}
{$ENDIF}
Classes, sysUtils, Process, LazUTF8, crt
{ you can add units after this };
var
login : string;
AProcess: TProcess;
codsql:string;
UTF8TestString, line: string;
f : text;
{$R *.res}
Begin
{$IFDEF WINDOWS}
SetConsoleOutputCP(CP_UTF8);
{$ENDIF}
highvideo;
clrscr;
textbackground(red);
textcolor(white);
writeln('Enter You''re name :');
textbackground(black);
textcolor(white);
gotoxy(20,1);
readln(login);
textbackground(blue);
textcolor(yellow);
writeln;
writeln('Welcome ' + Login);
Writeln;
textbackground(Green);
textcolor(LightCyan);
textbackground(Black);
textcolor(White);
// Writeln(UTF8ToConsole('Tapez "entrée" pour continuer....'));
UTF8TestString:='Tapez "entrée" pour continuer....';
WriteLn(UTF8TestString);
//Writeln('Tapez "entrée" pour continuer....'); // Affichage incorrecte en direct
ReadLn;
writeln('Affichage du contenu d''une table');
sleep (2000);
codsql:='SELECT UPPER(Lastname) AS ''Nom'' , FirstName AS ''Prénom'' , SUBSTR(BirthDate,1,10) AS ''Date Nais'' FROM employees ORDER BY BirthDate';
codsql:=codsql+' ORDER BY BirthDate';
AProcess := TProcess.Create(nil);
AProcess.Executable := 'sqlite3' ;
AProcess.Parameters.Add('chinook.db');
AProcess.Parameters.Add('.headers on');
AProcess.Parameters.Add('.mode column');
AProcess.Parameters.Add('.width 5 5 40');
AProcess.parameters.Add('.output outsql.dat');
AProcess.Parameters.Add('.read requete.sql');
//AProcess.Parameters.Add(codsql);
AProcess.Options := AProcess.Options + [poWaitOnExit];
AProcess.Execute;
AProcess.Free;
Writeln;
assignfile(f,'outsql.dat');
reset(f);
while not eof(f) do
begin
readln(f,line);
writeln(line);
end;
close(f);
Writeln;
UTF8TestString:='ça ne marche pas bien avec crt...';
writeln(UTF8TestString);
readln;
End. |
Partager