start working on 0.7.x branch
- added FileLog which stores content to the file log - now Log is only a wrapper - it puts messages to the local buffer and when logsave is used then the buffer is put to FileLog - new base classes: WinixBase (Log, Config*, Synchro*) WinixModel : public WinixBase (morm::ModelConnector*, Plugin*) WinixSystem : public WinixModel (System*) WinixRequest : public WinixSystem (SLog, Cur*) - singletons: log, slog, plugin are depracated - now references to them are in base classses (WinixBase, WinixModel) - DbBase, DbConn and Db are depracated - now we are using Morm project (in WinixModel there is a model_connector pointer) each thread will have its own ModelConnector git-svn-id: svn://ttmath.org/publicrep/winix/branches/0.7.x@1146 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -12,27 +12,23 @@ db.o: ../../../pikotools/textstream/textstream.h
|
||||
db.o: ../../../pikotools/membuffer/membuffer.h
|
||||
db.o: ../../../pikotools/textstream/types.h ../../../pikotools/utf8/utf8.h
|
||||
db.o: ../../../winix/winixd/core/winix_const.h
|
||||
db.o: ../../../winix/winixd/core/error.h
|
||||
db.o: ../../../winix/winixd/core/winixbase.h
|
||||
db.o: ../../../winix/winixd/core/config.h
|
||||
db.o: ../../../pikotools/space/spaceparser.h ../../../pikotools/space/space.h
|
||||
db.o: dbitemquery.h ../../../winix/winixd/core/item.h dbitemcolumns.h
|
||||
db.o: ../../../winix/winixd/core/user.h ../../../winix/winixd/core/group.h
|
||||
db.o: ../../../winix/winixd/core/dircontainer.h
|
||||
db.o: ../../../winix/winixd/core/ugcontainer.h
|
||||
db.o: ../../../winix/winixd/core/htmlfilter.h
|
||||
db.o: ../../../winix/winixd/core/log.h
|
||||
db.o: ../../../winix/winixd/core/textstream.h
|
||||
db.o: ../../../winix/winixd/core/logmanipulators.h
|
||||
db.o: ../../../winix/winixd/core/slog.h ../../../winix/winixd/core/cur.h
|
||||
db.o: ../../../winix/winixd/core/request.h ../../../winix/winixd/core/error.h
|
||||
db.o: ../../../winix/winixd/core/config.h
|
||||
db.o: ../../../winix/winixd/core/htmlfilter.h
|
||||
db.o: ../../../winix/winixd/templates/htmltextstream.h
|
||||
db.o: ../../../pikotools/space/spacetojson.h ../../../ezc/src/outstreams.h
|
||||
db.o: ../../../winix/winixd/core/session.h ../../../winix/winixd/core/user.h
|
||||
db.o: ../../../winix/winixd/core/plugindata.h
|
||||
db.o: ../../../winix/winixd/core/rebus.h ../../../winix/winixd/core/ipban.h
|
||||
db.o: ../../../winix/winixd/core/mount.h
|
||||
db.o: ../../../winix/winixd/templates/locale.h
|
||||
db.o: ../../../winix/winixd/core/log.h ../../../winix/winixd/core/misc.h
|
||||
db.o: ../../../winix/winixd/core/filelog.h
|
||||
db.o: ../../../winix/winixd/core/synchro.h ../../../winix/winixd/core/log.h
|
||||
db.o: ../../../winix/winixd/core/filelog.h ../../../winix/winixd/core/lock.h
|
||||
db.o: ../../../winix/winixd/core/synchro.h ../../../winix/winixd/core/error.h
|
||||
db.o: dbitemquery.h ../../../winix/winixd/core/item.h dbitemcolumns.h
|
||||
db.o: ../../../winix/winixd/core/user.h ../../../winix/winixd/core/group.h
|
||||
db.o: ../../../winix/winixd/core/dircontainer.h
|
||||
db.o: ../../../winix/winixd/core/winixbase.h
|
||||
db.o: ../../../winix/winixd/core/ugcontainer.h
|
||||
db.o: ../../../winix/winixd/core/misc.h
|
||||
dbbase.o: dbbase.h dbconn.h dbtextstream.h
|
||||
dbbase.o: ../../../winix/winixd/core/textstream.h
|
||||
dbbase.o: ../../../winix/winixd/core/misc.h ../../../winix/winixd/core/item.h
|
||||
@@ -48,9 +44,21 @@ dbbase.o: ../../../pikotools/membuffer/membuffer.h
|
||||
dbbase.o: ../../../pikotools/textstream/types.h
|
||||
dbbase.o: ../../../pikotools/utf8/utf8.h
|
||||
dbbase.o: ../../../winix/winixd/core/winix_const.h
|
||||
dbbase.o: ../../../winix/winixd/core/error.h
|
||||
dbbase.o: ../../../winix/winixd/core/winixbase.h
|
||||
dbbase.o: ../../../winix/winixd/core/config.h
|
||||
dbbase.o: ../../../pikotools/space/spaceparser.h
|
||||
dbbase.o: ../../../pikotools/space/space.h ../../../winix/winixd/core/log.h
|
||||
dbbase.o: ../../../pikotools/space/space.h
|
||||
dbbase.o: ../../../winix/winixd/core/htmlfilter.h
|
||||
dbbase.o: ../../../winix/winixd/core/log.h
|
||||
dbbase.o: ../../../winix/winixd/core/textstream.h
|
||||
dbbase.o: ../../../winix/winixd/core/logmanipulators.h
|
||||
dbbase.o: ../../../winix/winixd/core/filelog.h
|
||||
dbbase.o: ../../../winix/winixd/core/synchro.h
|
||||
dbbase.o: ../../../winix/winixd/core/log.h
|
||||
dbbase.o: ../../../winix/winixd/core/filelog.h
|
||||
dbbase.o: ../../../winix/winixd/core/lock.h
|
||||
dbbase.o: ../../../winix/winixd/core/synchro.h
|
||||
dbbase.o: ../../../winix/winixd/core/error.h
|
||||
dbbase.o: ../../../winix/winixd/core/misc.h
|
||||
dbconn.o: dbconn.h dbtextstream.h ../../../winix/winixd/core/textstream.h
|
||||
dbconn.o: ../../../winix/winixd/core/misc.h ../../../winix/winixd/core/item.h
|
||||
@@ -66,7 +74,21 @@ dbconn.o: ../../../pikotools/membuffer/membuffer.h
|
||||
dbconn.o: ../../../pikotools/textstream/types.h
|
||||
dbconn.o: ../../../pikotools/utf8/utf8.h
|
||||
dbconn.o: ../../../winix/winixd/core/winix_const.h
|
||||
dbconn.o: ../../../winix/winixd/core/log.h ../../../winix/winixd/core/error.h
|
||||
dbconn.o: ../../../winix/winixd/core/winixbase.h
|
||||
dbconn.o: ../../../winix/winixd/core/config.h
|
||||
dbconn.o: ../../../pikotools/space/spaceparser.h
|
||||
dbconn.o: ../../../pikotools/space/space.h
|
||||
dbconn.o: ../../../winix/winixd/core/htmlfilter.h
|
||||
dbconn.o: ../../../winix/winixd/core/log.h
|
||||
dbconn.o: ../../../winix/winixd/core/textstream.h
|
||||
dbconn.o: ../../../winix/winixd/core/logmanipulators.h
|
||||
dbconn.o: ../../../winix/winixd/core/filelog.h
|
||||
dbconn.o: ../../../winix/winixd/core/synchro.h
|
||||
dbconn.o: ../../../winix/winixd/core/log.h
|
||||
dbconn.o: ../../../winix/winixd/core/filelog.h
|
||||
dbconn.o: ../../../winix/winixd/core/lock.h
|
||||
dbconn.o: ../../../winix/winixd/core/synchro.h
|
||||
dbconn.o: ../../../winix/winixd/core/error.h
|
||||
dbitemcolumns.o: dbitemcolumns.h ../../../winix/winixd/core/item.h dbbase.h
|
||||
dbitemcolumns.o: dbconn.h dbtextstream.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/textstream.h
|
||||
@@ -85,10 +107,21 @@ dbitemcolumns.o: ../../../pikotools/membuffer/membuffer.h
|
||||
dbitemcolumns.o: ../../../pikotools/textstream/types.h
|
||||
dbitemcolumns.o: ../../../pikotools/utf8/utf8.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/winix_const.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/error.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/winixbase.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/config.h
|
||||
dbitemcolumns.o: ../../../pikotools/space/spaceparser.h
|
||||
dbitemcolumns.o: ../../../pikotools/space/space.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/htmlfilter.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/log.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/textstream.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/logmanipulators.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/filelog.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/synchro.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/log.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/filelog.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/lock.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/synchro.h
|
||||
dbitemcolumns.o: ../../../winix/winixd/core/error.h
|
||||
dbitemquery.o: dbitemquery.h ../../../winix/winixd/core/item.h
|
||||
dbtextstream.o: dbtextstream.h ../../../winix/winixd/core/textstream.h
|
||||
dbtextstream.o: ../../../winix/winixd/core/misc.h
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2014, Tomasz Sowa
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
#include "core/error.h"
|
||||
#include "space/spaceparser.h"
|
||||
#include "date/date.h"
|
||||
#include "core/winixbase.h"
|
||||
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -50,7 +52,7 @@ namespace Winix
|
||||
|
||||
|
||||
|
||||
class DbBase
|
||||
class DbBase : public WinixBase
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -67,21 +69,19 @@ public:
|
||||
PGresult * AssertQuery(const char * q, ExecStatusType t);
|
||||
PGresult * AssertQuery(const DbTextStream & query, ExecStatusType t);
|
||||
void AssertResult(PGresult * r, ExecStatusType t);
|
||||
static int AssertColumn(PGresult * r, const char * column_name);
|
||||
int AssertColumn(PGresult * r, const char * column_name);
|
||||
|
||||
const char * AssertValue(PGresult * r, int row, int col);
|
||||
const std::wstring & AssertValueWide(PGresult * r, int row, int col); // warning: this method uses a static buffer
|
||||
void AssertValueWide(PGresult * r, int row, int col, std::wstring & result);
|
||||
void AssertValueBin(PGresult * r, int row, int col, std::string & result);
|
||||
long AssertValueLong(PGresult * r, int row, int col);
|
||||
int AssertValueInt(PGresult * r, int row, int col);
|
||||
bool AssertValueBool(PGresult * r, int row, int col);
|
||||
unsigned long AssertValueULong(PGresult * r, int row, int col);
|
||||
unsigned int AssertValueUInt(PGresult * r, int row, int col);
|
||||
PT::Date AssertValueDate(PGresult * r, int row, int col);
|
||||
|
||||
// static assignments
|
||||
static const char * AssertValue(PGresult * r, int row, int col);
|
||||
static const std::wstring & AssertValueWide(PGresult * r, int row, int col); // warning: this method uses a static buffer
|
||||
static void AssertValueWide(PGresult * r, int row, int col, std::wstring & result);
|
||||
static void AssertValueBin(PGresult * r, int row, int col, std::string & result);
|
||||
static long AssertValueLong(PGresult * r, int row, int col);
|
||||
static int AssertValueInt(PGresult * r, int row, int col);
|
||||
static bool AssertValueBool(PGresult * r, int row, int col);
|
||||
static unsigned long AssertValueULong(PGresult * r, int row, int col);
|
||||
static unsigned int AssertValueUInt(PGresult * r, int row, int col);
|
||||
static PT::Date AssertValueDate(PGresult * r, int row, int col);
|
||||
|
||||
// non static assignments
|
||||
bool AssertValueSpace(PGresult * r, int row, int col, PT::Space & space);
|
||||
|
||||
void ClearResult(PGresult * r);
|
||||
@@ -104,7 +104,7 @@ public:
|
||||
// new API (returns only bool)
|
||||
bool EndTrans(bool everything_ok);
|
||||
|
||||
static void UnescapeBin(const char * str, size_t len, std::string & out, bool clear_out = true);
|
||||
void UnescapeBin(const char * str, size_t len, std::string & out, bool clear_out = true);
|
||||
|
||||
|
||||
protected:
|
||||
@@ -126,7 +126,7 @@ private:
|
||||
// static bool IsCorrectOctalDigit(char c);
|
||||
// static int UnescapeBin(const char * str, size_t & i, size_t len);
|
||||
|
||||
static char UnescapeBinHexToDigit(char hex);
|
||||
char UnescapeBinHexToDigit(char hex);
|
||||
|
||||
DbTextStream bquery;
|
||||
PT::SpaceParser conf_parser;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2014, Tomasz Sowa
|
||||
* Copyright (c) 2010-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <string>
|
||||
#include <libpq-fe.h>
|
||||
#include "dbtextstream.h"
|
||||
#include "core/winixbase.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -45,7 +46,7 @@ namespace Winix
|
||||
|
||||
|
||||
|
||||
class DbConn
|
||||
class DbConn : public WinixBase
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2014, Tomasz Sowa
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -80,36 +80,36 @@ void DbItemColumns::SetColumns(PGresult * r)
|
||||
|
||||
void DbItemColumns::SetItem(PGresult * r, long row, Item & item)
|
||||
{
|
||||
if( id != -1 ) item.id = DbBase::AssertValueLong(r, row, id);
|
||||
if( user_id != -1 ) item.user_id = DbBase::AssertValueLong(r, row, user_id);
|
||||
if( group_id != -1 ) item.group_id = DbBase::AssertValueLong(r, row, group_id);
|
||||
if( privileges != -1 ) item.privileges = DbBase::AssertValueInt(r, row, privileges);
|
||||
if( date_creation != -1 ) item.date_creation = DbBase::AssertValueDate(r, row, date_creation);
|
||||
if( date_modification != -1 ) item.date_modification = DbBase::AssertValueDate(r, row, date_modification);
|
||||
if( type != -1 ) item.type = static_cast<Item::Type>( DbBase::AssertValueInt(r, row, type) );
|
||||
if( parent_id != -1 ) item.parent_id = DbBase::AssertValueLong(r, row, parent_id);
|
||||
if( content_id != -1 ) item.content_id = DbBase::AssertValueLong(r, row, content_id);
|
||||
if( link_redirect != -1 ) item.link_redirect = DbBase::AssertValueInt(r, row, link_redirect);
|
||||
if( content_type != -1 ) item.content_type = static_cast<Item::ContentType>( DbBase::AssertValueInt(r, row, content_type) );
|
||||
if( modification_user_id != -1 ) item.modification_user_id = DbBase::AssertValueLong(r, row, modification_user_id);
|
||||
if( file_fs != -1 ) item.file_fs = DbBase::AssertValueInt(r, row, file_fs);
|
||||
if( file_type != -1 ) item.file_type = DbBase::AssertValueInt(r, row, file_type);
|
||||
if( has_thumb != -1 ) item.has_thumb = DbBase::AssertValueBool(r, row, has_thumb);
|
||||
if( hash != -1 ) DbBase::AssertValueWide(r, row, hash, item.hash);
|
||||
if( hash_type != -1 ) item.hash_type = DbBase::AssertValueInt(r, row, hash_type);
|
||||
if( file_size != -1 ) item.file_size = DbBase::AssertValueLong(r, row, file_size);
|
||||
if( id != -1 ) item.id = db_base.AssertValueLong(r, row, id);
|
||||
if( user_id != -1 ) item.user_id = db_base.AssertValueLong(r, row, user_id);
|
||||
if( group_id != -1 ) item.group_id = db_base.AssertValueLong(r, row, group_id);
|
||||
if( privileges != -1 ) item.privileges = db_base.AssertValueInt(r, row, privileges);
|
||||
if( date_creation != -1 ) item.date_creation = db_base.AssertValueDate(r, row, date_creation);
|
||||
if( date_modification != -1 ) item.date_modification = db_base.AssertValueDate(r, row, date_modification);
|
||||
if( type != -1 ) item.type = static_cast<Item::Type>( db_base.AssertValueInt(r, row, type) );
|
||||
if( parent_id != -1 ) item.parent_id = db_base.AssertValueLong(r, row, parent_id);
|
||||
if( content_id != -1 ) item.content_id = db_base.AssertValueLong(r, row, content_id);
|
||||
if( link_redirect != -1 ) item.link_redirect = db_base.AssertValueInt(r, row, link_redirect);
|
||||
if( content_type != -1 ) item.content_type = static_cast<Item::ContentType>( db_base.AssertValueInt(r, row, content_type) );
|
||||
if( modification_user_id != -1 ) item.modification_user_id = db_base.AssertValueLong(r, row, modification_user_id);
|
||||
if( file_fs != -1 ) item.file_fs = db_base.AssertValueInt(r, row, file_fs);
|
||||
if( file_type != -1 ) item.file_type = db_base.AssertValueInt(r, row, file_type);
|
||||
if( has_thumb != -1 ) item.has_thumb = db_base.AssertValueBool(r, row, has_thumb);
|
||||
if( hash != -1 ) db_base.AssertValueWide(r, row, hash, item.hash);
|
||||
if( hash_type != -1 ) item.hash_type = db_base.AssertValueInt(r, row, hash_type);
|
||||
if( file_size != -1 ) item.file_size = db_base.AssertValueLong(r, row, file_size);
|
||||
|
||||
if( ref != -1 ) item.ref = DbBase::AssertValueInt(r, row, ref);
|
||||
if( modify_index != -1 ) item.modify_index = DbBase::AssertValueInt(r, row, modify_index);
|
||||
if( ref != -1 ) item.ref = db_base.AssertValueInt(r, row, ref);
|
||||
if( modify_index != -1 ) item.modify_index = db_base.AssertValueInt(r, row, modify_index);
|
||||
|
||||
if( url != -1 ) DbBase::AssertValueWide(r, row, url, item.url);
|
||||
if( content != -1 ) DbBase::AssertValueWide(r, row, content, item.content);
|
||||
if( subject != -1 ) DbBase::AssertValueWide(r, row, subject, item.subject);
|
||||
if( file_path != -1 ) DbBase::AssertValueWide(r, row, file_path, item.file_path);
|
||||
if( link_to != -1 ) DbBase::AssertValueWide(r, row, link_to, item.link_to);
|
||||
if( guest_name != -1 ) DbBase::AssertValueWide(r, row, guest_name, item.guest_name);
|
||||
if( html_template != -1 ) DbBase::AssertValueWide(r, row, html_template, item.html_template);
|
||||
if( sort_index != -1 ) item.sort_index = DbBase::AssertValueInt(r, row, sort_index);
|
||||
if( url != -1 ) db_base.AssertValueWide(r, row, url, item.url);
|
||||
if( content != -1 ) db_base.AssertValueWide(r, row, content, item.content);
|
||||
if( subject != -1 ) db_base.AssertValueWide(r, row, subject, item.subject);
|
||||
if( file_path != -1 ) db_base.AssertValueWide(r, row, file_path, item.file_path);
|
||||
if( link_to != -1 ) db_base.AssertValueWide(r, row, link_to, item.link_to);
|
||||
if( guest_name != -1 ) db_base.AssertValueWide(r, row, guest_name, item.guest_name);
|
||||
if( html_template != -1 ) db_base.AssertValueWide(r, row, html_template, item.html_template);
|
||||
if( sort_index != -1 ) item.sort_index = db_base.AssertValueInt(r, row, sort_index);
|
||||
|
||||
if( meta != -1 ) db_base.AssertValueSpace(r, row, meta, item.meta);
|
||||
if( ameta != -1 ) db_base.AssertValueSpace(r, row, ameta, item.ameta);
|
||||
|
||||
Reference in New Issue
Block a user