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

Comparing DecentralizedMedia/MediaFolder.cpp (file contents):
Revision 555 by douglas, 2005-07-10T21:18:35-07:00 vs.
Revision 558 by douglas, 2005-07-17T00:50:52-07:00

# Line 4 | Line 4
4   //
5   // $Id$
6  
7 < #include <menes/c++/standard.hh>
7 > #include <menes/cxx/standard.hh>
8  
9   #include <menes/dbi/resultset.hpp>
10  
# Line 70 | Line 70 | _L<MediaFile> MediaFolder::GetFiles(unsi
70          return files;
71   }
72  
73 + unsigned MediaFolder::GetFilesPages() const
74 + {
75 +        _R<dbi::Connection> connection(connector->Connect());
76 +        _R<dbi::ResultSet> count(connection->Parse(_B("SELECT count(path) FROM files WHERE live = TRUE AND folder = ?"))->Execute(path.GetPath()));
77 +        unsigned pages(0);
78 +
79 +        if (count->MoveNext())
80 +                pages = (count->Get<unsigned>(_B("count")) + 49) / 50;
81 +
82 +        connector->Release(connection);
83 +
84 +        return pages;
85 + }
86 +
87   _L<MediaFolder> MediaFolder::GetFolders(unsigned page) const
88   {
89          _R<dbi::Connection> connection(connector->Connect());
# Line 80 | Line 94 | _L<MediaFolder> MediaFolder::GetFolders(
94                  folders.InsertLast(MediaFolder(connector, paths->GetString(_B("path"))));
95  
96          connector->Release(connection);
97 <        
97 >
98          return folders;
99   }
100 +
101 + unsigned MediaFolder::GetFoldersPages() const
102 + {
103 +        _R<dbi::Connection> connection(connector->Connect());
104 +        _R<dbi::ResultSet> count(connection->Parse(_B("SELECT count(path) FROM folders WHERE folder = ?"))->Execute(path.GetPath()));
105 +        unsigned pages(0);
106 +
107 +        if (count->MoveNext())
108 +                pages = (count->Get<unsigned>(_B("count")) + 49) / 50;
109 +
110 +        connector->Release(connection);
111 +
112 +        return pages;
113 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines