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
|
procedure AddToStringGrid(DateTime: TDateTime);
var
Res,Res2 : PMYSQL_RES;
Row,Row2 : PMYSQL_ROW;
begin
Res := welcome.sql.Query('SELECT Categorie, SScategorie FROM canvas;');
Row := welcome.sql.fetch_row(Res);
while Row <> nil do
begin
// Ittération canvas
Res2 := welcome.Sql.Query('SELECT Id, Artiste, Titre, Annee, Duree, Frequence, Tempo, Intro, FadeIn, FadeOut, Path, Categorie, ssCategorie FROM playlist WHERE Categorie=''' + Row[0] + ''' AND ssCategorie=''' + Row[1] + ''' ORDER by RAND() LIMIT 0,1;');
Row2 := welcome.Sql.fetch_row(Res2);
if Row2 = nil then
begin
waitlist.StatusBar1.Panels[0].Text := 'Pas de titre trouvé dans la catégorie ' + Row[0] + ' ' + Row[1];
end
else
begin
waitlist.StringGrid1.Cells[0,pointer]:=Row2[0]; // ID
waitlist.StringGrid1.Cells[1,pointer]:=FormatDateTime('yyyy-MM-dd',DateTime); // Date
waitlist.StringGrid1.Cells[2,pointer]:=FormatDateTime('hh',DateTime); // Heure
waitlist.StringGrid1.Cells[3,pointer]:=Uppercase(Row2[1]); // ARTISTE
waitlist.StringGrid1.Cells[4,pointer]:=Uppercase(Row2[2]); // TITRE
waitlist.StringGrid1.Cells[5,pointer]:=Row2[3]; // Année
waitlist.StringGrid1.Cells[6,pointer]:=Row2[4]; // Duree
waitlist.StringGrid1.Cells[7,pointer]:=Row2[5]; // Frequence ?
waitlist.StringGrid1.Cells[8,pointer]:=Row2[6]; // Tempo ?
waitlist.StringGrid1.Cells[9,pointer]:=Row2[7]; // Intro
waitlist.StringGrid1.Cells[10,pointer]:=Row2[8]; // Fade IN ?
waitlist.StringGrid1.Cells[11,pointer]:=Row2[9]; // Fade Out
waitlist.StringGrid1.Cells[12,pointer]:=Row2[10]; // Fichier ?
waitlist.StringGrid1.Cells[13,pointer]:=Row2[11]; // Cat
waitlist.StringGrid1.Cells[14,pointer]:=Row2[12]; // ssCat
waitlist.pointer := pointer+1;
waitlist.StringGrid1.RowCount := pointer;
welcome.sql.free_result(Res2);
end;
// Fin ittération canvas
Row := welcome.sql.fetch_row(Res);
end;
welcome.sql.free_result(Res);
end; |