added: parameter 'l' to 'ls' function
added: Db::ItemQuery struct for querying items changed: some refactoring (renamed some config variables) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@589 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
80
core/db.h
80
core/db.h
@@ -49,7 +49,79 @@ public:
|
||||
Error EditItemByUrl(Item & item, bool with_url = true);
|
||||
void CheckAllUrlSubject();
|
||||
|
||||
void GetItems(std::vector<Item> & item_table, long parent_id, Item::Type type, bool with_subject, bool with_content, bool sort_asc);
|
||||
|
||||
struct ItemQuery
|
||||
{
|
||||
// id is selected always
|
||||
bool sel_parent_id; // parent_id
|
||||
bool sel_user_id; // user_id
|
||||
bool sel_group_id; // group_id
|
||||
bool sel_guest_name; // guest_name
|
||||
bool sel_privileges; // privileges
|
||||
bool sel_date; // date_creation, date_modification
|
||||
bool sel_subject; // subject
|
||||
bool sel_content; // content, content_type, (content_id)
|
||||
bool sel_url; // url
|
||||
bool sel_type; // type (dir, file, none)
|
||||
bool sel_default_item; // default_item
|
||||
bool sel_auth; // auth
|
||||
|
||||
bool where_id; //
|
||||
bool where_parent_id; //
|
||||
bool where_type;
|
||||
bool where_auth;
|
||||
|
||||
long id; // if where_id is true
|
||||
long parent_id; // if where_parent_id is true
|
||||
Item::Type type;
|
||||
Item::Auth auth;
|
||||
|
||||
bool sort_asc;
|
||||
|
||||
|
||||
void SetAll(bool sel, bool where_)
|
||||
{
|
||||
sel_parent_id = sel;
|
||||
sel_user_id = sel;
|
||||
sel_group_id = sel;
|
||||
sel_guest_name = sel;
|
||||
sel_privileges = sel;
|
||||
sel_date = sel;
|
||||
sel_subject = sel;
|
||||
sel_content = sel;
|
||||
sel_url = sel;
|
||||
sel_type = sel;
|
||||
sel_default_item= sel;
|
||||
sel_auth = sel;
|
||||
|
||||
where_id = where_;
|
||||
where_parent_id = where_;
|
||||
where_type = where_;
|
||||
where_auth = where_;
|
||||
}
|
||||
|
||||
void WhereId(long id_) { where_id = true; id = id_; }
|
||||
void WhereParentId(long parent_id_) { where_parent_id = true; parent_id = parent_id_; }
|
||||
void WhereType(Item::Type type_) { where_type = true; type = type_; }
|
||||
void WhereAuth(Item::Auth st) { where_auth = true; auth = st; }
|
||||
|
||||
ItemQuery()
|
||||
{
|
||||
sort_asc = true;
|
||||
SetAll(true, false);
|
||||
|
||||
id = -1;
|
||||
parent_id = -1;
|
||||
type = Item::none;
|
||||
auth = Item::auth_none;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void GetItems(std::vector<Item> & item_table, const ItemQuery & item_query);
|
||||
|
||||
|
||||
|
||||
|
||||
// !! pobiera tylko jeden item (cos wymyslec innego z nazwa albo argumentem)
|
||||
void GetItem(std::vector<Item> & item_table, long id);
|
||||
@@ -131,8 +203,8 @@ protected:
|
||||
|
||||
void CheckAllUrlSubjectModifyItem(Item & item);
|
||||
|
||||
PGresult * GetItemsQuery(long parent_id, Item::Type type, bool with_subject, bool with_content, bool sort_asc);
|
||||
|
||||
PGresult * GetItemsQuery(const ItemQuery & iq);
|
||||
|
||||
bool DelItemDelItem(const Item & item);
|
||||
void DelItemDelContent(const Item & item);
|
||||
Error DelItemCountContents(const Item & item, long & contents);
|
||||
@@ -141,7 +213,7 @@ protected:
|
||||
struct ItemColumns
|
||||
{
|
||||
int id, user_id, group_id, privileges, date_creation, date_modification, url, type, parent_id,
|
||||
content_id, default_item, subject, content, content_type, guest_name, static_auth;
|
||||
content_id, default_item, subject, content, content_type, guest_name, auth;
|
||||
|
||||
void SetColumns(PGresult * r);
|
||||
void SetItem(PGresult * r, long row, Item & item);
|
||||
|
Reference in New Issue
Block a user