ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/DecentralizedMedia/MediaFile.cpp
(Generate patch)

Comparing DecentralizedMedia/MediaFile.cpp (file contents):
Revision 489 by douglas, 2005-06-17T00:38:17-07:00 vs.
Revision 500 by douglas, 2005-06-17T23:23:46-07:00

# Line 23 | Line 23 | MediaFile::MediaFile(_H<dbi::Connection>
23                  throw;
24   }
25  
26 < MediaFile::MediaFile(_H<dbi::Connection>& connection, const api::Path& path, const ext::String& artist, const ext::String& title, const ext::String& album, const ext::String& genre) : connection(connection), path(path), artist(artist), title(title), album(album), genre(genre)
26 > MediaFile::MediaFile(_H<dbi::Connection>& connection, const api::Path& path, const ext::String& artist, const ext::String& title, const ext::String& album, const ext::String& genre, const api::Path& root) : connection(connection), path(path), artist(artist), title(title), album(album), genre(genre)
27   {
28 <        // XXX: implement
28 >        _H<dbi::ResultSet> path_(connection->Parse(_B("SELECT path FROM files WHERE path = ?"))->Execute(path.GetPath()));
29 >
30 >        if (path_->MoveNext())
31 >        {
32 >                if (!artist.IsEmpty())
33 >                        connection->Parse(_B("UPDATE files SET artist = ? WHERE path = ?"))->Execute(artist, path.GetPath());
34 >
35 >                if (!title.IsEmpty())
36 >                        connection->Parse(_B("UPDATE files SET title = ? WHERE path = ?"))->Execute(title, path.GetPath());
37 >
38 >                if (!album.IsEmpty())
39 >                        connection->Parse(_B("UPDATE files SET album = ? WHERE path = ?"))->Execute(album, path.GetPath());
40 >
41 >                if (!genre.IsEmpty())
42 >                        connection->Parse(_B("UPDATE files SET genre = ? WHERE path = ?"))->Execute(genre, path.GetPath());
43 >
44 >                connection->Parse(_B("UPDATE files SET root = ? WHERE path = ?"))->Execute(root.GetPath(), path.GetPath());
45 >        }
46 >        else
47 >                connection->Parse(_B("INSERT INTO files (path, artist, title, album, genre, folder, root) VALUES (?, ?, ?, ?, ?, ?, ?)"))->Execute(path.GetPath(), artist, title, album, genre, path.GetParent().GetPath(), root.GetPath());
48   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines