diff --git a/winixd/db/db.cpp b/winixd/db/db.cpp index 2814e5e..1550622 100644 --- a/winixd/db/db.cpp +++ b/winixd/db/db.cpp @@ -278,1383 +278,6 @@ return DoCommand(query); } - -//!! wywalic z nazwy 'Subject' nic nie jest robione z tytulem -// ta metoda uzywana tez jest w EditParentUrlById() -//bool Db::AddItemCreateUrlSubject(Item & item) -//{ -//bool is_that_url; -//PGresult * r = 0; -//int index = 1; -//const int max_index = 99; -//wchar_t appendix[20]; -//size_t appendix_len = sizeof(appendix) / sizeof(wchar_t); -//appendix[0] = 0; -// -// // only root dir may not have url -// if( item.parent_id != -1 && item.url.empty() ) -// item.url = L"empty"; -// -// try -// { -// do -// { -// query_create_url.Clear(); -// -// temp_url = item.url; -// temp_url += appendix; -// -// query_create_url -// << R("select id from core.item where url=") -// << temp_url -// << R(" and parent_id=") -// << item.parent_id -// << R(";"); -// -// r = AssertQuery(query_create_url); -// AssertResult(r, PGRES_TUPLES_OK); -// -// if( Rows(r) != 0 ) -// { -// swprintf(appendix, appendix_len, L"_(%d)", ++index); -// is_that_url = true; -// } -// else -// { -// item.url = temp_url; -// is_that_url = false; -// } -// -// ClearResult(r); -// r = 0; -// } -// while( is_that_url && index <= max_index ); -// } -// catch(const Error &) -// { -// is_that_url = true; // for returning false -// } -// -// ClearResult(r); -// -//return !is_that_url; -//} - - - - - - -//Error Db::AddItemIntoItem(Item & item) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// bool url_without_id = false; -// -// try -// { -// query.Clear(); -// query << R("insert into core.item (user_id, modification_user_id, group_id, privileges, " -// "date_creation, date_modification, type, parent_id, content_id, " -// "link_to, link_redirect, subject, guest_name, template, sort_index, meta, ameta, url) values (") -// << item.user_id -// << item.modification_user_id -// << item.group_id -// << item.privileges -// << item.date_creation -// << item.date_modification -// << static_cast(item.type) -// << item.parent_id -// << item.content_id -// << item.link_to -// << item.link_redirect -// << item.subject -// << item.guest_name -// << item.html_template -// << item.sort_index -// << item.meta -// << item.ameta; -// -// url_without_id = AddItemCreateUrlSubject(item); -// -// if( url_without_id ) -// query << item.url; -// else -// query << R(", currval('core.item_id_seq')"); // !! zrobic test czy to obecnie dziala dobrze -// -// query << R(");"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// item.id = AssertCurrval("core.item_id_seq"); -// -// if( !url_without_id ) -// Toa(item.id, item.url); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - -//Error Db::AddItemIntoContent(Item & item) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// int first_ref = 1; -// -// try -// { -// query.Clear(); -// query << R("insert into core.content (content, content_type, file_path, file_fs, " -// "file_type, has_thumb, hash, hash_type, file_size, ref, modify_index) values (") -// << item.content -// << static_cast(item.content_type) -// << item.file_path -// << item.file_fs -// << item.file_type -// << static_cast(item.has_thumb) -// << item.hash -// << item.hash_type -// << item.file_size -// << first_ref -// << item.modify_index -// << R(");"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// item.content_id = AssertCurrval("core.content_id_seq"); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - - -//Error Db::AddItem(Item & item) -//{ -// BeginTrans(); -// Error result = WINIX_ERR_OK; -// -// if( item.type == Item::file ) -// result = AddItemIntoContent(item); -// else -// item.content_id = -1; -// -// if( result == WINIX_ERR_OK ) -// result = AddItemIntoItem(item); -// -//return EndTrans(result); -//} - - - - -//Error Db::IncrementContentRef(long content_id) -//{ -// query.Clear(); -// query << R("update core.content set (ref) = ") << R(postgrsql_row_statement) << R("(ref + 1) where id = ") -// << content_id -// << R(";"); -// -//return DoCommand(query); -//} -// -// -//Error Db::DecrementContentRef(long content_id) -//{ -// query.Clear(); -// query << R("update core.content set (ref) = ") << R(postgrsql_row_statement) << R("(ref - 1) where id = ") -// << content_id -// << R(";"); -// -//return DoCommand(query); -//} - - -// item.id must be set (it's used by GetContentId) -//Error Db::AddHardLink(Item & item) -//{ -// if( item.type != Item::file || item.content_id == -1 ) -// return WINIX_ERR_FILE_EXPECTED; -// -// BeginTrans(); -// Error result = IncrementContentRef(item.content_id); -// -// if( result == WINIX_ERR_OK ) -// result = AddItemIntoItem(item); -// -//return EndTrans(result); -//} - - - -//Error Db::EditItemInItem(Item & item, bool with_url) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// bool url_without_id = false; -// -// try -// { -// query.Clear(); -// query << R("update core.item set (user_id, modification_user_id, group_id, privileges, " -// "date_creation, date_modification, type, link_to, link_redirect, parent_id, subject, " -// "guest_name, template, sort_index, meta, ameta"); -// -// if( with_url ) -// query << R(", url"); -// -// query << R(") = ") << R(postgrsql_row_statement) << R("(") -// << item.user_id -// << item.modification_user_id -// << item.group_id -// << item.privileges -// << item.date_creation -// << item.date_modification -// << static_cast(item.type) -// << item.link_to -// << item.link_redirect -// << item.parent_id -// << item.subject -// << item.guest_name -// << item.html_template -// << item.sort_index -// << item.meta -// << item.ameta; -// -// if( with_url ) -// { -// url_without_id = AddItemCreateUrlSubject(item); -// -// if( url_without_id ) -// query << item.url; -// else -// query << item.id; -// } -// -// query << R(") where id=") << item.id << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// if( with_url && !url_without_id ) -// Toa(item.id, item.url); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - -//Error Db::EditItemInContent(Item & item) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// // we don't change 'ref' here -// query.Clear(); -// query << R("update core.content set (content, content_type, file_path, file_fs, " -// "file_type, has_thumb, hash, hash_type, file_size, modify_index) = ") << R(postgrsql_row_statement) << R("(") -// << item.content -// << static_cast(item.content_type) -// << item.file_path -// << item.file_fs -// << item.file_type -// << static_cast(item.has_thumb) -// << item.hash -// << item.hash_type -// << item.file_size -// << item.modify_index -// << R(") where id=") -// << item.content_id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - -//long Db::GetContentId(long item_id) -//{ -// PGresult * r = 0; -// long result = -1; -// -// try -// { -// query.Clear(); -// query << R("select content_id from core.item where item.id=") -// << item_id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_TUPLES_OK); -// -// if( Rows(r) == 1 && Cols(r) == 1 ) -// result = AssertValueLong(r, 0, 0); -// } -// catch(const Error) -// { -// } -// -// ClearResult(r); -// -//return result; -//} - - -// item.id must be set -// !! moze nazwa poprostu EditItem (nie trzeba tego ById) ? (sprawdzic czy nie koliduje z inna nazwa) -//Error Db::EditItemById(Item & item, bool with_url) -//{ -// BeginTrans(); -// Error result = WINIX_ERR_OK; -// -// if( item.type == Item::file ) -// { -// item.content_id = GetContentId(item.id); -// result = EditItemInContent(item); -// } -// -// if( result == WINIX_ERR_OK ) -// result = EditItemInItem(item, with_url); -// -//return EndTrans(result); -//} - - - - -//Error Db::EditItemGetIdsByUrl(Item & item) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// query.Clear(); -// query << R("select id, content_id from core.item where parent_id=") -// << item.parent_id -// << R(" and item.url=") -// << item.url -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_TUPLES_OK); -// -// if( Rows(r) != 1 ) -// throw Error(WINIX_ERR_NO_ITEM); -// -// int cid = AssertColumn(r, "id"); -// int cc_id = AssertColumn(r, "content_id"); -// item.id = AssertValueLong(r, 0, cid); -// item.content_id = AssertValueLong(r, 0, cc_id); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - -// item.url and item.parent_id must be set -//Error Db::EditItemByUrl(Item & item, bool with_url) -//{ -// BeginTrans(); -// Error result = EditItemGetIdsByUrl(item); -// -// if( result == WINIX_ERR_OK ) -// { -// if( item.type == Item::file ) -// result = EditItemInContent(item); -// -// if( result == WINIX_ERR_OK ) -// result = EditItemInItem(item, with_url); -// } -// -//return EndTrans(result); -//} - - - -//Error Db::EditLinkItem(long id, const std::wstring & link_to, int link_redirect) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// query.Clear(); -// query << R("update core.item set (link_to, link_redirect) = ") << R(postgrsql_row_statement) << R("(") -// << link_to -// << link_redirect -// << R(") where id=") -// << id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// if( AffectedRows(r) == 0 ) -// { -// result = WINIX_ERR_NO_ITEM; -// log << log1 << "Db: EditLinkItem: no such an item, id: " << id << logend; -// } -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - -//Error Db::EditTemplateItemById(long id, const std::wstring & new_html_template) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// query.Clear(); -// query << R("update core.item set (template) = ") << R(postgrsql_row_statement) << R("(") -// << new_html_template -// << R(") where id=") -// << id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// if( AffectedRows(r) == 0 ) -// { -// result = WINIX_ERR_NO_ITEM; -// log << log1 << "Db: EditTemplateItemById: no such an item, id: " << id << logend; -// } -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - -//Error Db::EditSortIndexItemById(long id, int sort_index) -//{ -// query.Clear(); -// query << R("update core.item set (sort_index) = ") << R(postgrsql_row_statement) << R("(") -// << sort_index -// << R(") where id=") -// << id -// << R(";"); -// -// return DoCommand(query); -//} - - - -//void Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel) -//{ -// query << R("select item.id, content_id"); -// -// if( !skip_other_sel ) -// { -// if( iq.sel_parent_id ) query << R(", parent_id"); -// if( iq.sel_user_id ) query << R(", user_id, modification_user_id"); -// if( iq.sel_group_id ) query << R(", group_id"); -// if( iq.sel_guest_name) query << R(", guest_name"); -// if( iq.sel_privileges ) query << R(", privileges"); -// if( iq.sel_date ) query << R(", date_creation, date_modification"); -// if( iq.sel_subject ) query << R(", subject"); -// if( iq.sel_content ) query << R(", content, content_type, ref, modify_index"); -// if( iq.sel_url ) query << R(", url"); -// if( iq.sel_type ) query << R(", type"); -// if( iq.sel_link ) query << R(", link_to, link_redirect"); -// if( iq.sel_file ) query << R(", file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size"); -// if( iq.sel_html_template ) query << R(", template"); -// if( iq.sel_sort_index ) query << R(", sort_index"); -// if( iq.sel_meta ) query << R(", meta, ameta"); -// } -// -// query << R(" from core.item"); -//} - - -//void Db::GetItemsQueryJoin(const DbItemQuery & iq, DbTextStream & query) -//{ -// if( iq.sel_content || iq.sel_file || iq.where_file_type ) -// query << R(" left join core.content on item.content_id = content.id"); -//} - - - -//void Db::GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query) -//{ -// if( iq.where_id || iq.where_parent_id || iq.where_type || iq.where_file_type ) -// { -// query << R(" where "); -// const char * add_and = " and "; -// const char * if_and = ""; -// -// if( iq.where_id ) { query << R(if_and) << R("item.id=") << iq.id ; if_and = add_and; } -// -// if( iq.id_tab && !iq.id_tab->empty() ) -// { -// CreateIdList(*iq.id_tab, iq_id_list); -// query << R(if_and) << R("item.id in ") << R(iq_id_list); -// if_and = add_and; -// } -// -// if( iq.where_parent_id ){ query << R(if_and) << R("parent_id=") << iq.parent_id ; if_and = add_and; } -// -// if( iq.where_type ) -// { -// query << R(if_and) << R("type"); -// -// if( iq.type_equal ) -// query << R("="); -// else -// query << R("!="); -// -// query << int(iq.type); -// if_and = add_and; -// } -// -// -// if( iq.where_file_type ) -// { -// query << R(if_and) << R("file_type"); -// -// if( iq.file_type_equal ) -// query << R("="); -// else -// query << R("!="); -// -// query << iq.file_type; -// if_and = add_and; -// } -// } -//} - - -//void Db::GetItemsQueryOrder(bool sort_asc) -//{ -// if( sort_asc ) -// query << R(" asc"); -// else -// query << R(" desc"); -//} - - -//void Db::GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query) -//{ -// if( iq.sel_sort_index || iq.sel_date ) -// { -// query << R(" order by"); -// -// if( iq.sel_sort_index ) -// { -// query << R(" sort_index"); -// GetItemsQueryOrder(iq.sort_index_asc); -// } -// -// if( iq.sel_date ) -// { -// if( iq.sel_sort_index ) -// query << R(","); -// -// query << R(" item.date_creation"); -// GetItemsQueryOrder(iq.sort_date_asc); -// } -// } -//} - - -//void Db::GetItemsQueryLimit(const DbItemQuery & iq, DbTextStream & query) -//{ -// if( iq.limit != 0 ) -// query << R(" limit ") << iq.limit; -// -// if( iq.offset != 0 ) -// query << R(" offset ") << iq.offset; -//} - - -//PGresult * Db::GetItemsQuery(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel) -//{ -// query.Clear(); -// -// GetItemsQuerySelect(iq, query, skip_other_sel); -// GetItemsQueryJoin(iq, query); -// GetItemsQueryWhere(iq, query); -// GetItemsQueryOrder(iq, query); -// GetItemsQueryLimit(iq, query); -// -// query << R(";"); -// -//return AssertQuery(query); -//} - - - -//PGresult * Db::GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel) -//{ -// return GetItemsQuery(iq, query, skip_other_sel); -//} - - - - -//void Db::GetItems(std::vector & item_tab, const DbItemQuery & item_query) -//{ -// item_tab.clear(); -// PGresult * r = 0; -// -// try -// { -// r = GetItemsQuery(item_query); -// AssertResult(r, PGRES_TUPLES_OK); -// -// get_item_temp.Clear(); -// int rows = Rows(r); -// -// if( rows > 0 && size_t(rows) > item_tab.capacity() ) -// item_tab.reserve(rows); -// -// item_cols.SetColumns(r); -// -// for(int i=0 ; i & item_tab, const DbItemQuery & item_query) -//{ -// item_tab.clear(); -// PGresult * r = 0; -// -// try -// { -// r = GetItemsQuery(item_query, true); -// AssertResult(r, PGRES_TUPLES_OK); -// -// int rows = Rows(r); -// -// for(int i = 0 ; i(item.has_thumb) -// << item.hash -// << item.hash_type -// << item.file_size -// << R(") where id=") << content_id << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return EndTrans(result); -//} - - - -//Error Db::EditHasThumbById(bool has_thumb, long id) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// BeginTrans(); -// -// try -// { -// long content_id = GetContentId(id); -// -// if( content_id == -1 ) -// throw Error(WINIX_ERR_NO_ITEM); -// -// query.Clear(); -// query << R("update core.content set (has_thumb) = ") << R(postgrsql_row_statement) << R("(") -// << static_cast(has_thumb) -// << R(") where id=") << content_id << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return EndTrans(result); -//} - - - -//Error Db::EditMetaById(const PT::Space & meta, long id) -//{ -// query.Clear(); -// query << R("update core.item set (meta) = ") << R(postgrsql_row_statement) << R("(") -// << meta -// << R(") where id=") -// << id -// << R(";"); -// -//return DoCommand(query); -//} - - -//Error Db::EditAdminMetaById(const PT::Space & ameta, long id) -//{ -// query.Clear(); -// query << R("update core.item set (ameta) = ") << R(postgrsql_row_statement) << R("(") -// << ameta -// << R(") where id=") -// << id -// << R(";"); -// -//return DoCommand(query); -//} - - - - -//Error Db::EditSubjectById(Item & item, long id) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// query.Clear(); -// query << R("update core.item set (subject) = ") << R(postgrsql_row_statement) << R("(") -// << item.subject -// << R(") where id=") -// << id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - -//Error Db::DelDirById(long id) -//{ -// Error result = WINIX_ERR_OK; -// PGresult * r = 0; -// -// BeginTrans(); -// -// try -// { -// // decrementing ref in core.content -// query.Clear(); -// query << R("update core.content set (ref) = ") << R(postgrsql_row_statement) << R("(ref - 1) where content.id in " -// "(select content_id from core.item where type=1 and parent_id=") -// << id -// << R(");"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// ClearResult(r); -// -// // deleting in core.content where ref is zero -// query.Clear(); -// query << R("delete from core.content where ref=0;"); -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// log << log2 << "Db: deleted " << AffectedRows(r) << " rows from core.content" << logend; -// ClearResult(r); -// -// // deleting from core.item -// query.Clear(); -// query << R("delete from core.item where id=") -// << id -// << R(" or parent_id=") -// << id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// log << log2 << "Db: deleted dir: " << id << " (deleted: " << AffectedRows(r) << " rows from core.item)" << logend; -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return EndTrans(result); -//} - - - - -//Error Db::DelItemDelItem(long item_id, int type) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// query.Clear(); -// query << R("delete from core.item where id=") -// << item_id -// << R(" and type=") -// << type -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// log << log2 << "Db: deleted " << AffectedRows(r) << " from core.item" << logend; -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - - -//Error Db::DelItemDelContent(long content_id) -//{ -// PGresult * r = 0; -// Error result = WINIX_ERR_OK; -// -// try -// { -// result = DecrementContentRef(content_id); -// -// if( result == WINIX_ERR_OK ) -// { -// query.Clear(); -// query << R("delete from core.content where ref=0 and id=") -// << content_id -// << R(";"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_COMMAND_OK); -// -// log << log2 << "Db: deleted " << AffectedRows(r) << " rows from core.content" << logend; -// } -// } -// catch(const Error & e) -// { -// result = e; -// } -// -// ClearResult(r); -// -//return result; -//} - - - - - - -//Error Db::DelItem(const Item & item) -//{ -//Error result = WINIX_ERR_NO_ITEM; -// -// if( item.type == Item::file ) -// { -// BeginTrans(); -// result = DelItemDelContent(item.content_id); -// -// if( result == WINIX_ERR_OK ) -// result = DelItemDelItem(item.id, 1); -// -// result = EndTrans(result); -// } -// else -// if( item.type == Item::symlink ) -// { -// result = DelItemDelItem(item.id, 2); -// } -// else -// if( item.type == Item::dir ) -// { -// result = DelDirById(item.id); -// } -// -//return result; -//} - - - - -//Error Db::DelFileById(long file_id) -//{ -//Error result = WINIX_ERR_NO_ITEM; -// -// BeginTrans(); -// -// long content_id = GetContentId(file_id); -// -// if( content_id != -1 ) -// { -// result = DelItemDelContent(content_id); -// -// if( result == WINIX_ERR_OK ) -// result = DelItemDelItem(file_id, 1); -// } -// -// result = EndTrans(result); -// -//return result; -//} - - - -//Error Db::DelSymlinkById(long symlink_id) -//{ -// return DelItemDelItem(symlink_id, 2); -//} - - -//void Db::GetDirs(DirContainer & dir_tab) -//{ -// PGresult * r = 0; -// -// try -// { -// query.Clear(); -// query << R("select * from core.item where type=0;"); -// -// r = AssertQuery(query); -// AssertResult(r, PGRES_TUPLES_OK); -// -// dir_temp.Clear(); -// int rows = Rows(r); -// item_cols.SetColumns(r); -// -// for(int i=0 ; i & user_tab) { PGresult * r = 0; diff --git a/winixd/db/db.h b/winixd/db/db.h index 9eb08b7..1194d39 100644 --- a/winixd/db/db.h +++ b/winixd/db/db.h @@ -41,9 +41,6 @@ #include #include #include "dbbase.h" -#include "dbitemquery.h" -#include "dbitemcolumns.h" -//#include "core/item.h" #include "core/user.h" #include "core/group.h" #include "core/dircontainer.h" @@ -54,17 +51,10 @@ namespace Winix { - - class Db : public DbBase { public: -// Db() : item_cols(*this) -// { -// is_postgresql_smaller_than_10 = false; -// } - Db() { is_postgresql_smaller_than_10 = false; @@ -83,92 +73,16 @@ public: Error ChangeUserTimeZone(long user_id, size_t time_zone_id); Error RemoveUser(long user_id); - //Error AddItem(Item & item); - //Error EditItemById(Item & item, bool with_url = true); - //Error EditItemByUrl(Item & item, bool with_url = true); - - - - // !! nie zwracac zadnych kodow bledow? - //void GetItems(std::vector & item_tab, const DbItemQuery & item_query); - //void GetItems(std::vector & item_tab, const DbItemQuery & item_query); - //Error GetItem(Item & item, const DbItemQuery & item_query); - - //bool GetPriv(Item & item, long id); - //Error EditPrivById(Item & item, long id); // !! dlaczego tu nie ma const? - //Error EditParentUrlById(Item & item, long id); - //Error EditFileById(const Item & item, long id); // file_path, file_fs, file_type - //Error EditHasThumbById(bool has_thumb, long id); - //Error EditMetaById(const PT::Space & meta, long id); - //Error EditAdminMetaById(const PT::Space & meta, long id); - - //Error DelDirById(long id); - //Error DelFileById(long file_id); - //Error DelSymlinkById(long symlink_id); - - //Error EditSubjectById(Item & item, long id); - - - //Error DelItem(const Item & item); - //void GetDirs(DirContainer & dir_tab); void GetUsers(UGContainer & user_tab); void GetGroups(UGContainer & group_tab); - // !! nowy interfejs - //long Size(long parent_id, Item::Type type = Item::none); - - //Error GetItemById(long item_id, Item & item); - //Error GetItem(long parent_id, const std::wstring & url, Item & item); - //Error EditLinkItem(long id, const std::wstring & link_to, int link_redirect); - //Error EditTemplateItemById(long id, const std::wstring & new_html_template); - - //long GetItemId(long parent_id, const std::wstring & url, Item::Type type); - //long GetFileId(long parent_id, const std::wstring & url); - //long GetDirId(long parent_id, const std::wstring & url); - - //Error AddHardLink(Item & item); - //Error EditSortIndexItemById(long id, int sort_index); - - protected: DbTextStream query, query_create_url; - //std::wstring temp_url; - //Item dir_temp; - //Item get_item_temp; - //std::wstring iq_id_list; - //DbItemColumns item_cols; - bool is_postgresql_smaller_than_10; std::wstring postgrsql_row_statement; - //bool AddItemCreateUrlSubject(Item & item); - - //Error AddItemIntoContent(Item & item); - //Error AddItemIntoItem(Item & item); - - //Error EditItemInItem(Item & item, bool with_url); - //Error EditItemInContent(Item & item); - //Error EditItemGetIdsByUrl(Item & item); - //long GetContentId(long item_id); - - - //Error DelItemDelItem(long item_id, int type); - //Error DelItemDelContent(long content_id); - - //Error IncrementContentRef(long content_id); - //Error DecrementContentRef(long content_id); - - //void GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel); - //void GetItemsQueryJoin(const DbItemQuery & iq, DbTextStream & query); - //void GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query); - //void GetItemsQueryOrder(bool sort_asc); - //void GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query); - //void GetItemsQueryLimit(const DbItemQuery & iq, DbTextStream & query); - //PGresult * GetItemsQuery(const DbItemQuery & iq, DbTextStream & query, bool skip_other_sel = false); - //PGresult * GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel = false); - };