added a special thread for making thumbnails (thumb.h thumb.cpp)
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@700 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
41
db/db.cpp
41
db/db.cpp
@@ -240,7 +240,7 @@ Error Db::AddItemIntoItem(Item & item)
|
||||
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, file_path, file_fs, file_type, "
|
||||
"default_item, subject, guest_name, template, url) values (")
|
||||
"has_thumb, default_item, subject, guest_name, template, url) values (")
|
||||
<< item.user_id
|
||||
<< item.modification_user_id
|
||||
<< item.group_id
|
||||
@@ -253,6 +253,7 @@ Error Db::AddItemIntoItem(Item & item)
|
||||
<< item.file_path
|
||||
<< item.file_fs
|
||||
<< item.file_type
|
||||
<< static_cast<int>(item.has_thumb)
|
||||
<< item.default_item
|
||||
<< item.subject
|
||||
<< item.guest_name
|
||||
@@ -347,7 +348,7 @@ Error Db::EditItemInItem(Item & item, bool with_url)
|
||||
query.Clear();
|
||||
query << R("update core.item set (user_id, modification_user_id, group_id, privileges, "
|
||||
"date_creation, date_modification, type, default_item, parent_id, subject, "
|
||||
"guest_name, file_path, file_fs, file_type, template");
|
||||
"guest_name, file_path, file_fs, file_type, has_thumb, template");
|
||||
|
||||
if( with_url )
|
||||
query << R(", url");
|
||||
@@ -367,6 +368,7 @@ Error Db::EditItemInItem(Item & item, bool with_url)
|
||||
<< item.file_path
|
||||
<< item.file_fs
|
||||
<< item.file_type
|
||||
<< static_cast<int>(item.has_thumb)
|
||||
<< item.html_template;
|
||||
|
||||
if( with_url )
|
||||
@@ -628,7 +630,7 @@ PGresult * Db::GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel)
|
||||
if( iq.sel_url ) query << R(" ,url");
|
||||
if( iq.sel_type ) query << R(" ,type");
|
||||
if( iq.sel_default_item ) query << R(" ,default_item");
|
||||
if( iq.sel_file ) query << R(" ,file_path, file_fs, file_type");
|
||||
if( iq.sel_file ) query << R(" ,file_path, file_fs, file_type, has_thumb");
|
||||
if( iq.sel_html_template ) query << R(" ,template");
|
||||
}
|
||||
|
||||
@@ -1040,7 +1042,7 @@ return result;
|
||||
|
||||
|
||||
|
||||
Error Db::EditFileById(Item & item, long id)
|
||||
Error Db::EditFileById(const Item & item, long id)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
Error result = WINIX_ERR_OK;
|
||||
@@ -1048,10 +1050,11 @@ Error Db::EditFileById(Item & item, long id)
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.item set (file_path, file_fs, file_type) = (")
|
||||
query << R("update core.item set (file_path, file_fs, file_type, has_thumb) = (")
|
||||
<< item.file_path
|
||||
<< item.file_fs
|
||||
<< item.file_type
|
||||
<< static_cast<int>(item.has_thumb)
|
||||
<< R(") where id=") << id << R(";");
|
||||
|
||||
r = AssertQuery(query);
|
||||
@@ -1069,6 +1072,34 @@ return result;
|
||||
|
||||
|
||||
|
||||
Error Db::EditHasThumbById(bool has_thumb, long id)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
Error result = WINIX_ERR_OK;
|
||||
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.item set (has_thumb) = (")
|
||||
<< static_cast<int>(has_thumb)
|
||||
<< 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;
|
||||
|
Reference in New Issue
Block a user