fixed: get_value_by_field_name() is able to correctly take values when

we do not use auto generated 'select' and when we are using prefixes for columns



git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1209 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2019-09-17 17:55:39 +00:00
parent 057d879b4c
commit afce2234c3
12 changed files with 200 additions and 63 deletions

View File

@@ -15,10 +15,9 @@ main.o: ../../morm/src/dbexpression.h ../../morm/src/baseexpression.h
main.o: ../../morm/src/modelenv.h ../../morm/src/modeldata.h
main.o: ../../morm/src/cursorhelper.h ../../morm/src/finderhelper.h
main.o: ../../morm/src/fieldvaluehelper.h ../../morm/src/flatexpression.h
main.o: ../../morm/src/finder.h ../../pikotools/utf8/utf8.h
main.o: ../../morm/src/cursor.h ../../morm/src/jsonexpression.h
main.o: ../../morm/src/postgresqlexpression.h
main.o: ../../morm/src/postgresqlqueryresult.h ../../morm/src/finder.h
main.o: ../../pikotools/utf8/utf8.h ../../morm/src/cursor.h
main.o: ../../morm/src/jsonexpression.h ../../morm/src/postgresqlexpression.h
main.o: ../../morm/src/dochtmlexpression.h ../../morm/src/jsonconnector.h
main.o: ../../morm/src/postgresqlconnector.h
main.o: ../../morm/src/postgresqlqueryresult.h
main.o: ../../morm/src/dochtmlconnector.h person.h language.h attachment.h

View File

@@ -65,7 +65,17 @@ void make()
morm::Finder<Person> finder(model_connector);
Person p = finder.select().where().eq(L"id", 110).get();
//Person p = finder.use_table_prefix(false).select().where().eq(L"id", 110).get();
Person p = finder.prepare_to_select().use_table_prefix(true).raw("select person.id as \"person.id\", person.first_name as \"person.first_name\", person.last_name as \"person.last_name\", person.email as \"person.email\", "
"language.id as \"language.id\", language.english_name as \"language.english_name\", language.local_name as \"language.local_name\", language.code_str as \"language.code_str\", language.code_int as \"language.code_int\", "
"attachment.id as \"attachment.id\", attachment.person_id as \"attachment.person_id\", attachment.name as \"attachment.name\", attachment.content as \"attachment.content\", attachment.some_flags as \"attachment.some_flags\", attachment.created_date as \"attachment.created_date\","
"language2.id as \"language2.id\", language2.english_name as \"language2.english_name\", language2.local_name as \"language2.local_name\", language2.code_str as \"language2.code_str\", language2.code_int as \"language2.code_int\""
"FROM public.person AS person "
"LEFT JOIN public.language AS language ON person.language_id = language.id "
"LEFT JOIN public.attachment AS attachment ON person.id = attachment.person_id "
"LEFT JOIN public.language AS language2 ON attachment.language_id = language.id "
"where person.id=110").get();
std::string str;
p.to_text(str, true, true);