2010-09-18 02:51:12 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
|
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef headerfile_winix_db_dbitemquery
|
|
|
|
#define headerfile_winix_db_dbitemquery
|
|
|
|
|
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
#include <vector>
|
2010-09-18 02:51:12 +02:00
|
|
|
#include "core/item.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct DbItemQuery
|
|
|
|
{
|
2011-01-05 22:24:11 +01:00
|
|
|
// id and content_id is selected always
|
2010-09-18 02:51:12 +02:00
|
|
|
bool sel_parent_id; // parent_id
|
|
|
|
bool sel_user_id; // user_id, modification_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
|
2011-01-05 22:24:11 +01:00
|
|
|
bool sel_content; // content, content_type, ref, modify_index
|
2010-09-18 02:51:12 +02:00
|
|
|
bool sel_url; // url
|
|
|
|
bool sel_type; // type (dir, file, none)
|
2011-01-05 22:24:11 +01:00
|
|
|
bool sel_link; // link_to, link_redirect
|
2010-12-11 23:55:48 +01:00
|
|
|
bool sel_file; // file_path, file_fs, file_type, has_thumb
|
2010-09-18 02:51:12 +02:00
|
|
|
bool sel_html_template; // template
|
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
bool where_id; //
|
2010-09-18 02:51:12 +02:00
|
|
|
bool where_parent_id; //
|
|
|
|
bool where_type;
|
2010-12-10 22:07:01 +01:00
|
|
|
bool where_file_type;
|
2010-09-18 02:51:12 +02:00
|
|
|
|
|
|
|
long id; // if where_id is true
|
|
|
|
long parent_id; // if where_parent_id is true
|
|
|
|
Item::Type type;
|
2011-01-05 22:24:11 +01:00
|
|
|
bool type_equal;
|
2010-12-10 22:07:01 +01:00
|
|
|
int file_type;
|
|
|
|
bool file_type_equal; // if true means file_type should be equal
|
2010-09-18 02:51:12 +02:00
|
|
|
bool sort_asc;
|
|
|
|
|
2011-01-20 19:37:51 +01:00
|
|
|
const std::vector<long> * id_tab; // != 0 if WhereIdIn was used
|
|
|
|
|
2010-10-19 02:31:20 +02:00
|
|
|
long limit;
|
|
|
|
long offset;
|
2010-09-18 02:51:12 +02:00
|
|
|
|
|
|
|
DbItemQuery();
|
2011-03-23 18:54:53 +01:00
|
|
|
void Clear();
|
|
|
|
|
2010-09-18 02:51:12 +02:00
|
|
|
void SetAllSel(bool sel);
|
|
|
|
void SetAllWhere(bool where_);
|
|
|
|
void SetAll(bool sel, bool where_);
|
|
|
|
|
|
|
|
void WhereId(long id_);
|
2011-01-20 19:37:51 +01:00
|
|
|
void WhereIdIn(const std::vector<long> & id_tab_list);
|
2010-09-18 02:51:12 +02:00
|
|
|
void WhereParentId(long parent_id_);
|
2011-01-05 22:24:11 +01:00
|
|
|
void WhereType(Item::Type type_, bool equal = true);
|
2010-12-10 22:07:01 +01:00
|
|
|
void WhereFileType(int file_t, bool equal = true);
|
2010-10-19 02:31:20 +02:00
|
|
|
|
|
|
|
void Limit(long l); // setting 0 turns off
|
|
|
|
void Offset(long o); // setting 0 turns off
|
2010-09-18 02:51:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|