added: parameter 'r' to priv function

all directories and files can be changed


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@586 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-02-16 00:37:00 +00:00
parent a276fb6b79
commit 4fe3d4339f
16 changed files with 347 additions and 106 deletions

View File

@@ -799,6 +799,8 @@ void Db::GetItems(std::vector<Item> & item_table, long parent_id, Item::Type typ
item_table.clear();
PGresult * r = 0;
item_table.clear();
try
{
AssertConnection();
@@ -859,7 +861,10 @@ return res;
}
// !! ta chyba nie uzywana juz?
// !! zamienic nazwe na GetFile?
// !! cos tu pomyslec innego, ta metoda nie musi pobierac tablicy za argument
// i tak istnieje tylko jedna pozycja o okreslonym id
// mozna zwracac bool i pobierac referencje na item
void Db::GetItem(std::vector<Item> & item_table, long id)
{
PGresult * r = 0;
@@ -1020,8 +1025,6 @@ long Db::GetDirId(long parent_id, const std::string & url)
// !! w tej metodzie odczytujemy tylko uprawnienia?
// bo w tej chwili jest caly item odczytywany
bool Db::GetPriv(Item & item, long id)
{
bool result = false;
@@ -1033,7 +1036,8 @@ bool result = false;
AssertConnection();
std::ostringstream query;
query << "select user_id, group_id, privileges, subject, content, guest_name from core.item left join core.content on item.content_id = content.id where item.id='" << id << "';"; // !! tymczasowo odczytujemy z content i subject
query << "select user_id, group_id, privileges, guest_name from core.item"
<< " where item.id='" << id << "';";
r = AssertQuery( query.str() );
AssertResultStatus(r, PGRES_TUPLES_OK);
@@ -1092,6 +1096,7 @@ return result;
Error Db::DelDirById(long id)
{
Error result = Error::ok;

View File

@@ -51,6 +51,7 @@ public:
void GetItems(std::vector<Item> & item_table, long parent_id, Item::Type type, bool with_subject, bool with_content, bool sort_asc);
// !! pobiera tylko jeden item (cos wymyslec innego z nazwa albo argumentem)
void GetItem(std::vector<Item> & item_table, long id);

View File

@@ -104,6 +104,25 @@ return true;
}
DirContainer::ParentIterator Dirs::FindFirstParent(long parent_id)
{
DirContainer::ParentIterator i = dir_table.FindFirstParent(parent_id);
return i;
}
DirContainer::ParentIterator Dirs::NextParent(DirContainer::ParentIterator i)
{
return dir_table.NextParent(i);
}
DirContainer::ParentIterator Dirs::ParentEnd()
{
return dir_table.ParentEnd();
}
// dodatkowo moze metoda AppendPath dodajaca sciezke do biezacego stringa?
// albo tutaj stringa nie czyscic?

View File

@@ -37,6 +37,9 @@ public:
static void SplitPath(const std::string & path, std::string & dir, std::string & file);
DirContainer::ParentIterator FindFirstParent(long parent_id);
DirContainer::ParentIterator NextParent(DirContainer::ParentIterator i);
DirContainer::ParentIterator ParentEnd();
// these methods return null if there is no such a dir
Item * GetRootDir();