changed the way how the table name is set in a Model - added prepare_table() method
removed from Model: virtual void table_name(PT::TextStream & stream); added to Model: virtual void prepare_table(); virtual void table(const wchar_t * table_name); virtual void table(const wchar_t * schema_name, const wchar_t * table_name);
This commit is contained in:
@@ -27,11 +27,12 @@ current_path := $(shell pwd)
|
||||
global_relative_working_dir := $(shell relative_path $(current_path) $(GLOBAL_WORKING_DIR))
|
||||
|
||||
|
||||
|
||||
# IMPROVE ME
|
||||
# add dependency to pikotools
|
||||
all: morm $(name)
|
||||
|
||||
|
||||
$(name): $(o)
|
||||
$(name): morm $(o)
|
||||
$(CXX) -o $(name) $(CXXFLAGS) $(LDFLAGS) $(o) $(GLOBAL_WORKING_DIR)/morm/src/morm.a $(GLOBAL_WORKING_DIR)/pikotools/log/log.a $(GLOBAL_WORKING_DIR)/pikotools/space/space.a $(GLOBAL_WORKING_DIR)/pikotools/mainspaceparser/mainspaceparser.a $(GLOBAL_WORKING_DIR)/pikotools/date/date.a $(GLOBAL_WORKING_DIR)/pikotools/convert/convert.a $(GLOBAL_WORKING_DIR)/pikotools/utf8/utf8.a $(LDFLAGS) -lpq -lpthread
|
||||
|
||||
|
||||
|
@@ -87,10 +87,9 @@ public:
|
||||
field(L"language_id", L"language", language, FT::foreign_key);
|
||||
}
|
||||
|
||||
void table_name(PT::TextStream & stream)
|
||||
void prepare_table()
|
||||
{
|
||||
// schema.table_name or just table_name
|
||||
stream << "public.attachment";
|
||||
table(L"public", L"attachment");
|
||||
}
|
||||
|
||||
void after_select()
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
void map_fields()
|
||||
{
|
||||
field(L"id", id, FT::no_insertable | FT::no_updatable | FT::primary_key);
|
||||
//field(L"person_id", person_id);
|
||||
field(L"person_id", person_id);
|
||||
field(L"name", name);
|
||||
field(L"content", content);
|
||||
field(L"attachment_id", L"types", types, FT::foreign_key_in_child);
|
||||
@@ -87,10 +87,9 @@ public:
|
||||
field(L"language_id", L"language", language, FT::foreign_key);
|
||||
}
|
||||
|
||||
void table_name(PT::TextStream & stream)
|
||||
void prepare_table()
|
||||
{
|
||||
// schema.table_name or just table_name
|
||||
stream << "public.attachment2";
|
||||
table(L"public", L"attachment2");
|
||||
}
|
||||
|
||||
void after_select()
|
||||
|
@@ -77,11 +77,9 @@ public:
|
||||
field(L"code_int", code_int);
|
||||
}
|
||||
|
||||
|
||||
void table_name(PT::TextStream & stream)
|
||||
void prepare_table()
|
||||
{
|
||||
// schema.table_name or just table_name
|
||||
stream << "public.language";
|
||||
table(L"public", L"language");
|
||||
}
|
||||
|
||||
void after_insert()
|
||||
|
@@ -87,10 +87,9 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void table_name(PT::TextStream & stream)
|
||||
void prepare_table()
|
||||
{
|
||||
// schema.table_name or just table_name
|
||||
stream << "public.person";
|
||||
table(L"public", L"person");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -32,6 +32,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_morm_samples_sample01
|
||||
#define headerfile_morm_samples_sample01
|
||||
|
||||
#include <ctime>
|
||||
#include "basesample.h"
|
||||
#include "person.h"
|
||||
@@ -62,7 +65,7 @@ void make()
|
||||
person.set_connector(model_connector);
|
||||
load_defaults(person);
|
||||
|
||||
//std::wstring sss = L"cosik wstawiony dynamicznie";
|
||||
//std::wstring sss = L"some text put dynamically";
|
||||
//person.set_field_value_generic(L"email", L"email", sss);
|
||||
|
||||
|
||||
@@ -75,7 +78,7 @@ void make()
|
||||
|
||||
|
||||
morm::Finder<Person> finder(model_connector);
|
||||
Person p = finder.select().where().eq(L"id", 207).get();
|
||||
Person p = finder.select().where().eq(L"id", 210).get();
|
||||
p.to_text(str, true, true);
|
||||
|
||||
|
||||
@@ -223,3 +226,5 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -70,11 +70,9 @@ public:
|
||||
field(L"name", name);
|
||||
}
|
||||
|
||||
|
||||
void table_name(PT::TextStream & stream)
|
||||
void prepare_table()
|
||||
{
|
||||
// schema.table_name or just table_name
|
||||
stream << "public.types";
|
||||
table(L"public", L"types");
|
||||
}
|
||||
|
||||
void after_insert()
|
||||
|
Reference in New Issue
Block a user