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 500 by douglas, 2005-06-17T23:23:46-07:00 vs.
Revision 553 by douglas, 2005-07-07T04:24:27-07:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 < #include "MediaFile.hpp"
7 > #include <menes/c++/standard.hh>
8 >
9 > #include <menes/dbi/resultset.hpp>
10  
11 < #include <menes-dbi/resultset.hpp>
11 > #include "MediaFile.hpp"
12  
13 < MediaFile::MediaFile(_H<dbi::Connection>& connection, const api::Path& path) : connection(connection), path(path)
13 > MediaFile::MediaFile(const _R<dbi::Connection>& connection, const api::Path& path) : connection(connection), path(path)
14   {
15 <        _H<dbi::ResultSet> info(connection->Parse(_B("SELECT artist, title, album, genre FROM files WHERE path = ?"))->Execute(path.GetPath()));
15 >        _R<dbi::ResultSet> info(connection->Parse(_B("SELECT artist, title, album, genre FROM files WHERE path = ?"))->Execute(path.GetPath()));
16  
17          if (info->MoveNext())
18          {
# Line 19 | Line 21 | MediaFile::MediaFile(_H<dbi::Connection>
21                  album = info->GetString(_B("album"));
22                  genre = info->GetString(_B("genre"));
23          }
22        else
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, const api::Path& root) : connection(connection), path(path), artist(artist), title(title), album(album), genre(genre)
26 > MediaFile::MediaFile(const _R<dbi::Connection>& connection, const api::Path& path, const cse::String& artist, const cse::String& title, const cse::String& album, const cse::String& genre, const api::Path& root) : connection(connection), path(path), artist(artist), title(title), album(album), genre(genre)
27   {
28 <        _H<dbi::ResultSet> path_(connection->Parse(_B("SELECT path FROM files WHERE path = ?"))->Execute(path.GetPath()));
28 >        _R<dbi::ResultSet> path_(connection->Parse(_B("SELECT path FROM files WHERE path = ?"))->Execute(path.GetPath()));
29  
30          if (path_->MoveNext())
31          {
32 +                connection->Parse(_B("UPDATE files SET live = TRUE WHERE path = ?"))->Execute(path.GetPath());
33 +
34                  if (!artist.IsEmpty())
35                          connection->Parse(_B("UPDATE files SET artist = ? WHERE path = ?"))->Execute(artist, path.GetPath());
36  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines