I’m currently working on a custom database implementation for an external postgresql database.
I have made good progress but have a couple of issues/questions:
Firstly I am using the following bit of code to show individual tracks for each Artist.
else if iNodeType = ntArtist then begin
stmt := connection.PrepareStatement('SELECT id, track_title, length FROM cc_files WHERE artist_name = ? ORDER BY track_title');
stmt.SetString(1, iData);
rs := stmt.ExecuteQueryPrepared;
while rs.Next do
//hourval := StrToInt(Copy(rs.GetString(3),0,2)) * 60 * 60;
//minval := StrToInt(Copy(rs.GetString(3),4,2)) * 60;
//secval := StrToInt(Copy(rs.GetString(3),7,2));
//totalval := hourval + minval + secval;
//SystemLog(IntToStr(totalval));
iTree.AddNode(iParent, iThisDatabase, ntItem, rs.GetString(2), false, 0, rs.GetString(1));
end
With the code as above (the few lines commented out) I am able to use the treeview normally. If I uncomment those lines when I try to expand any artist I get an error box which says ‘Row Data is Not Available’.
I have two questions:
-
Why does the treeview seem to not work when anything other than the AddNode line is in the while loop?
-
I am using those few lines of code to convert the time in the database into seconds. It’s by no means the best way of doing it i’m sure. Is the a function which I can use to convert a ‘00:00:00.000’ format duration into a TTimeValue?
(I am using the lines that convert the duration into seconds in the database search function and it works; so I don’t think its a problem with the lines themselves).
Thanks in advance.