'tickets' can use 'threads' now
git-svn-id: svn://ttmath.org/publicrep/winix/trunk@706 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -7,7 +7,8 @@ db.o: ../core/user.h ../core/group.h ../core/dircontainer.h
|
||||
db.o: ../core/ugcontainer.h ../core/log.h ../core/misc.h
|
||||
dbbase.o: dbbase.h dbconn.h dbtextstream.h ../core/textstream.h
|
||||
dbbase.o: ../core/misc.h ../core/item.h ../core/error.h ../core/log.h
|
||||
dbbase.o: ../core/textstream.h ../core/log.h ../../ezc/src/utf8.h
|
||||
dbbase.o: ../core/textstream.h ../core/log.h ../core/misc.h
|
||||
dbbase.o: ../../ezc/src/utf8.h
|
||||
dbconn.o: dbconn.h dbtextstream.h ../core/textstream.h ../core/misc.h
|
||||
dbconn.o: ../core/item.h ../core/log.h ../core/error.h ../core/log.h
|
||||
dbconn.o: ../core/textstream.h
|
||||
|
||||
@@ -626,6 +626,14 @@ PGresult * Db::GetItemsQuery(const DbItemQuery & iq, bool skip_other_sel)
|
||||
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 )
|
||||
|
||||
2
db/db.h
2
db/db.h
@@ -23,7 +23,6 @@
|
||||
#include "core/item.h"
|
||||
#include "core/user.h"
|
||||
#include "core/group.h"
|
||||
#include "core/thread.h"
|
||||
#include "core/dircontainer.h"
|
||||
#include "core/ugcontainer.h"
|
||||
|
||||
@@ -93,6 +92,7 @@ protected:
|
||||
DbTextStream query, query_create_url;
|
||||
std::wstring temp_url;
|
||||
Item dir_temp;
|
||||
std::wstring iq_id_list;
|
||||
|
||||
bool AddItemCreateUrlSubject(Item & item);
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
#include "dbbase.h"
|
||||
#include "core/log.h"
|
||||
#include "core/error.h"
|
||||
#include "core/misc.h"
|
||||
#include "utf8.h"
|
||||
|
||||
|
||||
|
||||
DbBase::DbBase()
|
||||
{
|
||||
db_conn = 0;
|
||||
@@ -283,7 +285,7 @@ tm t;
|
||||
if( len != 19 )
|
||||
{
|
||||
// the format must be like this: 2008-12-31 22:30:00
|
||||
log << log1 << "DbBase: ConvertTime: unknown time format: \"" << str << "\"";
|
||||
log << log1 << "DbBase: ConvertTime: unknown time format: \"" << str << "\"" << logend;
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -333,7 +335,7 @@ size_t buffer_len = sizeof(buffer) / sizeof(wchar_t);
|
||||
|
||||
for(size_t i=0 ; i<id_tab.size() ; ++i)
|
||||
{
|
||||
swprintf(buffer, buffer_len, L"%lu", (unsigned long)id_tab[i]);
|
||||
Toa((unsigned long)id_tab[i], buffer, buffer_len);
|
||||
list += buffer;
|
||||
|
||||
if( i+1 < id_tab.size() )
|
||||
|
||||
@@ -20,6 +20,7 @@ DbItemQuery::DbItemQuery()
|
||||
SetAll(true, false);
|
||||
|
||||
id = -1;
|
||||
id_tab = 0;
|
||||
parent_id = -1;
|
||||
type = Item::none;
|
||||
file_type = WINIX_ITEM_FILETYPE_NONE;
|
||||
@@ -77,6 +78,11 @@ void DbItemQuery::WhereId(long id_)
|
||||
}
|
||||
|
||||
|
||||
void DbItemQuery::WhereIdIn(const std::vector<long> & id_tab_list)
|
||||
{
|
||||
id_tab = &id_tab_list;
|
||||
}
|
||||
|
||||
|
||||
void DbItemQuery::WhereParentId(long parent_id_)
|
||||
{
|
||||
|
||||
@@ -11,11 +11,11 @@
|
||||
#define headerfile_winix_db_dbitemquery
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "core/item.h"
|
||||
|
||||
|
||||
|
||||
|
||||
struct DbItemQuery
|
||||
{
|
||||
// id and content_id is selected always
|
||||
@@ -33,7 +33,7 @@ struct DbItemQuery
|
||||
bool sel_file; // file_path, file_fs, file_type, has_thumb
|
||||
bool sel_html_template; // template
|
||||
|
||||
bool where_id; //
|
||||
bool where_id; //
|
||||
bool where_parent_id; //
|
||||
bool where_type;
|
||||
bool where_file_type;
|
||||
@@ -46,6 +46,8 @@ struct DbItemQuery
|
||||
bool file_type_equal; // if true means file_type should be equal
|
||||
bool sort_asc;
|
||||
|
||||
const std::vector<long> * id_tab; // != 0 if WhereIdIn was used
|
||||
|
||||
long limit;
|
||||
long offset;
|
||||
|
||||
@@ -56,6 +58,7 @@ struct DbItemQuery
|
||||
void SetAll(bool sel, bool where_);
|
||||
|
||||
void WhereId(long id_);
|
||||
void WhereIdIn(const std::vector<long> & id_tab_list);
|
||||
void WhereParentId(long parent_id_);
|
||||
void WhereType(Item::Type type_, bool equal = true);
|
||||
void WhereFileType(int file_t, bool equal = true);
|
||||
|
||||
Reference in New Issue
Block a user