fixed: meta and admin meta information were not saved in memory (in system.dirs)
when 'meta' winix function was used
added: to DbItemsQuery
sort_index_asc and sort_index_date
different sort type can be made by 'index' and by 'date'
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1013 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
18
db/db.cpp
18
db/db.cpp
@@ -869,6 +869,15 @@ void Db::GetItemsQueryWhere(const DbItemQuery & iq, DbTextStream & query)
|
||||
}
|
||||
|
||||
|
||||
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 )
|
||||
@@ -876,7 +885,10 @@ void Db::GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query)
|
||||
query << R(" order by");
|
||||
|
||||
if( iq.sel_sort_index )
|
||||
{
|
||||
query << R(" sort_index");
|
||||
GetItemsQueryOrder(iq.sort_index_asc);
|
||||
}
|
||||
|
||||
if( iq.sel_date )
|
||||
{
|
||||
@@ -884,12 +896,8 @@ void Db::GetItemsQueryOrder(const DbItemQuery & iq, DbTextStream & query)
|
||||
query << R(",");
|
||||
|
||||
query << R(" item.date_creation");
|
||||
GetItemsQueryOrder(iq.sort_date_asc);
|
||||
}
|
||||
|
||||
if( iq.sort_asc )
|
||||
query << R(" asc");
|
||||
else
|
||||
query << R(" desc");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
db/db.h
1
db/db.h
@@ -159,6 +159,7 @@ protected:
|
||||
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);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2014, Tomasz Sowa
|
||||
* Copyright (c) 2010-2015, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -49,7 +49,8 @@ DbItemQuery::DbItemQuery()
|
||||
|
||||
void DbItemQuery::Clear()
|
||||
{
|
||||
sort_asc = true;
|
||||
sort_index_asc = true;
|
||||
sort_date_asc = true;
|
||||
|
||||
SetAll(true, false);
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2014, Tomasz Sowa
|
||||
* Copyright (c) 2010-2015, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -75,7 +75,8 @@ struct DbItemQuery
|
||||
bool type_equal;
|
||||
int file_type;
|
||||
bool file_type_equal; // if true means file_type should be equal
|
||||
bool sort_asc;
|
||||
bool sort_index_asc;
|
||||
bool sort_date_asc;
|
||||
|
||||
const std::vector<long> * id_tab; // != 0 if WhereIdIn was used
|
||||
|
||||
|
||||
Reference in New Issue
Block a user