removed: hidden variable 'old_url' in emacs template
git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@527 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
33
core/db.cpp
33
core/db.cpp
@@ -821,6 +821,39 @@ void Db::GetItems(std::vector<Item> & item_table, long parent_id, Item::Type typ
|
||||
}
|
||||
|
||||
|
||||
// how many items there are in a 'parent_id' directory
|
||||
long Db::Size(long parent_id, Item::Type type)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
int res = 0;
|
||||
|
||||
try
|
||||
{
|
||||
AssertConnection();
|
||||
|
||||
std::ostringstream query;
|
||||
query << "select count(id) from core.item where ";
|
||||
|
||||
if( type != Item::none )
|
||||
query << "type='" << (int)type << "' and ";
|
||||
|
||||
query << "parent_id='" << parent_id << "';";
|
||||
|
||||
r = AssertQuery( query.str() );
|
||||
AssertResultStatus(r, PGRES_TUPLES_OK);
|
||||
|
||||
res = atol(AssertValue(r, 0, 0));
|
||||
}
|
||||
catch(const Error &)
|
||||
{
|
||||
}
|
||||
|
||||
ClearResult(r);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
// !! ta chyba nie uzywana juz?
|
||||
void Db::GetItem(std::vector<Item> & item_table, long id)
|
||||
{
|
||||
|
||||
@@ -65,6 +65,8 @@ public:
|
||||
void GetGroups(UGContainer<Group> & group_table);
|
||||
|
||||
// !! nowy interfejs
|
||||
long Size(long parent_id, Item::Type type = Item::none);
|
||||
|
||||
Error GetItem(long parent_id, const std::string & url, Item & item);
|
||||
Error EditDefaultItem(long id, long new_default_item);
|
||||
|
||||
|
||||
@@ -308,6 +308,16 @@ return buffer;
|
||||
}
|
||||
|
||||
|
||||
const char * ToStr(int value)
|
||||
{
|
||||
static char buffer[100];
|
||||
|
||||
sprintf(buffer, "%d", value);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
bool IsWhite(int s)
|
||||
{
|
||||
if( s==' ' || s=='\t' || s==13 )
|
||||
|
||||
@@ -43,6 +43,8 @@ bool IsWhite(int s);
|
||||
void TrimWhite(std::string & s);
|
||||
void ToSmall(std::string & s);
|
||||
const char * SkipWhite(const char * s);
|
||||
const char * ToStr(int value);
|
||||
|
||||
|
||||
bool ValidateEmail(const std::string & email);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user