mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Sql: Table structures S_ now have ToString to have DUMP/LOG support
git-svn-id: svn://ultimatepp.org/upp/trunk@3005 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
db72816eac
commit
d17f6b7a5c
4 changed files with 20 additions and 2 deletions
|
|
@ -54,7 +54,8 @@ void td_array(SqlSet& set, const String& prefix, const char *x, int cnt);
|
|||
void td_var(SqlSet& set, const String& prefix, const char *x, SqlSet (*f)(const String&));
|
||||
void td_shrink(String *array, int cnt);
|
||||
|
||||
bool EqualFields(Fields a, Fields b);
|
||||
bool EqualFields(Fields a, Fields b);
|
||||
String AsString(Fields a);
|
||||
|
||||
// ----------
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ public:\
|
|||
operator Fields() { return callback(this, &S_##Table::FieldLayout); } \
|
||||
bool operator==(const S_##Table& x) const { return EqualFields(const_cast<S_##Table&>(*this), const_cast<S_##Table&>(x)); } \
|
||||
bool operator!=(const S_##Table& x) const { return !EqualFields(const_cast<S_##Table&>(*this), const_cast<S_##Table&>(x)); } \
|
||||
String ToString() const { return AsString((Fields)const_cast<S_##Table&>(*this)); } \
|
||||
S_##Table();
|
||||
|
||||
#define TYPE(Table) CODETYPE(Table, __NIL)
|
||||
|
|
|
|||
|
|
@ -40,4 +40,20 @@ bool EqualFields(Fields a, Fields b)
|
|||
return fa.table == fb.table && fa.va == fb.va;
|
||||
}
|
||||
|
||||
struct NfAsString : FieldOperator {
|
||||
String text;
|
||||
|
||||
virtual void Field(const char *name, Ref f) {
|
||||
text << "\n\t" << name << '=' << (Value)f;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
String AsString(Fields a)
|
||||
{
|
||||
NfAsString x;
|
||||
a(x);
|
||||
return x.text;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _Web_icpp_init_stub
|
||||
#define _Web_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#define BLITZ_INDEX__ F6F37DAE5668E45571942689ACEE874C1
|
||||
#define BLITZ_INDEX__ FD64686542F64128888522171727B4F79
|
||||
#include "Web_init.icpp"
|
||||
#undef BLITZ_INDEX__
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue