/* * This file is a part of Winix * and is distributed under the 2-Clause BSD licence. * Author: Tomasz Sowa */ /* * Copyright (c) 2010-2014, Tomasz Sowa * All rights reserved. * * 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. * */ #ifndef headerfile_winix_db_dbitemquery #define headerfile_winix_db_dbitemquery #include #include "core/item.h" namespace Winix { struct DbItemQuery { // id and content_id is selected always 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 bool sel_content; // content, content_type, ref, modify_index bool sel_url; // url bool sel_type; // type (dir, file, none) bool sel_link; // link_to, link_redirect bool sel_file; // file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size bool sel_html_template; // template bool sel_sort_index; // sort_index bool sel_meta; // meta and ameta (PT::Space) bool where_id; // bool where_parent_id; // bool where_type; bool where_file_type; long id; // if where_id is true long parent_id; // if where_parent_id is true Item::Type type; bool type_equal; int file_type; bool file_type_equal; // if true means file_type should be equal bool sort_asc; const std::vector * id_tab; // != 0 if WhereIdIn was used long limit; long offset; DbItemQuery(); void Clear(); void SetAllSel(bool sel); void SetAllWhere(bool where_); void SetAll(bool sel, bool where_); void WhereId(long id_); void WhereIdIn(const std::vector & id_tab_list); void WhereParentId(long parent_id_); void WhereType(Item::Type type_, bool equal = true); void WhereFileType(int file_t, bool equal = true); void Limit(long l); // setting 0 turns off void Offset(long o); // setting 0 turns off }; } // namespace Winix #endif