Einzelnen Beitrag anzeigen

Prototypjack

Registriert seit: 2. Feb 2003
611 Beiträge
 
Delphi 2009 Professional
 
#1

SQLite(libsql) 'Ne menge Abfragen...'Ne menge Zeit

  Alt 24. Jul 2006, 21:35
Moin!
Ich habe noch eine Frage zu mysql abfragen. Und zwar fülle ich ein Listview(VirtualStringTree in diesem Fall) mit sehr vielen Daten aus einer Tabelle, doch das dauert viel zu lange.
Hier mal meine Abfrage:
Delphi-Quellcode:
vstSongs.BeginUpdate;
  for I := 0 to Str.Count - 1 do
  begin
    Application.ProcessMessages;
    Song.SongID := StrToInt(Str.Strings[I]);
    Song.FileName := dbMain.QueryOne('SELECT "filename" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"');
    Song.Artist := dbMain.QueryOne('SELECT "artist" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"');
    Song.Title := dbMain.QueryOne('SELECT "title" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"');
    Song.Album := dbMain.QueryOne('SELECT "album" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"');
    Song.TrackNum := StrToInt(dbMain.QueryOne('SELECT "tracknum" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"'));
    Song.Year := dbMain.QueryOne('SELECT "year" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"');
    Song.Genre := dbMain.QueryOne('SELECT "genre" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"');
    Song.Rating := StrToInt(dbMain.QueryOne('SELECT "rating" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"'));
    Song.PlayTime := StrToInt(dbMain.QueryOne('SELECT "playtime" FROM "music" ' +
      'WHERE "songid" = "' + Str.Strings[I] + '"'));
    AddVSTStructure(vstSongs, nil, Song);
    // lbSongs.Items.Add(Str.Strings[I]);
  end;
  vstSongs.EndUpdate;
  vstSongs.SortTree(3, sdAscending, True);
Hat jemand eine Idee wie ich das noch optimieren könnte? Zugegeben, die einzelnen Abfragen sind sehr hässlich.

Ich hoffe ihr könnt mir helfen!
Gruß,
Max
Max
„If you have any great suggestions, feel free to mail me, and I'll probably feel free to ignore you.“ . Linus Torvalds
  Mit Zitat antworten Zitat