added: 'rm' function can remove auth content now
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@597 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
16
core/db.cpp
16
core/db.cpp
@@ -1352,8 +1352,6 @@ Error Db::DelItemCountContents(const Item & item, long & contents)
|
||||
AssertResultStatus(r, PGRES_TUPLES_OK);
|
||||
|
||||
contents = atol( AssertValue(r, 0, 0) );
|
||||
|
||||
log << log2 << "counters: " << contents << logend; // !! nie potrzebne w logach
|
||||
}
|
||||
catch(const Error & e)
|
||||
{
|
||||
@@ -1830,8 +1828,13 @@ Error Db::RemoveThread(long dir_id)
|
||||
query << "delete from core.thread where dir_id='" << dir_id << "';";
|
||||
|
||||
const char * crows = PQcmdTuples(r);
|
||||
long rows = 0;
|
||||
|
||||
if( crows )
|
||||
log << log2 << "Db: deleted " << atol(crows) << " rows from core.thread" << logend;
|
||||
rows = atol(crows);
|
||||
|
||||
if( rows > 0 )
|
||||
log << log2 << "Db: deleted " << rows << " rows from core.thread" << logend;
|
||||
|
||||
r = AssertQuery(query.str());
|
||||
AssertResultStatus(r, PGRES_COMMAND_OK);
|
||||
@@ -2081,8 +2084,13 @@ Error Db::RemoveTicket(long dir_id)
|
||||
query << "delete from core.ticket where dir_id='" << dir_id << "';";
|
||||
|
||||
const char * crows = PQcmdTuples(r);
|
||||
long rows = 0;
|
||||
|
||||
if( crows )
|
||||
log << log2 << "Db: deleted " << atol(crows) << " rows from core.ticket" << logend;
|
||||
rows = atol(crows);
|
||||
|
||||
if( rows > 0 )
|
||||
log << log2 << "Db: deleted " << rows << " rows from core.ticket" << logend;
|
||||
|
||||
r = AssertQuery(query.str());
|
||||
AssertResultStatus(r, PGRES_COMMAND_OK);
|
||||
|
||||
@@ -387,31 +387,14 @@ void Dirs::SplitPath(const std::string & path, std::string & dir, std::string &
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// !! przeniesc to do rm
|
||||
// mamy juz interfejs do chodzenia po parentach
|
||||
void Dirs::DeleteDir(long id)
|
||||
bool Dirs::DelDir(long dir_id)
|
||||
{
|
||||
DirContainer::ParentIterator pnext, p = dir_table.FindFirstParent(id);
|
||||
|
||||
for( ; p != dir_table.ParentEnd() ; p = pnext )
|
||||
{
|
||||
// this iterator p will be deleted by the next DeleteDir(p->second->id)
|
||||
// (the next iterator we must calculate beforehand)
|
||||
pnext = dir_table.NextParent(p);
|
||||
|
||||
DeleteDir(p->second->id);
|
||||
}
|
||||
|
||||
if( db.DelDirById(id) == WINIX_ERR_OK )
|
||||
dir_table.DelById(id);
|
||||
|
||||
db.RemoveThread(id);
|
||||
db.RemoveTicket(id);
|
||||
return dir_table.DelById(dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
bool MakePath(long dir_id, std::string & path);
|
||||
bool ChangeParent(long dir_id, long new_parent_id);
|
||||
bool HasParent(long dir_id, long parent_id);
|
||||
bool DelDir(long dir_id);
|
||||
|
||||
int AnalyzePath(const std::string & path, long & dir_id, std::string & dir, std::string & file);
|
||||
static void SplitPath(const std::string & path, std::string & dir, std::string & file);
|
||||
@@ -53,7 +54,6 @@ public:
|
||||
Item * GetDir(long id);
|
||||
Item * AddDir(const Item & item);
|
||||
|
||||
void DeleteDir(long id);
|
||||
void CheckRootDir();
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user