2010-09-18 02:51:12 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of Winix
|
2014-10-04 20:04:03 +02:00
|
|
|
* and is distributed under the 2-Clause BSD licence.
|
|
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2015-06-16 04:37:07 +02:00
|
|
|
* Copyright (c) 2010-2015, Tomasz Sowa
|
2010-09-18 02:51:12 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2014-10-04 20:04:03 +02:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
2010-09-18 02:51:12 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
namespace Winix
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-18 02:51:12 +02:00
|
|
|
|
|
|
|
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
|
2011-06-24 22:53:21 +02:00
|
|
|
bool sel_file; // file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size
|
2010-09-18 02:51:12 +02:00
|
|
|
bool sel_html_template; // template
|
2011-06-24 22:53:21 +02:00
|
|
|
bool sel_sort_index; // sort_index
|
2012-11-04 22:01:02 +01:00
|
|
|
bool sel_meta; // meta and ameta (PT::Space)
|
2010-09-18 02:51:12 +02:00
|
|
|
|
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
|
2015-06-16 04:37:07 +02:00
|
|
|
bool sort_index_asc;
|
|
|
|
bool sort_date_asc;
|
2010-09-18 02:51:12 +02:00
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-12 17:30:49 +01:00
|
|
|
} // namespace Winix
|
|
|
|
|
|
|
|
|
2010-09-18 02:51:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|