Home » U++ Library support » U++ SQL » Jsonize() in database table structures (S_*) [patch]
Jsonize() in database table structures (S_*) [patch] [message #57138] |
Mon, 31 May 2021 04:36 |
zsolt
Messages: 700 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
It was missing for me.
uppsrc/Sql/S_info.cpp:
@@ -94,6 +94,15 @@ SqlSet S_info::GetOf(const SqlId& table) const
return set;
}
+void S_info::Jsonize(const void *s, JsonIO& io) const
+{
+ for(int i = 0; i < column.GetCount(); i++)
+ if(io.IsLoading())
+ Set(s, i, io.Get(~column.GetKey(i)));
+ else
+ io.Set(~column.GetKey(i), Get(s, i));
+}
+
void S_info::Init()
{
column.Shrink();
uppsrc/Sql/SqlSchema.h:
@@ -173,6 +173,8 @@ struct S_info {
SqlSet GetSet(const String& prefix) const;
SqlSet GetOf(const SqlId& table) const;
+
+ void Jsonize(const void *s, JsonIO& io) const;
void Init();
};
uppsrc/Sql/sch_header.h:
@@ -39,7 +39,7 @@ public: \
void Set(const Upp::ValueMap& m) { return info->Set(this, m); } \
\
operator const S_info&() const { return *info; } \
+ void Jsonize(JsonIO& io) { info->Jsonize(this, io); } \
\
S_##Table(); \
S_##Table(const Upp::ValueMap& m);
|
|
|
Goto Forum:
Current Time: Thu Mar 20 19:51:11 CET 2025
Total time taken to generate the page: 0.04252 seconds
|