changed: in plugin 'menu'

menu_dir_tab ezc functions can be nested now
         (not finished yet)
added:   'meta' winix function
         additional meta information for files and directories
         (not finished yet)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@775 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-11-25 04:51:55 +00:00
parent 1e9ab2f805
commit 7902389ef1
41 changed files with 2461 additions and 1863 deletions

View File

@@ -678,6 +678,7 @@ void Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool
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");
}
query << R(" from core.item");
@@ -811,16 +812,18 @@ void Db::GetItems(std::vector<Item> & item_tab, const DbItemQuery & item_query)
r = GetItemsQuery(item_query);
AssertResult(r, PGRES_TUPLES_OK);
Item item;
get_item_temp.Clear();
int rows = Rows(r);
DbItemColumns col;
col.SetColumns(r);
if( rows > 0 && size_t(rows) > item_tab.capacity() )
item_tab.reserve(rows);
item_cols.SetColumns(r);
for(int i = 0 ; i<rows ; ++i)
for(int i=0 ; i<rows ; ++i)
{
col.SetItem(r, i, item);
item_tab.push_back(item);
item_tab.push_back(get_item_temp);
item_cols.SetItem(r, i, item_tab.back());
}
}
catch(const Error &)
@@ -874,9 +877,8 @@ Error Db::GetItem(Item & item, const DbItemQuery & item_query)
if( rows == 1 )
{
DbItemColumns col;
col.SetColumns(r);
col.SetItem(r, 0, item);
item_cols.SetColumns(r);
item_cols.SetItem(r, 0, item);
}
else
if( rows == 0 )
@@ -957,9 +959,8 @@ Error Db::GetItem(long parent_id, const std::wstring & url, Item & item)
if( Rows(r) == 0 )
throw Error(WINIX_ERR_NO_ITEM);
DbItemColumns col;
col.SetColumns(r);
col.SetItem(r, 0, item);
item_cols.SetColumns(r);
item_cols.SetItem(r, 0, item);
}
catch(const Error & e)
{
@@ -991,9 +992,8 @@ Error Db::GetItemById(long item_id, Item & item)
if( Rows(r) == 0 )
throw Error(WINIX_ERR_NO_ITEM);
DbItemColumns col;
col.SetColumns(r);
col.SetItem(r, 0, item);
item_cols.SetColumns(r);
item_cols.SetItem(r, 0, item);
}
catch(const Error & e)
{
@@ -1076,9 +1076,8 @@ bool result = false;
if( Rows(r) != 1 )
throw Error();
DbItemColumns col;
col.SetColumns(r);
col.SetItem(r, 0, item);
item_cols.SetColumns(r);
item_cols.SetItem(r, 0, item);
result = true;
}
@@ -1238,6 +1237,23 @@ return EndTrans(result);
Error Db::EditMetaById(const Space & meta, long id)
{
meta_stream.Clear();
meta.Serialize(meta_stream);
query.Clear();
query << R("update core.item set (meta) = (")
<< meta_stream.Str()
<< R(") where id=")
<< id
<< R(";");
meta_stream.Clear();
return DoCommand(query);
}
@@ -1466,13 +1482,11 @@ void Db::GetDirs(DirContainer & dir_tab)
dir_temp.Clear();
int rows = Rows(r);
item_cols.SetColumns(r);
DbItemColumns col;
col.SetColumns(r);
for(int i = 0 ; i<rows ; ++i)
for(int i=0 ; i<rows ; ++i)
{
col.SetItem(r, i, dir_temp);
item_cols.SetItem(r, i, dir_temp);
dir_tab.PushBack(dir_temp);
}
}