diff --git a/samples/Makefile.dep b/samples/Makefile.dep index 3211123..415c75e 100644 --- a/samples/Makefile.dep +++ b/samples/Makefile.dep @@ -2,7 +2,6 @@ ./main.o: ../../pikotools/src/mainoptions/mainoptionsparser.h ./main.o: ../../pikotools/src/space/space.h -./main.o: ../../pikotools/src/textstream/types.h ./main.o: ../../pikotools/src/convert/inttostr.h ./main.o: ../../pikotools/src/utf8/utf8.h ./main.o: ../../pikotools/src/textstream/stream.h @@ -13,18 +12,20 @@ ./main.o: ../../pikotools/src/textstream/stream.h ./main.o: ../../pikotools/src/date/date.h ./main.o: ../../pikotools/src/membuffer/membuffer.h -./main.o: ../../pikotools/src/textstream/types.h ../src/modelconnector.h -./main.o: ../src/clearer.h ../src/ft.h ../src/dbconnector.h -./main.o: ../../pikotools/src/log/log.h ../../pikotools/src/log/filelog.h -./main.o: ../src/queryresult.h ../src/flatconnector.h ../src/export.h -./main.o: ../src/dbexpression.h ../src/baseexpression.h ../src/modelenv.h -./main.o: ../src/modeldata.h ../src/cursorhelper.h ../src/finderhelper.h +./main.o: ../../pikotools/src/textstream/types.h +./main.o: ../../pikotools/src/textstream/stream_private.h +./main.o: ../src/modelconnector.h ../src/clearer.h ../src/ft.h +./main.o: ../src/dbconnector.h ../../pikotools/src/log/log.h +./main.o: ../../pikotools/src/log/filelog.h ../src/queryresult.h +./main.o: ../src/flatconnector.h ../src/export.h ../src/dbexpression.h +./main.o: ../src/baseexpression.h ../src/modelenv.h ../src/modeldata.h +./main.o: ../src/cursorhelper.h ../src/finderhelper.h ./main.o: ../src/fieldvaluehelper.h ../src/wrapper.h ../src/spacewrapper.h ./main.o: ../src/baseobjectwrapper.h ../src/modelcontainerwrapper.h -./main.o: ../src/select.h ../../pikotools/src/convert/text.h -./main.o: ../src/flatexpression.h ../src/finder.h ../src/cursor.h -./main.o: ../src/jsonexpression.h ../src/postgresqlexpression.h -./main.o: ../src/xmlexpression.h ../src/jsonconnector.h -./main.o: ../src/postgresqlconnector.h ../src/postgresqlqueryresult.h -./main.o: ../src/xmlconnector.h ../src/transaction.h person.h language.h -./main.o: attachment.h type.h attachment2.h +./main.o: ../src/select.h ../src/flatexpression.h ../src/finder.h +./main.o: ../src/cursor.h ../src/jsonexpression.h +./main.o: ../src/postgresqlexpression.h ../src/xmlexpression.h +./main.o: ../src/jsonconnector.h ../src/postgresqlconnector.h +./main.o: ../src/postgresqlqueryresult.h ../src/xmlconnector.h +./main.o: ../src/transaction.h person.h language.h attachment.h type.h +./main.o: attachment2.h diff --git a/src/Makefile.dep b/src/Makefile.dep index 372e085..a03eb57 100644 --- a/src/Makefile.dep +++ b/src/Makefile.dep @@ -1,30 +1,27 @@ # DO NOT DELETE -./baseexpression.o: baseexpression.h +./baseexpression.o: baseexpression.h ../../pikotools/src/textstream/stream.h +./baseexpression.o: ../../pikotools/src/date/date.h +./baseexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./baseexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./baseexpression.o: ../../pikotools/src/log/log.h ./baseexpression.o: ../../pikotools/src/textstream/textstream.h ./baseexpression.o: ../../pikotools/src/textstream/stream.h ./baseexpression.o: ../../pikotools/src/space/space.h -./baseexpression.o: ../../pikotools/src/textstream/types.h -./baseexpression.o: ../../pikotools/src/convert/inttostr.h ./baseexpression.o: ../../pikotools/src/utf8/utf8.h -./baseexpression.o: ../../pikotools/src/textstream/stream.h ./baseexpression.o: ../../pikotools/src/utf8/utf8_templates.h ./baseexpression.o: ../../pikotools/src/utf8/utf8_private.h -./baseexpression.o: ../../pikotools/src/date/date.h ./baseexpression.o: ../../pikotools/src/membuffer/membuffer.h -./baseexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./baseexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./baseexpression.o: ../../pikotools/src/log/log.h +./baseexpression.o: ../../pikotools/src/textstream/types.h +./baseexpression.o: ../../pikotools/src/textstream/stream_private.h ./baseexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h ./baseexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./baseexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./baseexpression.o: export.h ../../pikotools/src/convert/text.h model.h -./baseexpression.o: modelconnector.h clearer.h dbconnector.h flatconnector.h -./baseexpression.o: dbexpression.h flatexpression.h +./baseexpression.o: model.h modelconnector.h clearer.h dbconnector.h +./baseexpression.o: flatconnector.h export.h dbexpression.h flatexpression.h ./clearer.o: clearer.h ../../pikotools/src/date/date.h ./clearer.o: ../../pikotools/src/convert/inttostr.h ./clearer.o: ../../pikotools/src/space/space.h -./clearer.o: ../../pikotools/src/textstream/types.h ./clearer.o: ../../pikotools/src/utf8/utf8.h ./clearer.o: ../../pikotools/src/textstream/stream.h ./clearer.o: ../../pikotools/src/utf8/utf8_templates.h @@ -32,17 +29,16 @@ ./clearer.o: ../../pikotools/src/textstream/textstream.h ./clearer.o: ../../pikotools/src/textstream/stream.h ./clearer.o: ../../pikotools/src/membuffer/membuffer.h -./clearer.o: ../../pikotools/src/textstream/types.h modelconnector.h +./clearer.o: ../../pikotools/src/textstream/types.h +./clearer.o: ../../pikotools/src/textstream/stream_private.h modelconnector.h ./clearer.o: dbconnector.h ../../pikotools/src/log/log.h ./clearer.o: ../../pikotools/src/log/filelog.h queryresult.h flatconnector.h ./clearer.o: export.h dbexpression.h baseexpression.h morm_types.h modelenv.h ./clearer.o: modeldata.h cursorhelper.h finderhelper.h fieldvaluehelper.h ./clearer.o: wrapper.h spacewrapper.h baseobjectwrapper.h -./clearer.o: modelcontainerwrapper.h select.h -./clearer.o: ../../pikotools/src/convert/text.h flatexpression.h +./clearer.o: modelcontainerwrapper.h select.h flatexpression.h ./dbconnector.o: ../../pikotools/src/space/spaceparser.h ./dbconnector.o: ../../pikotools/src/space/space.h -./dbconnector.o: ../../pikotools/src/textstream/types.h ./dbconnector.o: ../../pikotools/src/convert/inttostr.h ./dbconnector.o: ../../pikotools/src/utf8/utf8.h ./dbconnector.o: ../../pikotools/src/textstream/stream.h @@ -54,128 +50,124 @@ ./dbconnector.o: ../../pikotools/src/space/space.h ./dbconnector.o: ../../pikotools/src/date/date.h ./dbconnector.o: ../../pikotools/src/membuffer/membuffer.h -./dbconnector.o: ../../pikotools/src/textstream/types.h dbconnector.h -./dbconnector.o: ../../pikotools/src/log/log.h +./dbconnector.o: ../../pikotools/src/textstream/types.h +./dbconnector.o: ../../pikotools/src/textstream/stream_private.h +./dbconnector.o: dbconnector.h ../../pikotools/src/log/log.h ./dbconnector.o: ../../pikotools/src/log/filelog.h queryresult.h ft.h ./dbconnector.o: dbexpression.h baseexpression.h morm_types.h modelenv.h ./dbconnector.o: modeldata.h cursorhelper.h finderhelper.h fieldvaluehelper.h ./dbconnector.o: wrapper.h spacewrapper.h baseobjectwrapper.h -./dbconnector.o: modelcontainerwrapper.h select.h export.h -./dbconnector.o: ../../pikotools/src/convert/text.h model.h modelconnector.h -./dbconnector.o: clearer.h flatconnector.h flatexpression.h +./dbconnector.o: modelcontainerwrapper.h select.h model.h modelconnector.h +./dbconnector.o: clearer.h flatconnector.h export.h flatexpression.h ./dbconnector.o: ../../pikotools/src/convert/convert.h ./dbconnector.o: ../../pikotools/src/convert/inttostr.h ./dbconnector.o: ../../pikotools/src/convert/patternreplacer.h ./dbconnector.o: ../../pikotools/src/convert/strtoint.h ./dbconnector.o: ../../pikotools/src/convert/text.h ./dbconnector.o: ../../pikotools/src/convert/misc.h +./dbconnector.o: ../../pikotools/src/textstream/types.h ./dbconnector.o: ../../pikotools/src/convert/double.h ./dbexpression.o: dbexpression.h baseexpression.h +./dbexpression.o: ../../pikotools/src/textstream/stream.h +./dbexpression.o: ../../pikotools/src/date/date.h +./dbexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./dbexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./dbexpression.o: ../../pikotools/src/log/log.h ./dbexpression.o: ../../pikotools/src/textstream/textstream.h ./dbexpression.o: ../../pikotools/src/textstream/stream.h ./dbexpression.o: ../../pikotools/src/space/space.h -./dbexpression.o: ../../pikotools/src/textstream/types.h -./dbexpression.o: ../../pikotools/src/convert/inttostr.h ./dbexpression.o: ../../pikotools/src/utf8/utf8.h -./dbexpression.o: ../../pikotools/src/textstream/stream.h ./dbexpression.o: ../../pikotools/src/utf8/utf8_templates.h ./dbexpression.o: ../../pikotools/src/utf8/utf8_private.h -./dbexpression.o: ../../pikotools/src/date/date.h ./dbexpression.o: ../../pikotools/src/membuffer/membuffer.h -./dbexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./dbexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./dbexpression.o: ../../pikotools/src/log/log.h +./dbexpression.o: ../../pikotools/src/textstream/types.h +./dbexpression.o: ../../pikotools/src/textstream/stream_private.h ./dbexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h ./dbexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./dbexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./dbexpression.o: export.h ../../pikotools/src/convert/text.h model.h -./dbexpression.o: modelconnector.h clearer.h dbconnector.h flatconnector.h -./dbexpression.o: flatexpression.h -./flatconnector.o: flatconnector.h +./dbexpression.o: model.h modelconnector.h clearer.h dbconnector.h +./dbexpression.o: flatconnector.h export.h flatexpression.h +./flatconnector.o: flatconnector.h ../../pikotools/src/textstream/stream.h +./flatconnector.o: export.h flatexpression.h baseexpression.h +./flatconnector.o: ../../pikotools/src/date/date.h +./flatconnector.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./flatconnector.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./flatconnector.o: ../../pikotools/src/log/log.h ./flatconnector.o: ../../pikotools/src/textstream/textstream.h ./flatconnector.o: ../../pikotools/src/textstream/stream.h ./flatconnector.o: ../../pikotools/src/space/space.h -./flatconnector.o: ../../pikotools/src/textstream/types.h -./flatconnector.o: ../../pikotools/src/convert/inttostr.h ./flatconnector.o: ../../pikotools/src/utf8/utf8.h -./flatconnector.o: ../../pikotools/src/textstream/stream.h ./flatconnector.o: ../../pikotools/src/utf8/utf8_templates.h ./flatconnector.o: ../../pikotools/src/utf8/utf8_private.h -./flatconnector.o: ../../pikotools/src/date/date.h ./flatconnector.o: ../../pikotools/src/membuffer/membuffer.h -./flatconnector.o: ../../pikotools/src/textstream/types.h export.h -./flatconnector.o: flatexpression.h baseexpression.h morm_types.h modelenv.h -./flatconnector.o: modeldata.h cursorhelper.h queryresult.h -./flatconnector.o: ../../pikotools/src/log/log.h +./flatconnector.o: ../../pikotools/src/textstream/types.h +./flatconnector.o: ../../pikotools/src/textstream/stream_private.h ./flatconnector.o: ../../pikotools/src/log/filelog.h finderhelper.h ./flatconnector.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./flatconnector.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./flatconnector.o: ../../pikotools/src/convert/text.h model.h -./flatconnector.o: modelconnector.h clearer.h dbconnector.h dbexpression.h +./flatconnector.o: model.h modelconnector.h clearer.h dbconnector.h +./flatconnector.o: dbexpression.h ./flatexpression.o: flatexpression.h baseexpression.h +./flatexpression.o: ../../pikotools/src/textstream/stream.h +./flatexpression.o: ../../pikotools/src/date/date.h +./flatexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./flatexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./flatexpression.o: ../../pikotools/src/log/log.h ./flatexpression.o: ../../pikotools/src/textstream/textstream.h ./flatexpression.o: ../../pikotools/src/textstream/stream.h ./flatexpression.o: ../../pikotools/src/space/space.h -./flatexpression.o: ../../pikotools/src/textstream/types.h -./flatexpression.o: ../../pikotools/src/convert/inttostr.h ./flatexpression.o: ../../pikotools/src/utf8/utf8.h -./flatexpression.o: ../../pikotools/src/textstream/stream.h ./flatexpression.o: ../../pikotools/src/utf8/utf8_templates.h ./flatexpression.o: ../../pikotools/src/utf8/utf8_private.h -./flatexpression.o: ../../pikotools/src/date/date.h ./flatexpression.o: ../../pikotools/src/membuffer/membuffer.h -./flatexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./flatexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./flatexpression.o: ../../pikotools/src/log/log.h +./flatexpression.o: ../../pikotools/src/textstream/types.h +./flatexpression.o: ../../pikotools/src/textstream/stream_private.h ./flatexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h ./flatexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./flatexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./flatexpression.o: export.h ../../pikotools/src/convert/text.h ./jsonconnector.o: jsonconnector.h flatconnector.h +./jsonconnector.o: ../../pikotools/src/textstream/stream.h export.h +./jsonconnector.o: jsonexpression.h flatexpression.h baseexpression.h +./jsonconnector.o: ../../pikotools/src/date/date.h +./jsonconnector.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./jsonconnector.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./jsonconnector.o: ../../pikotools/src/log/log.h ./jsonconnector.o: ../../pikotools/src/textstream/textstream.h ./jsonconnector.o: ../../pikotools/src/textstream/stream.h ./jsonconnector.o: ../../pikotools/src/space/space.h -./jsonconnector.o: ../../pikotools/src/textstream/types.h -./jsonconnector.o: ../../pikotools/src/convert/inttostr.h ./jsonconnector.o: ../../pikotools/src/utf8/utf8.h -./jsonconnector.o: ../../pikotools/src/textstream/stream.h ./jsonconnector.o: ../../pikotools/src/utf8/utf8_templates.h ./jsonconnector.o: ../../pikotools/src/utf8/utf8_private.h -./jsonconnector.o: ../../pikotools/src/date/date.h ./jsonconnector.o: ../../pikotools/src/membuffer/membuffer.h -./jsonconnector.o: ../../pikotools/src/textstream/types.h export.h -./jsonconnector.o: jsonexpression.h flatexpression.h baseexpression.h -./jsonconnector.o: morm_types.h modelenv.h modeldata.h cursorhelper.h -./jsonconnector.o: queryresult.h ../../pikotools/src/log/log.h +./jsonconnector.o: ../../pikotools/src/textstream/types.h +./jsonconnector.o: ../../pikotools/src/textstream/stream_private.h ./jsonconnector.o: ../../pikotools/src/log/filelog.h finderhelper.h ./jsonconnector.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./jsonconnector.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./jsonconnector.o: ../../pikotools/src/convert/text.h ./jsonexpression.o: jsonexpression.h flatexpression.h baseexpression.h +./jsonexpression.o: ../../pikotools/src/textstream/stream.h +./jsonexpression.o: ../../pikotools/src/date/date.h +./jsonexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./jsonexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./jsonexpression.o: ../../pikotools/src/log/log.h ./jsonexpression.o: ../../pikotools/src/textstream/textstream.h ./jsonexpression.o: ../../pikotools/src/textstream/stream.h ./jsonexpression.o: ../../pikotools/src/space/space.h -./jsonexpression.o: ../../pikotools/src/textstream/types.h -./jsonexpression.o: ../../pikotools/src/convert/inttostr.h ./jsonexpression.o: ../../pikotools/src/utf8/utf8.h -./jsonexpression.o: ../../pikotools/src/textstream/stream.h ./jsonexpression.o: ../../pikotools/src/utf8/utf8_templates.h ./jsonexpression.o: ../../pikotools/src/utf8/utf8_private.h -./jsonexpression.o: ../../pikotools/src/date/date.h ./jsonexpression.o: ../../pikotools/src/membuffer/membuffer.h -./jsonexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./jsonexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./jsonexpression.o: ../../pikotools/src/log/log.h +./jsonexpression.o: ../../pikotools/src/textstream/types.h +./jsonexpression.o: ../../pikotools/src/textstream/stream_private.h ./jsonexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h ./jsonexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./jsonexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./jsonexpression.o: export.h ../../pikotools/src/convert/text.h ./jsonexpression.o: ../../pikotools/src/convert/misc.h ./jsonexpression.o: ../../pikotools/src/convert/text.h +./jsonexpression.o: ../../pikotools/src/textstream/types.h ./model.o: model.h ../../pikotools/src/textstream/textstream.h ./model.o: ../../pikotools/src/textstream/stream.h ./model.o: ../../pikotools/src/space/space.h -./model.o: ../../pikotools/src/textstream/types.h ./model.o: ../../pikotools/src/convert/inttostr.h ./model.o: ../../pikotools/src/utf8/utf8.h ./model.o: ../../pikotools/src/textstream/stream.h @@ -183,81 +175,56 @@ ./model.o: ../../pikotools/src/utf8/utf8_private.h ./model.o: ../../pikotools/src/date/date.h ./model.o: ../../pikotools/src/membuffer/membuffer.h -./model.o: ../../pikotools/src/textstream/types.h modelconnector.h clearer.h -./model.o: ft.h dbconnector.h ../../pikotools/src/log/log.h +./model.o: ../../pikotools/src/textstream/types.h +./model.o: ../../pikotools/src/textstream/stream_private.h modelconnector.h +./model.o: clearer.h ft.h dbconnector.h ../../pikotools/src/log/log.h ./model.o: ../../pikotools/src/log/filelog.h queryresult.h flatconnector.h ./model.o: export.h dbexpression.h baseexpression.h morm_types.h modelenv.h ./model.o: modeldata.h cursorhelper.h finderhelper.h fieldvaluehelper.h ./model.o: wrapper.h spacewrapper.h baseobjectwrapper.h -./model.o: modelcontainerwrapper.h select.h -./model.o: ../../pikotools/src/convert/text.h flatexpression.h +./model.o: modelcontainerwrapper.h select.h flatexpression.h +./model.o: ../../pikotools/src/convert/text.h ./modelconnector.o: modelconnector.h clearer.h ./modelconnector.o: ../../pikotools/src/date/date.h ./modelconnector.o: ../../pikotools/src/convert/inttostr.h ./modelconnector.o: ../../pikotools/src/space/space.h -./modelconnector.o: ../../pikotools/src/textstream/types.h ./modelconnector.o: ../../pikotools/src/utf8/utf8.h ./modelconnector.o: ../../pikotools/src/textstream/stream.h ./modelconnector.o: ../../pikotools/src/utf8/utf8_templates.h ./modelconnector.o: ../../pikotools/src/utf8/utf8_private.h ft.h -./modelconnector.o: dbconnector.h ../../pikotools/src/textstream/textstream.h +./modelconnector.o: dbconnector.h ../../pikotools/src/log/log.h +./modelconnector.o: ../../pikotools/src/textstream/textstream.h ./modelconnector.o: ../../pikotools/src/textstream/stream.h ./modelconnector.o: ../../pikotools/src/membuffer/membuffer.h ./modelconnector.o: ../../pikotools/src/textstream/types.h -./modelconnector.o: ../../pikotools/src/log/log.h +./modelconnector.o: ../../pikotools/src/textstream/stream_private.h ./modelconnector.o: ../../pikotools/src/log/filelog.h queryresult.h ./modelconnector.o: flatconnector.h export.h -./postgresqlconnector.o: postgresqlconnector.h dbconnector.h -./postgresqlconnector.o: ../../pikotools/src/textstream/textstream.h -./postgresqlconnector.o: ../../pikotools/src/textstream/stream.h -./postgresqlconnector.o: ../../pikotools/src/space/space.h -./postgresqlconnector.o: ../../pikotools/src/textstream/types.h -./postgresqlconnector.o: ../../pikotools/src/convert/inttostr.h -./postgresqlconnector.o: ../../pikotools/src/utf8/utf8.h -./postgresqlconnector.o: ../../pikotools/src/textstream/stream.h -./postgresqlconnector.o: ../../pikotools/src/utf8/utf8_templates.h -./postgresqlconnector.o: ../../pikotools/src/utf8/utf8_private.h -./postgresqlconnector.o: ../../pikotools/src/date/date.h -./postgresqlconnector.o: ../../pikotools/src/membuffer/membuffer.h -./postgresqlconnector.o: ../../pikotools/src/textstream/types.h -./postgresqlconnector.o: ../../pikotools/src/log/log.h -./postgresqlconnector.o: ../../pikotools/src/log/filelog.h queryresult.h ft.h -./postgresqlconnector.o: postgresqlqueryresult.h postgresqlexpression.h -./postgresqlconnector.o: dbexpression.h baseexpression.h morm_types.h -./postgresqlconnector.o: modelenv.h modeldata.h cursorhelper.h finderhelper.h -./postgresqlconnector.o: fieldvaluehelper.h wrapper.h spacewrapper.h -./postgresqlconnector.o: baseobjectwrapper.h modelcontainerwrapper.h select.h -./postgresqlconnector.o: export.h ../../pikotools/src/convert/text.h -./postgresqlconnector.o: ../../pikotools/src/convert/strtoint.h -./postgresqlconnector.o: ../../pikotools/src/convert/text.h -./postgresqlconnector.o: ../../pikotools/src/convert/misc.h ./postgresqlexpression.o: postgresqlexpression.h dbexpression.h ./postgresqlexpression.o: baseexpression.h +./postgresqlexpression.o: ../../pikotools/src/textstream/stream.h +./postgresqlexpression.o: ../../pikotools/src/date/date.h +./postgresqlexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./postgresqlexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./postgresqlexpression.o: ../../pikotools/src/log/log.h ./postgresqlexpression.o: ../../pikotools/src/textstream/textstream.h ./postgresqlexpression.o: ../../pikotools/src/textstream/stream.h ./postgresqlexpression.o: ../../pikotools/src/space/space.h -./postgresqlexpression.o: ../../pikotools/src/textstream/types.h -./postgresqlexpression.o: ../../pikotools/src/convert/inttostr.h ./postgresqlexpression.o: ../../pikotools/src/utf8/utf8.h -./postgresqlexpression.o: ../../pikotools/src/textstream/stream.h ./postgresqlexpression.o: ../../pikotools/src/utf8/utf8_templates.h ./postgresqlexpression.o: ../../pikotools/src/utf8/utf8_private.h -./postgresqlexpression.o: ../../pikotools/src/date/date.h ./postgresqlexpression.o: ../../pikotools/src/membuffer/membuffer.h -./postgresqlexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./postgresqlexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./postgresqlexpression.o: ../../pikotools/src/log/log.h +./postgresqlexpression.o: ../../pikotools/src/textstream/types.h +./postgresqlexpression.o: ../../pikotools/src/textstream/stream_private.h ./postgresqlexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h ./postgresqlexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./postgresqlexpression.o: baseobjectwrapper.h modelcontainerwrapper.h -./postgresqlexpression.o: select.h ft.h export.h -./postgresqlexpression.o: ../../pikotools/src/convert/text.h +./postgresqlexpression.o: select.h ft.h ./postgresqlqueryresult.o: postgresqlqueryresult.h queryresult.h ./postgresqlqueryresult.o: ../../pikotools/src/log/log.h ./postgresqlqueryresult.o: ../../pikotools/src/textstream/textstream.h ./postgresqlqueryresult.o: ../../pikotools/src/textstream/stream.h ./postgresqlqueryresult.o: ../../pikotools/src/space/space.h -./postgresqlqueryresult.o: ../../pikotools/src/textstream/types.h ./postgresqlqueryresult.o: ../../pikotools/src/convert/inttostr.h ./postgresqlqueryresult.o: ../../pikotools/src/utf8/utf8.h ./postgresqlqueryresult.o: ../../pikotools/src/textstream/stream.h @@ -266,12 +233,12 @@ ./postgresqlqueryresult.o: ../../pikotools/src/date/date.h ./postgresqlqueryresult.o: ../../pikotools/src/membuffer/membuffer.h ./postgresqlqueryresult.o: ../../pikotools/src/textstream/types.h +./postgresqlqueryresult.o: ../../pikotools/src/textstream/stream_private.h ./postgresqlqueryresult.o: ../../pikotools/src/log/filelog.h ./queryresult.o: queryresult.h ../../pikotools/src/log/log.h ./queryresult.o: ../../pikotools/src/textstream/textstream.h ./queryresult.o: ../../pikotools/src/textstream/stream.h ./queryresult.o: ../../pikotools/src/space/space.h -./queryresult.o: ../../pikotools/src/textstream/types.h ./queryresult.o: ../../pikotools/src/convert/inttostr.h ./queryresult.o: ../../pikotools/src/utf8/utf8.h ./queryresult.o: ../../pikotools/src/textstream/stream.h @@ -280,12 +247,54 @@ ./queryresult.o: ../../pikotools/src/date/date.h ./queryresult.o: ../../pikotools/src/membuffer/membuffer.h ./queryresult.o: ../../pikotools/src/textstream/types.h +./queryresult.o: ../../pikotools/src/textstream/stream_private.h ./queryresult.o: ../../pikotools/src/log/filelog.h +./csvexpression.o: csvexpression.h flatexpression.h baseexpression.h +./csvexpression.o: ../../pikotools/src/textstream/stream.h +./csvexpression.o: ../../pikotools/src/date/date.h +./csvexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./csvexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./csvexpression.o: ../../pikotools/src/log/log.h +./csvexpression.o: ../../pikotools/src/textstream/textstream.h +./csvexpression.o: ../../pikotools/src/textstream/stream.h +./csvexpression.o: ../../pikotools/src/space/space.h +./csvexpression.o: ../../pikotools/src/utf8/utf8.h +./csvexpression.o: ../../pikotools/src/utf8/utf8_templates.h +./csvexpression.o: ../../pikotools/src/utf8/utf8_private.h +./csvexpression.o: ../../pikotools/src/membuffer/membuffer.h +./csvexpression.o: ../../pikotools/src/textstream/types.h +./csvexpression.o: ../../pikotools/src/textstream/stream_private.h +./csvexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h +./csvexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h +./csvexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h +./csvexpression.o: ../../pikotools/src/convert/misc.h +./csvexpression.o: ../../pikotools/src/convert/text.h +./csvexpression.o: ../../pikotools/src/textstream/types.h +./xmlexpression.o: xmlexpression.h flatexpression.h baseexpression.h +./xmlexpression.o: ../../pikotools/src/textstream/stream.h +./xmlexpression.o: ../../pikotools/src/date/date.h +./xmlexpression.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./xmlexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./xmlexpression.o: ../../pikotools/src/log/log.h +./xmlexpression.o: ../../pikotools/src/textstream/textstream.h +./xmlexpression.o: ../../pikotools/src/textstream/stream.h +./xmlexpression.o: ../../pikotools/src/space/space.h +./xmlexpression.o: ../../pikotools/src/utf8/utf8.h +./xmlexpression.o: ../../pikotools/src/utf8/utf8_templates.h +./xmlexpression.o: ../../pikotools/src/utf8/utf8_private.h +./xmlexpression.o: ../../pikotools/src/membuffer/membuffer.h +./xmlexpression.o: ../../pikotools/src/textstream/types.h +./xmlexpression.o: ../../pikotools/src/textstream/stream_private.h +./xmlexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h +./xmlexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h +./xmlexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h +./xmlexpression.o: ../../pikotools/src/convert/misc.h +./xmlexpression.o: ../../pikotools/src/convert/text.h +./xmlexpression.o: ../../pikotools/src/textstream/types.h ./transaction.o: transaction.h ../../pikotools/src/log/log.h ./transaction.o: ../../pikotools/src/textstream/textstream.h ./transaction.o: ../../pikotools/src/textstream/stream.h ./transaction.o: ../../pikotools/src/space/space.h -./transaction.o: ../../pikotools/src/textstream/types.h ./transaction.o: ../../pikotools/src/convert/inttostr.h ./transaction.o: ../../pikotools/src/utf8/utf8.h ./transaction.o: ../../pikotools/src/textstream/stream.h @@ -294,87 +303,68 @@ ./transaction.o: ../../pikotools/src/date/date.h ./transaction.o: ../../pikotools/src/membuffer/membuffer.h ./transaction.o: ../../pikotools/src/textstream/types.h +./transaction.o: ../../pikotools/src/textstream/stream_private.h ./transaction.o: ../../pikotools/src/log/filelog.h modelconnector.h clearer.h ./transaction.o: ft.h dbconnector.h queryresult.h flatconnector.h export.h ./xmlconnector.o: xmlconnector.h flatconnector.h +./xmlconnector.o: ../../pikotools/src/textstream/stream.h export.h +./xmlconnector.o: xmlexpression.h flatexpression.h baseexpression.h +./xmlconnector.o: ../../pikotools/src/date/date.h +./xmlconnector.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./xmlconnector.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./xmlconnector.o: ../../pikotools/src/log/log.h ./xmlconnector.o: ../../pikotools/src/textstream/textstream.h ./xmlconnector.o: ../../pikotools/src/textstream/stream.h ./xmlconnector.o: ../../pikotools/src/space/space.h -./xmlconnector.o: ../../pikotools/src/textstream/types.h -./xmlconnector.o: ../../pikotools/src/convert/inttostr.h ./xmlconnector.o: ../../pikotools/src/utf8/utf8.h -./xmlconnector.o: ../../pikotools/src/textstream/stream.h ./xmlconnector.o: ../../pikotools/src/utf8/utf8_templates.h ./xmlconnector.o: ../../pikotools/src/utf8/utf8_private.h -./xmlconnector.o: ../../pikotools/src/date/date.h ./xmlconnector.o: ../../pikotools/src/membuffer/membuffer.h -./xmlconnector.o: ../../pikotools/src/textstream/types.h export.h -./xmlconnector.o: xmlexpression.h flatexpression.h baseexpression.h -./xmlconnector.o: morm_types.h modelenv.h modeldata.h cursorhelper.h -./xmlconnector.o: queryresult.h ../../pikotools/src/log/log.h +./xmlconnector.o: ../../pikotools/src/textstream/types.h +./xmlconnector.o: ../../pikotools/src/textstream/stream_private.h ./xmlconnector.o: ../../pikotools/src/log/filelog.h finderhelper.h ./xmlconnector.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./xmlconnector.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./xmlconnector.o: ../../pikotools/src/convert/text.h -./xmlexpression.o: xmlexpression.h flatexpression.h baseexpression.h -./xmlexpression.o: ../../pikotools/src/textstream/textstream.h -./xmlexpression.o: ../../pikotools/src/textstream/stream.h -./xmlexpression.o: ../../pikotools/src/space/space.h -./xmlexpression.o: ../../pikotools/src/textstream/types.h -./xmlexpression.o: ../../pikotools/src/convert/inttostr.h -./xmlexpression.o: ../../pikotools/src/utf8/utf8.h -./xmlexpression.o: ../../pikotools/src/textstream/stream.h -./xmlexpression.o: ../../pikotools/src/utf8/utf8_templates.h -./xmlexpression.o: ../../pikotools/src/utf8/utf8_private.h -./xmlexpression.o: ../../pikotools/src/date/date.h -./xmlexpression.o: ../../pikotools/src/membuffer/membuffer.h -./xmlexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./xmlexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./xmlexpression.o: ../../pikotools/src/log/log.h -./xmlexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h -./xmlexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h -./xmlexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./xmlexpression.o: export.h ../../pikotools/src/convert/text.h -./xmlexpression.o: ../../pikotools/src/convert/misc.h -./xmlexpression.o: ../../pikotools/src/convert/text.h -./csvexpression.o: csvexpression.h flatexpression.h baseexpression.h -./csvexpression.o: ../../pikotools/src/textstream/textstream.h -./csvexpression.o: ../../pikotools/src/textstream/stream.h -./csvexpression.o: ../../pikotools/src/space/space.h -./csvexpression.o: ../../pikotools/src/textstream/types.h -./csvexpression.o: ../../pikotools/src/convert/inttostr.h -./csvexpression.o: ../../pikotools/src/utf8/utf8.h -./csvexpression.o: ../../pikotools/src/textstream/stream.h -./csvexpression.o: ../../pikotools/src/utf8/utf8_templates.h -./csvexpression.o: ../../pikotools/src/utf8/utf8_private.h -./csvexpression.o: ../../pikotools/src/date/date.h -./csvexpression.o: ../../pikotools/src/membuffer/membuffer.h -./csvexpression.o: ../../pikotools/src/textstream/types.h morm_types.h -./csvexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h -./csvexpression.o: ../../pikotools/src/log/log.h -./csvexpression.o: ../../pikotools/src/log/filelog.h finderhelper.h -./csvexpression.o: fieldvaluehelper.h wrapper.h spacewrapper.h -./csvexpression.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./csvexpression.o: export.h ../../pikotools/src/convert/text.h -./csvexpression.o: ../../pikotools/src/convert/misc.h -./csvexpression.o: ../../pikotools/src/convert/text.h ./csvconnector.o: csvconnector.h flatconnector.h +./csvconnector.o: ../../pikotools/src/textstream/stream.h export.h +./csvconnector.o: csvexpression.h flatexpression.h baseexpression.h +./csvconnector.o: ../../pikotools/src/date/date.h +./csvconnector.o: ../../pikotools/src/convert/inttostr.h morm_types.h +./csvconnector.o: modelenv.h modeldata.h cursorhelper.h queryresult.h +./csvconnector.o: ../../pikotools/src/log/log.h ./csvconnector.o: ../../pikotools/src/textstream/textstream.h ./csvconnector.o: ../../pikotools/src/textstream/stream.h ./csvconnector.o: ../../pikotools/src/space/space.h -./csvconnector.o: ../../pikotools/src/textstream/types.h -./csvconnector.o: ../../pikotools/src/convert/inttostr.h ./csvconnector.o: ../../pikotools/src/utf8/utf8.h -./csvconnector.o: ../../pikotools/src/textstream/stream.h ./csvconnector.o: ../../pikotools/src/utf8/utf8_templates.h ./csvconnector.o: ../../pikotools/src/utf8/utf8_private.h -./csvconnector.o: ../../pikotools/src/date/date.h ./csvconnector.o: ../../pikotools/src/membuffer/membuffer.h -./csvconnector.o: ../../pikotools/src/textstream/types.h export.h -./csvconnector.o: csvexpression.h flatexpression.h baseexpression.h -./csvconnector.o: morm_types.h modelenv.h modeldata.h cursorhelper.h -./csvconnector.o: queryresult.h ../../pikotools/src/log/log.h +./csvconnector.o: ../../pikotools/src/textstream/types.h +./csvconnector.o: ../../pikotools/src/textstream/stream_private.h ./csvconnector.o: ../../pikotools/src/log/filelog.h finderhelper.h ./csvconnector.o: fieldvaluehelper.h wrapper.h spacewrapper.h ./csvconnector.o: baseobjectwrapper.h modelcontainerwrapper.h select.h ft.h -./csvconnector.o: ../../pikotools/src/convert/text.h +./postgresqlconnector.o: postgresqlconnector.h dbconnector.h +./postgresqlconnector.o: ../../pikotools/src/textstream/stream.h +./postgresqlconnector.o: ../../pikotools/src/log/log.h +./postgresqlconnector.o: ../../pikotools/src/textstream/textstream.h +./postgresqlconnector.o: ../../pikotools/src/textstream/stream.h +./postgresqlconnector.o: ../../pikotools/src/space/space.h +./postgresqlconnector.o: ../../pikotools/src/convert/inttostr.h +./postgresqlconnector.o: ../../pikotools/src/utf8/utf8.h +./postgresqlconnector.o: ../../pikotools/src/utf8/utf8_templates.h +./postgresqlconnector.o: ../../pikotools/src/utf8/utf8_private.h +./postgresqlconnector.o: ../../pikotools/src/date/date.h +./postgresqlconnector.o: ../../pikotools/src/membuffer/membuffer.h +./postgresqlconnector.o: ../../pikotools/src/textstream/types.h +./postgresqlconnector.o: ../../pikotools/src/textstream/stream_private.h +./postgresqlconnector.o: ../../pikotools/src/log/filelog.h queryresult.h ft.h +./postgresqlconnector.o: postgresqlqueryresult.h postgresqlexpression.h +./postgresqlconnector.o: dbexpression.h baseexpression.h morm_types.h +./postgresqlconnector.o: modelenv.h modeldata.h cursorhelper.h finderhelper.h +./postgresqlconnector.o: fieldvaluehelper.h wrapper.h spacewrapper.h +./postgresqlconnector.o: baseobjectwrapper.h modelcontainerwrapper.h select.h +./postgresqlconnector.o: ../../pikotools/src/convert/strtoint.h +./postgresqlconnector.o: ../../pikotools/src/convert/text.h +./postgresqlconnector.o: ../../pikotools/src/convert/misc.h +./postgresqlconnector.o: ../../pikotools/src/textstream/types.h diff --git a/src/baseexpression.cpp b/src/baseexpression.cpp index f3827d1..1dde0b2 100644 --- a/src/baseexpression.cpp +++ b/src/baseexpression.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -92,26 +92,18 @@ int BaseExpression::get_output_type() -pt::TextStream * BaseExpression::get_text_stream() +pt::Stream * BaseExpression::get_text_stream() { return out_stream; } -void BaseExpression::set_text_stream(pt::TextStream * out_stream) + +void BaseExpression::set_text_stream(pt::Stream * out_stream) { this->out_stream = out_stream; } - - - -pt::TextStream * BaseExpression::get_current_stream() -{ - return out_stream; -} - - void BaseExpression::allow_to_use_prefix(bool use_prefix) { this->use_prefix = use_prefix; @@ -125,14 +117,14 @@ bool BaseExpression::get_allow_to_use_prefix() -void BaseExpression::generate_from_model(pt::TextStream & stream, Model & model) +void BaseExpression::generate_from_model(pt::Stream & stream, Model & model) { FT field_type = FT::default_type; generate_from_model(stream, model, field_type); } -void BaseExpression::generate_from_model(pt::TextStream & stream, Model & model, const FT & field_type) +void BaseExpression::generate_from_model(pt::Stream & stream, Model & model, const FT & field_type) { this->out_stream = &stream; generate_from_model(model, field_type); @@ -281,7 +273,7 @@ void BaseExpression::put_value_list_closing_index(size_t index, const FT & field void BaseExpression::save_foreign_key(const wchar_t * field_name, const FT & field_type, ModelEnv * model_env) { pt::TextStream str; - pt::TextStream * old_out_stream = out_stream; + pt::Stream * old_out_stream = out_stream; out_stream = &str; put_field_name(field_name, field_type, model_env); @@ -459,14 +451,14 @@ char BaseExpression::char_to_hex_part(char c) } -void BaseExpression::char_to_hex(char c, pt::TextStream & stream) +void BaseExpression::char_to_hex(char c, pt::Stream & stream) { stream << char_to_hex_part(((unsigned char)c) >> 4); stream << char_to_hex_part(((unsigned char)c) & 0x0f); } -void BaseExpression::char_to_hex(wchar_t c, pt::TextStream & stream) +void BaseExpression::char_to_hex(wchar_t c, pt::Stream & stream) { unsigned int z = static_cast(c); @@ -482,7 +474,7 @@ void BaseExpression::char_to_hex(wchar_t c, pt::TextStream & stream) * return true if the val character was escaped and put (or ignored) to the stream * */ -bool BaseExpression::esc_char(char val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +bool BaseExpression::esc_char(char val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { return esc_char((wchar_t)(unsigned char)val, stream, field_type, model_env); } @@ -491,16 +483,16 @@ bool BaseExpression::esc_char(char val, pt::TextStream & stream, const FT & fiel /* * return true if the val character was escaped and put (or ignored) to the stream * - * in most caces you have to provide your own esc_char(wchar_t val, pt::TextStream & stream) method + * in most cases you have to provide your own esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) method * */ -bool BaseExpression::esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +bool BaseExpression::esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { return false; } -void BaseExpression::esc(char val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(char val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( field_type.is_binary() || field_type.is_hexadecimal() ) { @@ -516,13 +508,13 @@ void BaseExpression::esc(char val, pt::TextStream & stream, const FT & field_typ } -void BaseExpression::esc(unsigned char val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(unsigned char val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { esc(static_cast(val), stream, field_type, model_env); } -void BaseExpression::esc(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( field_type.is_binary() || field_type.is_hexadecimal() ) { @@ -550,7 +542,7 @@ void BaseExpression::esc(wchar_t val, pt::TextStream & stream, const FT & field_ } -void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( field_type.is_numeric() ) { @@ -563,7 +555,7 @@ void BaseExpression::esc(const wchar_t * val, bool has_known_length, size_t len, } -void BaseExpression::esc(const char * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const char * val, bool has_known_length, size_t len, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( field_type.is_numeric() ) { @@ -576,31 +568,31 @@ void BaseExpression::esc(const char * val, bool has_known_length, size_t len, pt } -void BaseExpression::esc(const std::wstring & val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const std::wstring & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { esc(val.c_str(), true, val.size(), stream, field_type, model_env); } -void BaseExpression::esc(const wchar_t * val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const wchar_t * val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { esc(val, false, 0, stream, field_type, model_env); } -void BaseExpression::esc(const std::string & val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const std::string & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { esc(val.c_str(), true, val.size(), stream, field_type, model_env); } -void BaseExpression::esc(const char * val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const char * val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { esc(val, false, 0, stream, field_type, model_env); } -void BaseExpression::esc(bool val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(bool val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( val ) stream << "true"; @@ -609,73 +601,73 @@ void BaseExpression::esc(bool val, pt::TextStream & stream, const FT & field_typ } -void BaseExpression::esc(short val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(short val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(unsigned short val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(unsigned short val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(int val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(int val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(unsigned int val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(unsigned int val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(long val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(long val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(unsigned long val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(unsigned long val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(long long val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(long long val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(unsigned long long val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(unsigned long long val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(float val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(float val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(double val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(double val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(long double val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(long double val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { stream << val; } -void BaseExpression::esc(const pt::Date & date, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const pt::Date & date, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( field_type.is_date_only() ) { @@ -700,7 +692,7 @@ void BaseExpression::esc(const pt::Date & date, pt::TextStream & stream, const F } -void BaseExpression::esc(const pt::TextStream & val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const pt::TextStream & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { pt::TextStream::const_iterator i = val.begin(); @@ -711,7 +703,7 @@ void BaseExpression::esc(const pt::TextStream & val, pt::TextStream & stream, co } -void BaseExpression::esc(const pt::WTextStream & val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const pt::WTextStream & val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { pt::WTextStream::const_iterator i = val.begin(); @@ -722,7 +714,7 @@ void BaseExpression::esc(const pt::WTextStream & val, pt::TextStream & stream, c } -void BaseExpression::esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void BaseExpression::esc(const pt::Space & space, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { pt::WTextStream tmp_stream; bool pretty_print = field_type.is_pretty_print(); @@ -736,110 +728,113 @@ void BaseExpression::esc(const pt::Space & space, pt::TextStream & stream, const } -//void BaseExpression::put_type(char val, pt::TextStream & stream) + + + +//void BaseExpression::put_type(char val, pt::Stream & stream) //{ // stream << "char"; //} // -//void BaseExpression::put_type(unsigned char val, pt::TextStream & stream) +//void BaseExpression::put_type(unsigned char val, pt::Stream & stream) //{ // stream << "unsigned char"; //} // // -//void BaseExpression::put_type(const std::wstring & val, pt::TextStream & stream) +//void BaseExpression::put_type(const std::wstring & val, pt::Stream & stream) //{ // stream << "text"; //} // -//void BaseExpression::put_type(const wchar_t * val, pt::TextStream & stream) +//void BaseExpression::put_type(const wchar_t * val, pt::Stream & stream) //{ // stream << "text"; //} // // -//void BaseExpression::put_type(const std::string & val, pt::TextStream & stream) +//void BaseExpression::put_type(const std::string & val, pt::Stream & stream) //{ // stream << "text"; //} // -//void BaseExpression::put_type(const char * val, pt::TextStream & stream) +//void BaseExpression::put_type(const char * val, pt::Stream & stream) //{ // stream << "text"; //} // // -//void BaseExpression::put_type(bool val, pt::TextStream & stream) +//void BaseExpression::put_type(bool val, pt::Stream & stream) //{ // stream << "boolean"; //} // -//void BaseExpression::put_type(short val, pt::TextStream & stream) +//void BaseExpression::put_type(short val, pt::Stream & stream) //{ // stream << "short integer"; //} // -//void BaseExpression::put_type(unsigned short val, pt::TextStream & stream) +//void BaseExpression::put_type(unsigned short val, pt::Stream & stream) //{ // stream << "unsigned short integer"; //} // -//void BaseExpression::put_type(int val, pt::TextStream & stream) +//void BaseExpression::put_type(int val, pt::Stream & stream) //{ // stream << "integer"; //} // -//void BaseExpression::put_type(unsigned int val, pt::TextStream & stream) +//void BaseExpression::put_type(unsigned int val, pt::Stream & stream) //{ // stream << "unsigned integer"; //} // -//void BaseExpression::put_type(long val, pt::TextStream & stream) +//void BaseExpression::put_type(long val, pt::Stream & stream) //{ // stream << "long integer"; //} // -//void BaseExpression::put_type(unsigned long val, pt::TextStream & stream) +//void BaseExpression::put_type(unsigned long val, pt::Stream & stream) //{ // stream << "unsigned long integer"; //} // -//void BaseExpression::put_type(long long val, pt::TextStream & stream) +//void BaseExpression::put_type(long long val, pt::Stream & stream) //{ // stream << "very long integer"; //} // -//void BaseExpression::put_type(unsigned long long val, pt::TextStream & stream) +//void BaseExpression::put_type(unsigned long long val, pt::Stream & stream) //{ // stream << "unsigned very long integer"; //} // -//void BaseExpression::put_type(float val, pt::TextStream & stream) +//void BaseExpression::put_type(float val, pt::Stream & stream) //{ // stream << "float"; //} // -//void BaseExpression::put_type(double val, pt::TextStream & stream) +//void BaseExpression::put_type(double val, pt::Stream & stream) //{ // stream << "double"; //} // -//void BaseExpression::put_type(long double val, pt::TextStream & stream) +//void BaseExpression::put_type(long double val, pt::Stream & stream) //{ // stream << "long double"; //} // -////void BaseExpression::put_type(void* val, pt::TextStream & stream) +////void BaseExpression::put_type(void* val, pt::Stream & stream) ////{ ////} // // -//void BaseExpression::put_type(const pt::Date & date, pt::TextStream & stream) +//void BaseExpression::put_type(const pt::Date & date, pt::Stream & stream) //{ // stream << "date"; //} // -//void BaseExpression::put_type(const Model & model, pt::TextStream & stream) +//void BaseExpression::put_type(const Model & model, pt::Stream & stream) //{ // stream << "object"; //} @@ -1087,8 +1082,7 @@ void BaseExpression::put_stream(const pt::WTextStream & str, const FT & field_ty } - -void BaseExpression::schema_table_to_stream(pt::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name) +void BaseExpression::schema_table_to_stream(pt::Stream & stream, const wchar_t * schema_name, const wchar_t * table_name) { this->out_stream = &stream; put_schema_table(schema_name, table_name); @@ -1096,7 +1090,7 @@ void BaseExpression::schema_table_to_stream(pt::TextStream & stream, const wchar } -void BaseExpression::schema_table_to_stream(pt::TextStream & stream, const pt::WTextStream & schema_name, const pt::WTextStream & table_name) +void BaseExpression::schema_table_to_stream(pt::Stream & stream, const pt::WTextStream & schema_name, const pt::WTextStream & table_name) { this->out_stream = &stream; put_schema_table(schema_name, table_name); @@ -1104,7 +1098,7 @@ void BaseExpression::schema_table_to_stream(pt::TextStream & stream, const pt::W } -void BaseExpression::table_to_stream(pt::TextStream & stream, const wchar_t * table_name) +void BaseExpression::table_to_stream(pt::Stream & stream, const wchar_t * table_name) { this->out_stream = &stream; put_table(table_name); @@ -1112,7 +1106,7 @@ void BaseExpression::table_to_stream(pt::TextStream & stream, const wchar_t * ta } -void BaseExpression::table_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name) +void BaseExpression::table_to_stream(pt::Stream & stream, const pt::WTextStream & table_name) { this->out_stream = &stream; put_table(table_name); @@ -1120,7 +1114,7 @@ void BaseExpression::table_to_stream(pt::TextStream & stream, const pt::WTextStr } -void BaseExpression::table_with_index_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index) +void BaseExpression::table_with_index_to_stream(pt::Stream & stream, const wchar_t * table_name, int index) { this->out_stream = &stream; put_table_with_index(table_name, index); @@ -1128,7 +1122,7 @@ void BaseExpression::table_with_index_to_stream(pt::TextStream & stream, const w } -void BaseExpression::table_with_index_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index) +void BaseExpression::table_with_index_to_stream(pt::Stream & stream, const pt::WTextStream & table_name, int index) { this->out_stream = &stream; put_table_with_index(table_name, index); @@ -1136,7 +1130,7 @@ void BaseExpression::table_with_index_to_stream(pt::TextStream & stream, const p } -void BaseExpression::table_with_index_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type) +void BaseExpression::table_with_index_and_field_to_stream(pt::Stream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type) { this->out_stream = &stream; put_table_with_index_and_field(table_name, index, field_name, field_type); @@ -1144,7 +1138,7 @@ void BaseExpression::table_with_index_and_field_to_stream(pt::TextStream & strea } -void BaseExpression::table_with_index_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type) +void BaseExpression::table_with_index_and_field_to_stream(pt::Stream & stream, const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type) { this->out_stream = &stream; put_table_with_index_and_field(table_name, index, field_name, field_type); @@ -1152,7 +1146,7 @@ void BaseExpression::table_with_index_and_field_to_stream(pt::TextStream & strea } -void BaseExpression::table_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type) +void BaseExpression::table_and_field_to_stream(pt::Stream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type) { this->out_stream = &stream; put_table_and_field(table_name, field_name, field_type); @@ -1160,7 +1154,7 @@ void BaseExpression::table_and_field_to_stream(pt::TextStream & stream, const wc } -void BaseExpression::table_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type) +void BaseExpression::table_and_field_to_stream(pt::Stream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type) { this->out_stream = &stream; put_table_and_field(table_name, field_name, field_type); @@ -1168,7 +1162,7 @@ void BaseExpression::table_and_field_to_stream(pt::TextStream & stream, const pt } -void BaseExpression::alias_to_stream(pt::TextStream & stream, const pt::WTextStream & alias_name, int index) +void BaseExpression::alias_to_stream(pt::Stream & stream, const pt::WTextStream & alias_name, int index) { this->out_stream = &stream; put_alias(alias_name, index); @@ -1176,7 +1170,7 @@ void BaseExpression::alias_to_stream(pt::TextStream & stream, const pt::WTextStr } -void BaseExpression::alias_to_stream(pt::TextStream & stream, const pt::WTextStream & alias_name_prefix, int index, const wchar_t * alias_name_postfix) +void BaseExpression::alias_to_stream(pt::Stream & stream, const pt::WTextStream & alias_name_prefix, int index, const wchar_t * alias_name_postfix) { this->out_stream = &stream; put_alias(alias_name_prefix, index, alias_name_postfix); @@ -1186,7 +1180,7 @@ void BaseExpression::alias_to_stream(pt::TextStream & stream, const pt::WTextStr -void BaseExpression::string_to_stream(pt::TextStream & stream, const char * str, const FT & field_type, bool add_quotes, ModelEnv * model_env) +void BaseExpression::string_to_stream(pt::Stream & stream, const char * str, const FT & field_type, bool add_quotes, ModelEnv * model_env) { this->out_stream = &stream; put_string(str, field_type, add_quotes, model_env); @@ -1194,7 +1188,7 @@ void BaseExpression::string_to_stream(pt::TextStream & stream, const char * str, } -void BaseExpression::string_to_stream(pt::TextStream & stream, const wchar_t * str, const FT & field_type, bool add_quotes, ModelEnv * model_env) +void BaseExpression::string_to_stream(pt::Stream & stream, const wchar_t * str, const FT & field_type, bool add_quotes, ModelEnv * model_env) { this->out_stream = &stream; put_string(str, field_type, add_quotes, model_env); @@ -1202,7 +1196,7 @@ void BaseExpression::string_to_stream(pt::TextStream & stream, const wchar_t * s } -void BaseExpression::string_to_stream(pt::TextStream & stream, const std::string & str, const FT & field_type, bool add_quotes, ModelEnv * model_env) +void BaseExpression::string_to_stream(pt::Stream & stream, const std::string & str, const FT & field_type, bool add_quotes, ModelEnv * model_env) { this->out_stream = &stream; put_string(str, field_type, add_quotes, model_env); @@ -1210,7 +1204,7 @@ void BaseExpression::string_to_stream(pt::TextStream & stream, const std::string } -void BaseExpression::string_to_stream(pt::TextStream & stream, const std::wstring & str, const FT & field_type, bool add_quotes, ModelEnv * model_env) +void BaseExpression::string_to_stream(pt::Stream & stream, const std::wstring & str, const FT & field_type, bool add_quotes, ModelEnv * model_env) { this->out_stream = &stream; put_string(str, field_type, add_quotes, model_env); @@ -1218,7 +1212,7 @@ void BaseExpression::string_to_stream(pt::TextStream & stream, const std::wstrin } -void BaseExpression::stream_to_stream(pt::TextStream & stream_out, const pt::TextStream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env) +void BaseExpression::stream_to_stream(pt::Stream & stream_out, const pt::TextStream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env) { this->out_stream = &stream_out; put_stream(stream_in, field_type, add_quotes, model_env); @@ -1226,7 +1220,7 @@ void BaseExpression::stream_to_stream(pt::TextStream & stream_out, const pt::Tex } -void BaseExpression::stream_to_stream(pt::TextStream & stream_out, const pt::WTextStream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env) +void BaseExpression::stream_to_stream(pt::Stream & stream_out, const pt::WTextStream & stream_in, const FT & field_type, bool add_quotes, ModelEnv * model_env) { this->out_stream = &stream_out; put_stream(stream_in, field_type, add_quotes, model_env); @@ -1234,8 +1228,6 @@ void BaseExpression::stream_to_stream(pt::TextStream & stream_out, const pt::WTe } - - bool BaseExpression::is_empty_field(const wchar_t * value) { return (!value || *value == '\0'); diff --git a/src/baseexpression.h b/src/baseexpression.h index af16390..b7afa4c 100644 --- a/src/baseexpression.h +++ b/src/baseexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,17 +38,11 @@ #include #include #include -#include "textstream/textstream.h" +#include "textstream/stream.h" #include "date/date.h" #include "morm_types.h" #include "modelenv.h" #include "ft.h" -#include "export.h" -#include "convert/text.h" - -#ifdef MORM_HAS_EZC_LIBRARY -#include "funinfo.h" -#endif namespace morm @@ -73,15 +67,13 @@ public: virtual void set_output_type(int output_type); virtual int get_output_type(); - virtual pt::TextStream * get_text_stream(); - virtual void set_text_stream(pt::TextStream * out_stream); + virtual pt::Stream * get_text_stream(); + virtual void set_text_stream(pt::Stream * out_stream); virtual void clear(); - virtual void generate_from_model(pt::TextStream & stream, Model & model); - virtual void generate_from_model(pt::TextStream & stream, Model & model, const FT & field_type); - - virtual pt::TextStream * get_current_stream(); + virtual void generate_from_model(pt::Stream & stream, Model & model); + virtual void generate_from_model(pt::Stream & stream, Model & model, const FT & field_type); // rename me virtual void allow_to_use_prefix(bool use_prefix); @@ -140,21 +132,21 @@ public: template - void field_in(pt::TextStream & stream, const wchar_t * field_name, const std::set & container, ModelEnv * model_env) + void field_in(pt::Stream & stream, const wchar_t * field_name, const std::set & container, ModelEnv * model_env) { field_in_generic>(stream, field_name, container, model_env); } template - void field_in(pt::TextStream & stream, const wchar_t * field_name, const std::list & container, ModelEnv * model_env) + void field_in(pt::Stream & stream, const wchar_t * field_name, const std::list & container, ModelEnv * model_env) { field_in_generic>(stream, field_name, container, model_env); } template - void field_in(pt::TextStream & stream, const wchar_t * field_name, const std::vector & container, ModelEnv * model_env) + void field_in(pt::Stream & stream, const wchar_t * field_name, const std::vector & container, ModelEnv * model_env) { field_in_generic>(stream, field_name, container, model_env); } @@ -223,7 +215,7 @@ public: template - void field_to_stream(pt::TextStream & stream, const wchar_t * field_name, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env) + void field_to_stream(pt::Stream & stream, const wchar_t * field_name, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env) { this->out_stream = &stream; field(field_name, field_value, field_type, model_env); @@ -232,7 +224,7 @@ public: template - void value_to_stream(pt::TextStream & stream, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env = nullptr) + void value_to_stream(pt::Stream & stream, const FieldValue & field_value, const FT & field_type, ModelEnv * model_env = nullptr) { this->out_stream = &stream; put_field_value(field_value, field_type, model_env); @@ -260,25 +252,25 @@ public: virtual void put_stream(const pt::TextStream & str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); virtual void put_stream(const pt::WTextStream & str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); - virtual void schema_table_to_stream(pt::TextStream & stream, const wchar_t * schema_name, const wchar_t * table_name); - virtual void schema_table_to_stream(pt::TextStream & stream, const pt::WTextStream & schema_name, const pt::WTextStream & table_name); - virtual void table_to_stream(pt::TextStream & stream, const wchar_t * table_name); - virtual void table_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name); - virtual void table_with_index_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index); - virtual void table_with_index_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index); - virtual void table_with_index_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type); - virtual void table_with_index_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type); - virtual void table_and_field_to_stream(pt::TextStream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type); - virtual void table_and_field_to_stream(pt::TextStream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type); - virtual void alias_to_stream(pt::TextStream & stream, const pt::WTextStream & alias_name, int index); - virtual void alias_to_stream(pt::TextStream & stream, const pt::WTextStream & alias_name_prefix, int index, const wchar_t * alias_name_postfix); + virtual void schema_table_to_stream(pt::Stream & stream, const wchar_t * schema_name, const wchar_t * table_name); + virtual void schema_table_to_stream(pt::Stream & stream, const pt::WTextStream & schema_name, const pt::WTextStream & table_name); + virtual void table_to_stream(pt::Stream & stream, const wchar_t * table_name); + virtual void table_to_stream(pt::Stream & stream, const pt::WTextStream & table_name); + virtual void table_with_index_to_stream(pt::Stream & stream, const wchar_t * table_name, int index); + virtual void table_with_index_to_stream(pt::Stream & stream, const pt::WTextStream & table_name, int index); + virtual void table_with_index_and_field_to_stream(pt::Stream & stream, const wchar_t * table_name, int index, const wchar_t * field_name, const FT & field_type); + virtual void table_with_index_and_field_to_stream(pt::Stream & stream, const pt::WTextStream & table_name, int index, const wchar_t * field_name, const FT & field_type); + virtual void table_and_field_to_stream(pt::Stream & stream, const wchar_t * table_name, const wchar_t * field_name, const FT & field_type); + virtual void table_and_field_to_stream(pt::Stream & stream, const pt::WTextStream & table_name, const wchar_t * field_name, const FT & field_type); + virtual void alias_to_stream(pt::Stream & stream, const pt::WTextStream & alias_name, int index); + virtual void alias_to_stream(pt::Stream & stream, const pt::WTextStream & alias_name_prefix, int index, const wchar_t * alias_name_postfix); - virtual void string_to_stream(pt::TextStream & stream, const char * str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); - virtual void string_to_stream(pt::TextStream & stream, const wchar_t * str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); - virtual void string_to_stream(pt::TextStream & stream, const std::string & str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); - virtual void string_to_stream(pt::TextStream & stream, const std::wstring & str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); - virtual void stream_to_stream(pt::TextStream & stream_out, const pt::TextStream & stream_in, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); - virtual void stream_to_stream(pt::TextStream & stream_out, const pt::WTextStream & stream_in, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); + virtual void string_to_stream(pt::Stream & stream, const char * str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); + virtual void string_to_stream(pt::Stream & stream, const wchar_t * str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); + virtual void string_to_stream(pt::Stream & stream, const std::string & str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); + virtual void string_to_stream(pt::Stream & stream, const std::wstring & str, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); + virtual void stream_to_stream(pt::Stream & stream_out, const pt::TextStream & stream_in, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); + virtual void stream_to_stream(pt::Stream & stream_out, const pt::WTextStream & stream_in, const FT & field_type, bool add_quotes = false, ModelEnv * model_env = nullptr); @@ -325,36 +317,36 @@ public: * esc for: signed char, wchar_t, char16_t, char32_t * */ - virtual bool esc_char(char val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual bool esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual bool esc_char(char val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual bool esc_char(wchar_t val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(char val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(unsigned char val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(wchar_t val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(char val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(unsigned char val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(wchar_t val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const std::wstring & val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const wchar_t * val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const std::wstring & val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const wchar_t * val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const std::string & val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const char * val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const std::string & val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const char * val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(bool val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(short val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(unsigned short val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(int val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(unsigned int val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(unsigned long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(long long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(unsigned long long val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(float val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(double val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(long double val, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(bool val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(short val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(unsigned short val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(int val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(unsigned int val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(long val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(unsigned long val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(long long val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(unsigned long long val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(float val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(double val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(long double val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const pt::Date & date, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const pt::TextStream & val,pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const pt::WTextStream & val,pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); - virtual void esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const pt::Date & date, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const pt::TextStream & val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const pt::WTextStream & val, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); + virtual void esc(const pt::Space & space, pt::Stream & stream, const FT & field_type = FT::default_type, ModelEnv * model_env = nullptr); @@ -363,7 +355,7 @@ protected: int work_mode; /* what to do: generating fields list, values list or fields-values list */ int output_type; bool is_first_field; - pt::TextStream * out_stream; + pt::Stream * out_stream; bool use_prefix; pt::TextStream scratch_buffer_local; pt::TextStream * scratch_buffer; @@ -579,7 +571,7 @@ protected: // used in 'in()' statements, may should be renamed? template - void field_in_generic(pt::TextStream & stream, const wchar_t * field_name, const Container & container, ModelEnv * model_env) + void field_in_generic(pt::Stream & stream, const wchar_t * field_name, const Container & container, ModelEnv * model_env) { // IMPROVE ME // what about if container is empty? @@ -668,40 +660,40 @@ protected: * put_type for: signed char, wchar_t, char16_t, char32_t * */ -// virtual void put_type(char val, pt::TextStream & stream); -// virtual void put_type(unsigned char val, pt::TextStream & stream); +// virtual void put_type(char val, pt::Stream & stream); +// virtual void put_type(unsigned char val, pt::Stream & stream); // -// virtual void put_type(const std::wstring & val, pt::TextStream & stream); -// virtual void put_type(const wchar_t * val, pt::TextStream & stream); +// virtual void put_type(const std::wstring & val, pt::Stream & stream); +// virtual void put_type(const wchar_t * val, pt::Stream & stream); // -// virtual void put_type(const std::string & val, pt::TextStream & stream); -// virtual void put_type(const char * val, pt::TextStream & stream); +// virtual void put_type(const std::string & val, pt::Stream & stream); +// virtual void put_type(const char * val, pt::Stream & stream); // -// virtual void put_type(bool val, pt::TextStream & stream); -// virtual void put_type(short val, pt::TextStream & stream); -// virtual void put_type(unsigned short val, pt::TextStream & stream); -// virtual void put_type(int val, pt::TextStream & stream); -// virtual void put_type(unsigned int val, pt::TextStream & stream); -// virtual void put_type(long val, pt::TextStream & stream); -// virtual void put_type(unsigned long val, pt::TextStream & stream); -// virtual void put_type(long long val, pt::TextStream & stream); -// virtual void put_type(unsigned long long val, pt::TextStream & stream); -// virtual void put_type(float val, pt::TextStream & stream); -// virtual void put_type(double val, pt::TextStream & stream); -// virtual void put_type(long double val, pt::TextStream & stream); - //virtual void put_type(void* val, pt::TextStream & stream); +// virtual void put_type(bool val, pt::Stream & stream); +// virtual void put_type(short val, pt::Stream & stream); +// virtual void put_type(unsigned short val, pt::Stream & stream); +// virtual void put_type(int val, pt::Stream & stream); +// virtual void put_type(unsigned int val, pt::Stream & stream); +// virtual void put_type(long val, pt::Stream & stream); +// virtual void put_type(unsigned long val, pt::Stream & stream); +// virtual void put_type(long long val, pt::Stream & stream); +// virtual void put_type(unsigned long long val, pt::Stream & stream); +// virtual void put_type(float val, pt::Stream & stream); +// virtual void put_type(double val, pt::Stream & stream); +// virtual void put_type(long double val, pt::Stream & stream); + //virtual void put_type(void* val, pt::Stream & stream); -// virtual void put_type(const pt::Date & date, pt::TextStream & stream); -// virtual void put_type(const Model & model, pt::TextStream & stream); +// virtual void put_type(const pt::Date & date, pt::Stream & stream); +// virtual void put_type(const Model & model, pt::Stream & stream); // // template -// void put_type(const std::list & model, pt::TextStream & stream) +// void put_type(const std::list & model, pt::Stream & stream) // { // stream << "table"; // may just use std::list? // } // // template -// void put_type(const std::vector & model, pt::TextStream & stream) +// void put_type(const std::vector & model, pt::Stream & stream) // { // stream << "table"; // may just just std::vector? // } @@ -712,18 +704,18 @@ protected: virtual void after_field_value_string(const FT & field_type, ModelEnv * model_env); char char_to_hex_part(char c); - void char_to_hex(char c, pt::TextStream & stream); - void char_to_hex(wchar_t c, pt::TextStream & stream); + void char_to_hex(char c, pt::Stream & stream); + void char_to_hex(wchar_t c, pt::Stream & stream); - void esc(const wchar_t * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); - void esc(const char * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); + void esc(const wchar_t * val, bool has_known_length, size_t len, pt::Stream & stream, const FT & field_type, ModelEnv * model_env); + void esc(const char * val, bool has_known_length, size_t len, pt::Stream & stream, const FT & field_type, ModelEnv * model_env); bool is_empty_field(const wchar_t * value); template - void esc_normal_string(CharType * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) + void esc_normal_string(CharType * val, bool has_known_length, size_t len, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { for(size_t i = 0 ; has_known_length ? (i < len) : val[i] != 0 ; ++i) { @@ -733,7 +725,7 @@ protected: template - void esc_numeric_string(CharType * val, bool has_known_length, size_t len, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) + void esc_numeric_string(CharType * val, bool has_known_length, size_t len, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { bool was_comma = false; bool was_something_printed = false; diff --git a/src/csvconnector.cpp b/src/csvconnector.cpp index 85d8db3..f44bf86 100644 --- a/src/csvconnector.cpp +++ b/src/csvconnector.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2023, Tomasz Sowa + * Copyright (c) 2023-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,7 +54,7 @@ void CSVConnector::allocate_default_expression() } -void CSVConnector::to_text(pt::TextStream & stream, Model & model, Export exp) +void CSVConnector::to_text(pt::Stream & stream, Model & model, Export exp) { allocate_default_expression_if_needed(); diff --git a/src/csvconnector.h b/src/csvconnector.h index a7fc2e8..f5ddf5f 100644 --- a/src/csvconnector.h +++ b/src/csvconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2023, Tomasz Sowa + * Copyright (c) 2023-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -49,12 +49,12 @@ public: CSVConnector(); - void to_text(pt::TextStream & stream, Model & model, Export exp); + void to_text(pt::Stream & stream, Model & model, Export exp) override; protected: - void allocate_default_expression(); + void allocate_default_expression() override; }; diff --git a/src/csvexpression.cpp b/src/csvexpression.cpp index 4cdb983..0d61ded 100644 --- a/src/csvexpression.cpp +++ b/src/csvexpression.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2023, Tomasz Sowa + * Copyright (c) 2023-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -88,7 +88,7 @@ void CSVExpression::after_field_value_string(const FT & field_type, ModelEnv * m } -bool CSVExpression::esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +bool CSVExpression::esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { return pt::try_esc_to_csv(val, stream); } diff --git a/src/csvexpression.h b/src/csvexpression.h index 31fab5b..447dacc 100644 --- a/src/csvexpression.h +++ b/src/csvexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2023, Tomasz Sowa + * Copyright (c) 2023-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,18 +47,18 @@ class CSVExpression : public FlatExpression protected: - bool can_field_list_be_generated(const FT &); - void field_before(); - void after_generate_from_model(); + bool can_field_list_be_generated(const FT &) override; + void field_before() override; + void after_generate_from_model() override; - void before_field_name(); - void after_field_name(); + void before_field_name() override; + void after_field_name() override; - void before_field_value_string(const FT & field_type, ModelEnv * model_env); - void after_field_value_string(const FT & field_type, ModelEnv * model_env); + void before_field_value_string(const FT & field_type, ModelEnv * model_env) override; + void after_field_value_string(const FT & field_type, ModelEnv * model_env) override; using BaseExpression::esc; - bool esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); + bool esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) override; }; diff --git a/src/cursor.h b/src/cursor.h index f0ad6e7..e983c60 100644 --- a/src/cursor.h +++ b/src/cursor.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,6 +37,10 @@ #include "queryresult.h" #include "modelconnector.h" +#include "modeldata.h" +#include "select.h" +#include "modelenv.h" +#include "dbexpression.h" namespace morm @@ -330,9 +334,10 @@ public: } - virtual void set_cursor_name(pt::TextStream & cursor_name) + virtual void set_cursor_name(pt::Stream & cursor_name) { - this->cursor_name = cursor_name; + this->cursor_name.clear(); + this->cursor_name << cursor_name; } @@ -477,9 +482,9 @@ protected: pt::TextStream cursor_name; bool scroll_cursor; - typedef void (DbExpression::*prepare_fetch_method_type)(const pt::TextStream & cursor_name, pt::TextStream & out_stream); - typedef void (DbExpression::*prepare_fetch_long_count_method_type)(const pt::TextStream & cursor_name, long count, pt::TextStream & out_stream); - typedef void (DbExpression::*prepare_fetch_size_count_method_type)(const pt::TextStream & cursor_name, size_t count, pt::TextStream & out_stream); + typedef void (DbExpression::*prepare_fetch_method_type)(const pt::Stream & cursor_name, pt::Stream & out_stream); + typedef void (DbExpression::*prepare_fetch_long_count_method_type)(const pt::Stream & cursor_name, long count, pt::Stream & out_stream); + typedef void (DbExpression::*prepare_fetch_size_count_method_type)(const pt::Stream & cursor_name, size_t count, pt::Stream & out_stream); DbExpression * get_db_expression() diff --git a/src/dbconnector.cpp b/src/dbconnector.cpp index bd0328c..33d7ee7 100644 --- a/src/dbconnector.cpp +++ b/src/dbconnector.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,7 +79,7 @@ void DbConnector::set_log_queries(bool log_queries) } -bool DbConnector::query(const pt::TextStream & stream) +bool DbConnector::query(const pt::Stream & stream) { std::unique_ptr query_result_ptr(create_query_result()); return query(stream, *query_result_ptr); @@ -101,7 +101,7 @@ bool DbConnector::query(const char * query_str) -bool DbConnector::query(const pt::TextStream & stream, QueryResult & query_result) +bool DbConnector::query(const pt::Stream & stream, QueryResult & query_result) { std::string query_str; stream.to_str(query_str); @@ -118,7 +118,7 @@ bool DbConnector::query(const std::string & query_str, QueryResult & query_resul bool DbConnector::query(const char * query_str, QueryResult & query_result) { - // do query + // do the query return false; } @@ -151,27 +151,27 @@ bool DbConnector::query_declare_cursor(const char * query_str, QueryResult & que -bool DbConnector::query_select(const pt::TextStream & stream, QueryResult & query_result) +bool DbConnector::query_select(const pt::Stream & stream, QueryResult & query_result) { return query(stream, query_result); } -bool DbConnector::query_update(const pt::TextStream & stream, QueryResult & query_result) +bool DbConnector::query_update(const pt::Stream & stream, QueryResult & query_result) { return query(stream, query_result); } -bool DbConnector::query_insert(const pt::TextStream & stream, QueryResult & query_result) +bool DbConnector::query_insert(const pt::Stream & stream, QueryResult & query_result) { return query(stream, query_result); } -bool DbConnector::query_remove(const pt::TextStream & stream, QueryResult & query_result) +bool DbConnector::query_remove(const pt::Stream & stream, QueryResult & query_result) { return query(stream, query_result); } -bool DbConnector::query_declare_cursor(const pt::TextStream & stream, QueryResult & query_result) +bool DbConnector::query_declare_cursor(const pt::Stream & stream, QueryResult & query_result) { return query(stream, query_result); } @@ -395,7 +395,7 @@ DbExpression * DbConnector::get_expression() } -void DbConnector::generate_select_columns(pt::TextStream & stream, Model & model) +void DbConnector::generate_select_columns(pt::Stream & stream, Model & model) { allocate_default_expression_if_needed(); @@ -410,7 +410,7 @@ void DbConnector::generate_select_columns(pt::TextStream & stream, Model & model } -void DbConnector::generate_insert_query(pt::TextStream & stream, Model & model) +void DbConnector::generate_insert_query(pt::Stream & stream, Model & model) { allocate_default_expression_if_needed(); @@ -435,7 +435,7 @@ void DbConnector::generate_insert_query(pt::TextStream & stream, Model & model) } -void DbConnector::generate_update_query(pt::TextStream & stream, Model & model) +void DbConnector::generate_update_query(pt::Stream & stream, Model & model) { allocate_default_expression_if_needed(); @@ -460,7 +460,7 @@ void DbConnector::generate_update_query(pt::TextStream & stream, Model & model) } -void DbConnector::generate_remove_query(pt::TextStream & stream, Model & model) +void DbConnector::generate_remove_query(pt::Stream & stream, Model & model) { allocate_default_expression_if_needed(); @@ -480,7 +480,7 @@ void DbConnector::generate_remove_query(pt::TextStream & stream, Model & model) } -bool DbConnector::insert(pt::TextStream & stream, Model & model) +bool DbConnector::insert(pt::Stream & stream, Model & model) { std::unique_ptr query_result_ptr(create_query_result()); @@ -489,7 +489,7 @@ bool DbConnector::insert(pt::TextStream & stream, Model & model) } -bool DbConnector::update(pt::TextStream & stream, Model & model) +bool DbConnector::update(pt::Stream & stream, Model & model) { std::unique_ptr query_result_ptr(create_query_result()); @@ -498,7 +498,7 @@ bool DbConnector::update(pt::TextStream & stream, Model & model) } -bool DbConnector::remove(pt::TextStream & stream, Model & model) +bool DbConnector::remove(pt::Stream & stream, Model & model) { std::unique_ptr query_result_ptr(create_query_result()); diff --git a/src/dbconnector.h b/src/dbconnector.h index 463373a..78f0b6e 100644 --- a/src/dbconnector.h +++ b/src/dbconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ #ifndef headerfile_morm_src_dbconnector #define headerfile_morm_src_dbconnector -#include "textstream/textstream.h" +#include "textstream/stream.h" #include "log/log.h" #include "queryresult.h" #include "ft.h" @@ -63,22 +63,22 @@ public: DbExpression * get_expression(); - virtual void generate_select_columns(pt::TextStream & stream, Model & model); - virtual void generate_insert_query(pt::TextStream & stream, Model & model); - virtual void generate_update_query(pt::TextStream & stream, Model & model); - virtual void generate_remove_query(pt::TextStream & stream, Model & model); + virtual void generate_select_columns(pt::Stream & stream, Model & model); + virtual void generate_insert_query(pt::Stream & stream, Model & model); + virtual void generate_update_query(pt::Stream & stream, Model & model); + virtual void generate_remove_query(pt::Stream & stream, Model & model); - virtual bool insert(pt::TextStream & stream, Model & model); - virtual bool update(pt::TextStream & stream, Model & model); - virtual bool remove(pt::TextStream & stream, Model & model); + virtual bool insert(pt::Stream & stream, Model & model); + virtual bool update(pt::Stream & stream, Model & model); + virtual bool remove(pt::Stream & stream, Model & model); - virtual bool query(const pt::TextStream & stream); + virtual bool query(const pt::Stream & stream); virtual bool query(const std::string & query_str); virtual bool query(const char * query_str); virtual QueryResult * create_query_result() = 0; - virtual bool query(const pt::TextStream & stream, QueryResult & query_result); + virtual bool query(const pt::Stream & stream, QueryResult & query_result); virtual bool query(const std::string & query_str, QueryResult & query_result); virtual bool query(const char * query_str, QueryResult & query_result); @@ -88,11 +88,11 @@ public: virtual bool query_remove(const char * query_str, QueryResult & query_result); virtual bool query_declare_cursor(const char * query_str, QueryResult & query_result); - virtual bool query_select(const pt::TextStream & stream, QueryResult & query_result); - virtual bool query_update(const pt::TextStream & stream, QueryResult & query_result); - virtual bool query_insert(const pt::TextStream & stream, QueryResult & query_result); - virtual bool query_remove(const pt::TextStream & stream, QueryResult & query_result); - virtual bool query_declare_cursor(const pt::TextStream & stream, QueryResult & query_result); + virtual bool query_select(const pt::Stream & stream, QueryResult & query_result); + virtual bool query_update(const pt::Stream & stream, QueryResult & query_result); + virtual bool query_insert(const pt::Stream & stream, QueryResult & query_result); + virtual bool query_remove(const pt::Stream & stream, QueryResult & query_result); + virtual bool query_declare_cursor(const pt::Stream & stream, QueryResult & query_result); /* diff --git a/src/dbexpression.cpp b/src/dbexpression.cpp index f122a56..8692dbb 100644 --- a/src/dbexpression.cpp +++ b/src/dbexpression.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -290,7 +290,7 @@ void DbExpression::prepare_to_where_clause() } -DbExpression & DbExpression::group_or(pt::TextStream & stream) +DbExpression & DbExpression::group_or(pt::Stream & stream) { out_stream = &stream; field_before(); @@ -302,7 +302,7 @@ DbExpression & DbExpression::group_or(pt::TextStream & stream) return *this; } -DbExpression & DbExpression::group_and(pt::TextStream & stream) +DbExpression & DbExpression::group_and(pt::Stream & stream) { out_stream = &stream; field_before(); @@ -314,7 +314,7 @@ DbExpression & DbExpression::group_and(pt::TextStream & stream) return *this; } -DbExpression & DbExpression::group_end(pt::TextStream & stream) +DbExpression & DbExpression::group_end(pt::Stream & stream) { out_stream = &stream; @@ -330,14 +330,14 @@ DbExpression & DbExpression::group_end(pt::TextStream & stream) } -DbExpression & DbExpression::page(pt::TextStream & stream, size_t page_number, size_t page_size) +DbExpression & DbExpression::page(pt::Stream & stream, size_t page_number, size_t page_size) { stream << " LIMIT " << (page_number*page_size) << "," << page_size << " "; return *this; } -void DbExpression::generate_rows_counter_column_name(ModelEnv & model_env, pt::TextStream & str) +void DbExpression::generate_rows_counter_column_name(ModelEnv & model_env, pt::Stream & str) { str << model_env.table_name; @@ -397,7 +397,7 @@ void DbExpression::add_rows_counter_column(Model & model) -void DbExpression::prepare_declare_cursor_query(const pt::TextStream & cursor_name, bool scroll_cursor, pt::TextStream & out_stream) +void DbExpression::prepare_declare_cursor_query(const pt::Stream & cursor_name, bool scroll_cursor, pt::Stream & out_stream) { out_stream << "DECLARE " << cursor_name; @@ -408,55 +408,55 @@ void DbExpression::prepare_declare_cursor_query(const pt::TextStream & cursor_na } -void DbExpression::prepare_fetch_next_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_next_query(const pt::Stream & cursor_name, pt::Stream & out_stream) { out_stream << "FETCH NEXT FROM " << cursor_name; } -void DbExpression::prepare_fetch_prior_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_prior_query(const pt::Stream & cursor_name, pt::Stream & out_stream) { out_stream << "FETCH PRIOR FROM " << cursor_name; } -void DbExpression::prepare_fetch_first_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_first_query(const pt::Stream & cursor_name, pt::Stream & out_stream) { out_stream << "FETCH FIRST FROM " << cursor_name; } -void DbExpression::prepare_fetch_last_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_last_query(const pt::Stream & cursor_name, pt::Stream & out_stream) { out_stream << "FETCH LAST FROM " << cursor_name; } -void DbExpression::prepare_fetch_absotule_query(const pt::TextStream & cursor_name, long position, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_absotule_query(const pt::Stream & cursor_name, long position, pt::Stream & out_stream) { out_stream << "FETCH ABSOLUTE " << position << " FROM " << cursor_name; } -void DbExpression::prepare_fetch_relative_query(const pt::TextStream & cursor_name, long position, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_relative_query(const pt::Stream & cursor_name, long position, pt::Stream & out_stream) { out_stream << "FETCH RELATIVE " << position << " FROM " << cursor_name; } -void DbExpression::prepare_fetch_forward_count_query(const pt::TextStream & cursor_name, size_t len, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_forward_count_query(const pt::Stream & cursor_name, size_t len, pt::Stream & out_stream) { out_stream << "FETCH FORWARD " << len << " FROM " << cursor_name; } -void DbExpression::prepare_fetch_backward_count_query(const pt::TextStream & cursor_name, size_t len, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_backward_count_query(const pt::Stream & cursor_name, size_t len, pt::Stream & out_stream) { out_stream << "FETCH BACKWARD " << len << " FROM " << cursor_name; } -void DbExpression::prepare_fetch_all_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream) +void DbExpression::prepare_fetch_all_query(const pt::Stream & cursor_name, pt::Stream & out_stream) { out_stream << "FETCH ALL FROM " << cursor_name; } diff --git a/src/dbexpression.h b/src/dbexpression.h index af4c572..33fe6a9 100644 --- a/src/dbexpression.h +++ b/src/dbexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,14 +55,14 @@ public: virtual void prepare_to_where_clause(); - virtual DbExpression & group_or(pt::TextStream & stream); - virtual DbExpression & group_and(pt::TextStream & stream); - virtual DbExpression & group_end(pt::TextStream & stream); + virtual DbExpression & group_or(pt::Stream & stream); + virtual DbExpression & group_and(pt::Stream & stream); + virtual DbExpression & group_end(pt::Stream & stream); /* * page_number starts from zero (it's a number of a page, not an offset) */ - virtual DbExpression & page(pt::TextStream & stream, size_t page_number, size_t page_size); + virtual DbExpression & page(pt::Stream & stream, size_t page_number, size_t page_size); template void add_field_for_select(const wchar_t * new_column_expression, const wchar_t * new_column_name, FieldValue & field_value, const FT & field_type, ModelEnv * model_env) @@ -76,18 +76,18 @@ public: field(column_expression.c_str(), field_value, field_type, model_env); } - virtual void generate_rows_counter_column_name(ModelEnv & model_env, pt::TextStream & str); + virtual void generate_rows_counter_column_name(ModelEnv & model_env, pt::Stream & str); - virtual void prepare_declare_cursor_query(const pt::TextStream & cursor_name, bool scroll_cursor, pt::TextStream & out_stream); - virtual void prepare_fetch_next_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream); - virtual void prepare_fetch_prior_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream); - virtual void prepare_fetch_first_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream); - virtual void prepare_fetch_last_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream); - virtual void prepare_fetch_absotule_query(const pt::TextStream & cursor_name, long position, pt::TextStream & out_stream); - virtual void prepare_fetch_relative_query(const pt::TextStream & cursor_name, long position, pt::TextStream & out_stream); - virtual void prepare_fetch_forward_count_query(const pt::TextStream & cursor_name, size_t len, pt::TextStream & out_stream); - virtual void prepare_fetch_backward_count_query(const pt::TextStream & cursor_name, size_t len, pt::TextStream & out_stream); - virtual void prepare_fetch_all_query(const pt::TextStream & cursor_name, pt::TextStream & out_stream); + virtual void prepare_declare_cursor_query(const pt::Stream & cursor_name, bool scroll_cursor, pt::Stream & out_stream); + virtual void prepare_fetch_next_query(const pt::Stream & cursor_name, pt::Stream & out_stream); + virtual void prepare_fetch_prior_query(const pt::Stream & cursor_name, pt::Stream & out_stream); + virtual void prepare_fetch_first_query(const pt::Stream & cursor_name, pt::Stream & out_stream); + virtual void prepare_fetch_last_query(const pt::Stream & cursor_name, pt::Stream & out_stream); + virtual void prepare_fetch_absotule_query(const pt::Stream & cursor_name, long position, pt::Stream & out_stream); + virtual void prepare_fetch_relative_query(const pt::Stream & cursor_name, long position, pt::Stream & out_stream); + virtual void prepare_fetch_forward_count_query(const pt::Stream & cursor_name, size_t len, pt::Stream & out_stream); + virtual void prepare_fetch_backward_count_query(const pt::Stream & cursor_name, size_t len, pt::Stream & out_stream); + virtual void prepare_fetch_all_query(const pt::Stream & cursor_name, pt::Stream & out_stream); protected: @@ -95,30 +95,30 @@ protected: std::vector conjunctions; - bool can_field_be_generated(const FT & field_type); - void field_before(); - void put_name_value_separator(); + bool can_field_be_generated(const FT & field_type) override; + void field_before() override; + void put_name_value_separator() override; - void schema_table_separator(); - void table_field_separator(); - void alias_names_separator(); + void schema_table_separator() override; + void table_field_separator() override; + void alias_names_separator() override; - void before_schema_name(); - void after_schema_name(); + void before_schema_name() override; + void after_schema_name() override; - void before_table_name(); - void after_table_name(); + void before_table_name() override; + void after_table_name() override; - void before_field_name(); - void after_field_name(); + void before_field_name() override; + void after_field_name() override; - void before_alias_name(); - void after_alias_name(); + void before_alias_name() override; + void after_alias_name() override; - void add_additional_columns(Model & model); + void add_additional_columns(Model & model) override; - void before_field_value_string(const FT & field_type, ModelEnv * model_env); - void after_field_value_string(const FT & field_type, ModelEnv * model_env); + void before_field_value_string(const FT & field_type, ModelEnv * model_env) override; + void after_field_value_string(const FT & field_type, ModelEnv * model_env) override; virtual void add_rows_counter_column(Model & model); diff --git a/src/finder.h b/src/finder.h index fbf2182..3ef0b07 100644 --- a/src/finder.h +++ b/src/finder.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -62,7 +62,7 @@ public: } - Finder(pt::TextStream & out_stream) + Finder(pt::Stream & out_stream) { initialize(); this->out_stream = &out_stream; @@ -82,14 +82,14 @@ public: set_out_stream(); } - Finder(pt::TextStream & out_stream, ModelConnector & model_connector) + Finder(pt::Stream & out_stream, ModelConnector & model_connector) { initialize(); this->out_stream = &out_stream; this->model_connector = &model_connector; } - Finder(pt::TextStream & out_stream, ModelConnector * model_connector) + Finder(pt::Stream & out_stream, ModelConnector * model_connector) { initialize(); this->out_stream = &out_stream; @@ -110,13 +110,13 @@ public: return *this; } - Finder & set_stream(pt::TextStream * out_stream) + Finder & set_stream(pt::Stream * out_stream) { this->out_stream = out_stream; return *this; } - Finder & set_stream(pt::TextStream & out_stream) + Finder & set_stream(pt::Stream & out_stream) { this->out_stream = out_stream; return *this; @@ -734,13 +734,7 @@ public: } - Finder & raw(const pt::TextStream & sql, bool add_spaces = true) - { - return raw_generic(sql, add_spaces); - } - - - Finder & raw(const pt::WTextStream & sql, bool add_spaces = true) + Finder & raw(const pt::Stream & sql, bool add_spaces = true) { return raw_generic(sql, add_spaces); } @@ -1182,7 +1176,6 @@ public: } - template Finder & like_generic(const wchar_t * field_name, const PatternValue & pattern, bool escape_pattern, bool add_prefix_percent, bool add_postfix_percent) @@ -1513,7 +1506,7 @@ protected: } - virtual void generate_rows_counter_column_name(ModelEnv & model_env, pt::TextStream & str) + virtual void generate_rows_counter_column_name(ModelEnv & model_env, pt::Stream & str) { if( model_env.has_autogenerated_select ) { @@ -1559,7 +1552,7 @@ protected: private: - pt::TextStream * out_stream; + pt::Stream * out_stream; ModelConnector * model_connector; DbExpression * db_expression; ModelClass model; diff --git a/src/flatconnector.cpp b/src/flatconnector.cpp index d55f466..d90eea0 100644 --- a/src/flatconnector.cpp +++ b/src/flatconnector.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,7 +67,7 @@ FlatExpression * FlatConnector::get_expression() } -void FlatConnector::to_text(pt::TextStream & stream, Model & model, Export exp) +void FlatConnector::to_text(pt::Stream & stream, Model & model, Export exp) { allocate_default_expression_if_needed(); diff --git a/src/flatconnector.h b/src/flatconnector.h index eab72ab..fd82ec4 100644 --- a/src/flatconnector.h +++ b/src/flatconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,7 @@ #ifndef headerfile_morm_src_flatconnector #define headerfile_morm_src_flatconnector -#include "textstream/textstream.h" +#include "textstream/stream.h" #include "export.h" @@ -52,7 +52,7 @@ public: FlatConnector(); virtual ~FlatConnector(); - virtual void to_text(pt::TextStream & stream, Model & model, Export exp); + virtual void to_text(pt::Stream & stream, Model & model, Export exp); virtual void set_expression(FlatExpression & expression); virtual FlatExpression * get_expression(); diff --git a/src/flatexpression.h b/src/flatexpression.h index 74065eb..13159b2 100644 --- a/src/flatexpression.h +++ b/src/flatexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,8 +51,8 @@ public: protected: - bool should_field_model_be_generated_as_null(bool has_model_primary_key, const FT & field_type); - bool can_field_model_be_generated(bool has_model_primary_key, const FT & field_type); + bool should_field_model_be_generated_as_null(bool has_model_primary_key, const FT & field_type) override; + bool can_field_model_be_generated(bool has_model_primary_key, const FT & field_type) override; }; diff --git a/src/jsonconnector.h b/src/jsonconnector.h index 0ddde5b..11bbc98 100644 --- a/src/jsonconnector.h +++ b/src/jsonconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -51,7 +51,7 @@ public: protected: - void allocate_default_expression(); + void allocate_default_expression() override; }; diff --git a/src/jsonexpression.cpp b/src/jsonexpression.cpp index 8bfd16e..220a46a 100644 --- a/src/jsonexpression.cpp +++ b/src/jsonexpression.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2022, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -135,27 +135,30 @@ void JSONExpression::after_field_value_list() } -bool JSONExpression::esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +bool JSONExpression::esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { return pt::try_esc_to_json(val, stream); } -void JSONExpression::esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void JSONExpression::esc(const pt::Space & space, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { bool pretty_print = field_type.is_pretty_print(); if( field_type.is_space() ) { - pt::WTextStream tmp_stream; + pt::TextStream tmp_stream; space.serialize_to_space_stream(tmp_stream, pretty_print); BaseExpression::esc(tmp_stream, stream, field_type, model_env); } else { // when serializing as json put it directly without escaping - space.serialize_to_json_stream(stream, pretty_print); + + pt::TextStream tmp_stream; + space.serialize_to_json_stream(tmp_stream, pretty_print); + BaseExpression::esc(tmp_stream, stream, field_type, model_env); } } diff --git a/src/jsonexpression.h b/src/jsonexpression.h index 921c04d..7c0f198 100644 --- a/src/jsonexpression.h +++ b/src/jsonexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2022, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,31 +47,31 @@ class JSONExpression : public FlatExpression protected: - void before_generate_from_model(); - void after_generate_from_model(); + void before_generate_from_model() override; + void after_generate_from_model() override; - void field_before(); + void field_before() override; - void before_field_name(); - void after_field_name(); + void before_field_name() override; + void after_field_name() override; - void put_name_value_separator(); + void put_name_value_separator() override; - void before_field_value_list(); - void after_field_value_list(); + void before_field_value_list() override; + void after_field_value_list() override; - bool esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); - void esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); + bool esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) override; + void esc(const pt::Space & space, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) override; private: - void before_field_value_string(const FT & field_type, ModelEnv * model_env); - void after_field_value_string(const FT & field_type, ModelEnv * model_env); - void before_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env); - void after_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env); + void before_field_value_string(const FT & field_type, ModelEnv * model_env) override; + void after_field_value_string(const FT & field_type, ModelEnv * model_env) override; + void before_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env) override; + void after_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env) override; }; diff --git a/src/model.cpp b/src/model.cpp index 1d3f9ee..bafbfc4 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,6 +33,7 @@ */ #include "model.h" +#include "convert/text.h" #include "utf8/utf8.h" @@ -193,7 +194,7 @@ bool Model::found() } -void Model::get_table_name(pt::WTextStream & stream, bool with_schema_name, ModelData * model_data, bool clear_stream) +void Model::get_table_name(pt::Stream & stream, bool with_schema_name, ModelData * model_data, bool clear_stream) { if( clear_stream ) { @@ -347,7 +348,7 @@ bool Model::get_raw_value(const wchar_t * db_field_name, const wchar_t * flat_fi -void Model::to_text(pt::TextStream & stream, ModelData * model_data, Export exp) +void Model::to_text(pt::Stream & stream, ModelData * model_data, Export exp) { if( !exp.is_no_clear_stream() ) { @@ -385,19 +386,19 @@ void Model::to_text(pt::TextStream & stream, ModelData * model_data, Export exp) } -void Model::to_text(pt::TextStream & stream, ModelData & model_data, Export exp) +void Model::to_text(pt::Stream & stream, ModelData & model_data, Export exp) { to_text(stream, &model_data, exp); } -void Model::to_text(pt::TextStream & stream, Export exp) +void Model::to_text(pt::Stream & stream, Export exp) { to_text(stream, nullptr, exp); } -void Model::to_text(pt::TextStream & stream, ModelData * model_data, bool clear_stream, bool dump_mode) +void Model::to_text(pt::Stream & stream, ModelData * model_data, bool clear_stream, bool dump_mode) { Export exp = Export::default_type; @@ -411,13 +412,13 @@ void Model::to_text(pt::TextStream & stream, ModelData * model_data, bool clear_ } -void Model::to_text(pt::TextStream & stream, ModelData & model_data, bool clear_stream, bool dump_mode) +void Model::to_text(pt::Stream & stream, ModelData & model_data, bool clear_stream, bool dump_mode) { to_text(stream, &model_data, clear_stream, dump_mode); } -void Model::to_text(pt::TextStream & stream, bool clear_stream, bool dump_mode) +void Model::to_text(pt::Stream & stream, bool clear_stream, bool dump_mode) { to_text(stream, nullptr, clear_stream, dump_mode); } @@ -429,8 +430,8 @@ void Model::to_text(std::string & str, ModelData * model_data, bool clear_string { if( model_connector ) { - // CHECK ME what if the stream is being used by something other? - pt::TextStream * out_stream = model_connector->get_stream(); + // CHECK ME what if the stream is being used by someone else? + pt::Stream * out_stream = model_connector->get_stream(); if( out_stream ) { @@ -470,7 +471,7 @@ std::string Model::to_string() -void Model::generate_insert_query(pt::TextStream & stream, ModelData * model_data) +void Model::generate_insert_query(pt::Stream & stream, ModelData * model_data) { ModelEnv model_env_local; model_env = &model_env_local; @@ -554,7 +555,7 @@ void Model::insert_tree(bool insert_whole_tree) DbConnector * db_connector = model_connector->get_db_connector(); // CHECK ME what if the stream is being used by someone else? - pt::TextStream * out_stream = model_connector->get_stream(); + pt::Stream * out_stream = model_connector->get_stream(); if( db_connector && out_stream ) { @@ -606,7 +607,7 @@ void Model::insert_tree(bool insert_whole_tree) -void Model::generate_update_query(pt::TextStream & stream, ModelData * model_data) +void Model::generate_update_query(pt::Stream & stream, ModelData * model_data) { ModelEnv model_env_local; model_env = &model_env_local; @@ -689,7 +690,7 @@ void Model::update_tree(bool update_whole_tree) DbConnector * db_connector = model_connector->get_db_connector(); // CHECK ME what if the stream is being used by something other? - pt::TextStream * out_stream = model_connector->get_stream(); + pt::Stream * out_stream = model_connector->get_stream(); if( db_connector && out_stream ) { @@ -721,7 +722,7 @@ void Model::update_tree(bool update_whole_tree) } -void Model::generate_remove_query(pt::TextStream & stream, ModelData * model_data) +void Model::generate_remove_query(pt::Stream & stream, ModelData * model_data) { ModelEnv model_env_local; model_env = &model_env_local; @@ -805,7 +806,7 @@ void Model::remove_tree(bool remove_whole_tree) DbConnector * db_connector = model_connector->get_db_connector(); // CHECK ME what if the stream is being used by someone else? - pt::TextStream * out_stream = model_connector->get_stream(); + pt::Stream * out_stream = model_connector->get_stream(); if( db_connector && out_stream ) { @@ -935,7 +936,7 @@ void Model::save_tree(bool save_whole_tree) } -void Model::generate_select_columns(pt::TextStream & stream) +void Model::generate_select_columns(pt::Stream & stream) { if( model_connector && model_env ) { @@ -1254,7 +1255,7 @@ void Model::field_model_left_join(const wchar_t * db_field_name, Model & field_m join_tables_str << "LEFT JOIN "; - pt::TextStream * db_expression_stream = db_expression->get_text_stream(); + pt::Stream * db_expression_stream = db_expression->get_text_stream(); int expr_work_mode = db_expression->get_work_mode(); int expr_output_type = db_expression->get_output_type(); bool expr_allow_prefix = db_expression->get_allow_to_use_prefix(); @@ -1756,7 +1757,7 @@ bool Model::db_query(const std::string & raw_sql) } -bool Model::db_query(const pt::TextStream & raw_sql) +bool Model::db_query(const pt::Stream & raw_sql) { bool status = false; @@ -2076,38 +2077,34 @@ bool Model::convert_to_bool(unsigned long long v) bool Model::convert_to_bool(float v) { - return v != 0; + return v != 0.0F; } bool Model::convert_to_bool(double v) { - return v != 0; + return v != 0.0; } bool Model::convert_to_bool(long double v) { - return v != 0; + return v != 0.0L; } bool Model::convert_to_bool(const pt::Date & date) { + // may return true if the date is not the Unix epoch? return false; } -bool Model::convert_to_bool(const pt::TextStream & val) +bool Model::convert_to_bool(const pt::Stream & val) { - return false; -} - -bool Model::convert_to_bool(const pt::WTextStream & val) -{ - return false; + return !val.empty(); } bool Model::convert_to_bool(const pt::Space & space) { - return false; + return space.to_bool(); } diff --git a/src/model.h b/src/model.h index 6a15b03..4a4542a 100644 --- a/src/model.h +++ b/src/model.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -173,17 +173,17 @@ public: void set_connector(ModelConnector * connector); ModelConnector * get_connector(); - virtual void get_table_name(pt::WTextStream & stream, bool with_schema_name = true, ModelData * model_data = nullptr, bool clear_stream = true); + virtual void get_table_name(pt::Stream & stream, bool with_schema_name = true, ModelData * model_data = nullptr, bool clear_stream = true); virtual void get_table_name(std::wstring & str, bool with_schema_name = true, ModelData * model_data = nullptr, bool clear_string = true); virtual void get_table_name(std::string & str, bool with_schema_name = true, ModelData * model_data = nullptr, bool clear_string = true); - virtual void to_text(pt::TextStream & stream, ModelData * model_data, Export exp = Export::default_type); - virtual void to_text(pt::TextStream & stream, ModelData & model_data, Export exp = Export::default_type); - virtual void to_text(pt::TextStream & stream, Export exp = Export::default_type); + virtual void to_text(pt::Stream & stream, ModelData * model_data, Export exp = Export::default_type); + virtual void to_text(pt::Stream & stream, ModelData & model_data, Export exp = Export::default_type); + virtual void to_text(pt::Stream & stream, Export exp = Export::default_type); - virtual void to_text(pt::TextStream & stream, ModelData * model_data, bool clear_stream, bool dump_mode); - virtual void to_text(pt::TextStream & stream, ModelData & model_data, bool clear_stream, bool dump_mode); - virtual void to_text(pt::TextStream & stream, bool clear_stream, bool dump_mode); + virtual void to_text(pt::Stream & stream, ModelData * model_data, bool clear_stream, bool dump_mode); + virtual void to_text(pt::Stream & stream, ModelData & model_data, bool clear_stream, bool dump_mode); + virtual void to_text(pt::Stream & stream, bool clear_stream, bool dump_mode); virtual void to_text(std::string & str, ModelData * model_data, bool clear_string = true, bool dump_mode = false); virtual void to_text(std::string & str, ModelData & model_data, bool clear_string = true, bool dump_mode = false); @@ -192,17 +192,17 @@ public: virtual std::string to_text(); virtual std::string to_string(); - virtual void generate_insert_query(pt::TextStream & stream, ModelData * model_data = nullptr); + virtual void generate_insert_query(pt::Stream & stream, ModelData * model_data = nullptr); virtual bool insert(ModelData * model_data, bool insert_whole_tree = true); virtual bool insert(ModelData & model_data, bool insert_whole_tree = true); virtual bool insert(bool insert_whole_tree = true); - virtual void generate_update_query(pt::TextStream & stream, ModelData * model_data = nullptr); + virtual void generate_update_query(pt::Stream & stream, ModelData * model_data = nullptr); virtual bool update(ModelData * model_data, bool update_whole_tree = true); virtual bool update(ModelData & model_data, bool update_whole_tree = true); virtual bool update(bool update_whole_tree = true); - virtual void generate_remove_query(pt::TextStream & stream, ModelData * model_data = nullptr); + virtual void generate_remove_query(pt::Stream & stream, ModelData * model_data = nullptr); virtual bool remove(ModelData * model_data, bool remove_whole_tree = true); virtual bool remove(ModelData & model_data, bool remove_whole_tree = true); virtual bool remove(bool remove_whole_tree = true); @@ -212,7 +212,7 @@ public: virtual bool save(bool save_whole_tree = true); - virtual void generate_select_columns(pt::TextStream & stream); + virtual void generate_select_columns(pt::Stream & stream); // set object to default values virtual void clear(); @@ -359,7 +359,7 @@ protected: virtual bool db_query(const char * raw_sql); virtual bool db_query(const std::string & raw_sql); - virtual bool db_query(const pt::TextStream & raw_sql); + virtual bool db_query(const pt::Stream & raw_sql); virtual bool db_query(const char ** raw_sql, size_t len); @@ -1646,8 +1646,7 @@ protected: virtual bool convert_to_bool(double v); virtual bool convert_to_bool(long double v); virtual bool convert_to_bool(const pt::Date & date); - virtual bool convert_to_bool(const pt::TextStream & val); - virtual bool convert_to_bool(const pt::WTextStream & val); + virtual bool convert_to_bool(const pt::Stream & val); virtual bool convert_to_bool(const pt::Space & space); diff --git a/src/modelconnector.cpp b/src/modelconnector.cpp index 9c7a2fa..b788a55 100644 --- a/src/modelconnector.cpp +++ b/src/modelconnector.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2019, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -133,14 +133,14 @@ void ModelConnector::allocate_default_clearer_if_needed() } -void ModelConnector::set_stream(pt::TextStream & stream) +void ModelConnector::set_stream(pt::Stream & stream) { deallocate_stream(); this->out_stream = &stream; } -pt::TextStream * ModelConnector::get_stream() +pt::Stream * ModelConnector::get_stream() { allocate_default_stream_if_needed(); return out_stream; diff --git a/src/modelconnector.h b/src/modelconnector.h index 768560a..9fe28d8 100644 --- a/src/modelconnector.h +++ b/src/modelconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2019, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -64,8 +64,8 @@ public: virtual pt::Log * get_logger(); - virtual void set_stream(pt::TextStream & stream); - virtual pt::TextStream * get_stream(); + virtual void set_stream(pt::Stream & stream); + virtual pt::Stream * get_stream(); virtual void set_flat_connector(FlatConnector & flat_connector); virtual FlatConnector * get_flat_connector(); @@ -85,7 +85,7 @@ protected: FlatConnector * flat_connector; DbConnector * db_connector; - pt::TextStream * out_stream; // IMPROVE ME give here an interface to the base stream (implement him) + pt::Stream * out_stream; bool out_stream_allocated; Clearer * clearer; diff --git a/src/modelenv.h b/src/modelenv.h index f40aad1..52f071b 100644 --- a/src/modelenv.h +++ b/src/modelenv.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2019-2022, Tomasz Sowa + * Copyright (c) 2019-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,10 +44,6 @@ #include "select.h" -#ifdef MORM_HAS_EZC_LIBRARY -#include "funinfo.h" -#endif - namespace morm { diff --git a/src/postgresqlconnector.cpp b/src/postgresqlconnector.cpp index 9555b39..9e696d8 100644 --- a/src/postgresqlconnector.cpp +++ b/src/postgresqlconnector.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -194,7 +194,7 @@ const char * PostgreSQLConnector::query_last_sequence(const wchar_t * sequence_t -bool PostgreSQLConnector::query(const pt::TextStream & stream, QueryResult & query_result) +bool PostgreSQLConnector::query(const pt::Stream & stream, QueryResult & query_result) { stream.to_str(query_str); return query(query_str.c_str(), query_result); @@ -248,31 +248,31 @@ bool PostgreSQLConnector::query_declare_cursor(const char * query_str, QueryResu } -bool PostgreSQLConnector::query_select(const pt::TextStream & stream, QueryResult & query_result) +bool PostgreSQLConnector::query_select(const pt::Stream & stream, QueryResult & query_result) { stream.to_str(query_str); return query_select(query_str.c_str(), query_result); } -bool PostgreSQLConnector::query_update(const pt::TextStream & stream, QueryResult & query_result) +bool PostgreSQLConnector::query_update(const pt::Stream & stream, QueryResult & query_result) { stream.to_str(query_str); return query_update(query_str.c_str(), query_result); } -bool PostgreSQLConnector::query_insert(const pt::TextStream & stream, QueryResult & query_result) +bool PostgreSQLConnector::query_insert(const pt::Stream & stream, QueryResult & query_result) { stream.to_str(query_str); return query_insert(query_str.c_str(), query_result); } -bool PostgreSQLConnector::query_remove(const pt::TextStream & stream, QueryResult & query_result) +bool PostgreSQLConnector::query_remove(const pt::Stream & stream, QueryResult & query_result) { stream.to_str(query_str); return query_remove(query_str.c_str(), query_result); } -bool PostgreSQLConnector::query_declare_cursor(const pt::TextStream & stream, QueryResult & query_result) +bool PostgreSQLConnector::query_declare_cursor(const pt::Stream & stream, QueryResult & query_result) { stream.to_str(query_str); return query_declare_cursor(query_str.c_str(), query_result); @@ -425,6 +425,17 @@ void PostgreSQLConnector::overwrite(pt::TextStream & stream) } +void PostgreSQLConnector::overwrite(pt::WTextStream & stream) +{ + pt::WTextStream::iterator i = stream.begin(); + + for( ; i != stream.end() ; ++i) + { + *i = 0; + } + + stream.clear(); +} void PostgreSQLConnector::connect() diff --git a/src/postgresqlconnector.h b/src/postgresqlconnector.h index d0c1e97..04045cb 100644 --- a/src/postgresqlconnector.h +++ b/src/postgresqlconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2023, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -55,21 +55,21 @@ public: virtual ~PostgreSQLConnector(); - bool query(const pt::TextStream & stream, QueryResult & query_result); - bool query(const char * query_str, QueryResult & query_result); - bool query(const std::string & query_str, QueryResult & query_result); + bool query(const pt::Stream & stream, QueryResult & query_result) override; + bool query(const char * query_str, QueryResult & query_result) override; + bool query(const std::string & query_str, QueryResult & query_result) override; - bool query_select(const char * query_str, QueryResult & query_result); - bool query_update(const char * query_str, QueryResult & query_result); - bool query_insert(const char * query_str, QueryResult & query_result); - bool query_remove(const char * query_str, QueryResult & query_result); - bool query_declare_cursor(const char * query_str, QueryResult & query_result); + bool query_select(const char * query_str, QueryResult & query_result) override; + bool query_update(const char * query_str, QueryResult & query_result) override; + bool query_insert(const char * query_str, QueryResult & query_result) override; + bool query_remove(const char * query_str, QueryResult & query_result) override; + bool query_declare_cursor(const char * query_str, QueryResult & query_result) override; - bool query_select(const pt::TextStream & stream, QueryResult & query_result); - bool query_update(const pt::TextStream & stream, QueryResult & query_result); - bool query_insert(const pt::TextStream & stream, QueryResult & query_result); - bool query_remove(const pt::TextStream & stream, QueryResult & query_result); - bool query_declare_cursor(const pt::TextStream & stream, QueryResult & query_result); + bool query_select(const pt::Stream & stream, QueryResult & query_result) override; + bool query_update(const pt::Stream & stream, QueryResult & query_result) override; + bool query_insert(const pt::Stream & stream, QueryResult & query_result) override; + bool query_remove(const pt::Stream & stream, QueryResult & query_result) override; + bool query_declare_cursor(const pt::Stream & stream, QueryResult & query_result) override; /* * https://www.postgresql.org/docs/14/libpq-connect.html#LIBPQ-CONNSTRING @@ -147,18 +147,19 @@ protected: virtual bool do_query(const char * query_str, PostgreSQLQueryResult * psql_result); virtual bool query_command(const char * query_str, QueryResult & query_result, ExecStatusType expected_status); - virtual void allocate_default_expression(); + virtual void allocate_default_expression() override; virtual void overwrite(pt::TextStream & stream); - virtual const char * query_last_sequence(const wchar_t * sequence_table_name); - virtual QueryResult * create_query_result(); + virtual void overwrite(pt::WTextStream & stream); + virtual const char * query_last_sequence(const wchar_t * sequence_table_name) override; + virtual QueryResult * create_query_result() override; void log_unsupported_bin_format(); - void unescape_bin_char(const char * str, char & field_value); - void unescape_bin_char(const char * str, wchar_t & field_value); + void unescape_bin_char(const char * str, char & field_value) override; + void unescape_bin_char(const char * str, wchar_t & field_value) override; - void unescape_bin_string(const char * str, std::string & out); - void unescape_bin_string(const char * str, std::wstring & out); + void unescape_bin_string(const char * str, std::string & out) override; + void unescape_bin_string(const char * str, std::wstring & out) override; }; diff --git a/src/postgresqlexpression.cpp b/src/postgresqlexpression.cpp index a839d4b..c42d9c9 100644 --- a/src/postgresqlexpression.cpp +++ b/src/postgresqlexpression.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2022, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,7 +74,7 @@ void PostgreSQLExpression::after_field_value_string(const FT & field_type, Model } -bool PostgreSQLExpression::esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +bool PostgreSQLExpression::esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { if( model_env && model_env->use_escaping_for_like ) { @@ -119,7 +119,7 @@ bool PostgreSQLExpression::esc_char(wchar_t val, pt::TextStream & stream, const } -DbExpression & PostgreSQLExpression::page(pt::TextStream & stream, size_t page_number, size_t page_size) +DbExpression & PostgreSQLExpression::page(pt::Stream & stream, size_t page_number, size_t page_size) { stream << " OFFSET " << (page_number*page_size) << " LIMIT " << page_size << " "; return *this; diff --git a/src/postgresqlexpression.h b/src/postgresqlexpression.h index 0fa3a36..3f9c675 100644 --- a/src/postgresqlexpression.h +++ b/src/postgresqlexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2018-2022, Tomasz Sowa + * Copyright (c) 2018-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,7 @@ class PostgreSQLExpression : public DbExpression { public: - DbExpression & page(pt::TextStream & stream, size_t page_number, size_t page_size); + DbExpression & page(pt::Stream & stream, size_t page_number, size_t page_size) override; protected: @@ -55,10 +55,10 @@ protected: private: - void before_field_value_string(const FT & field_type, ModelEnv * model_env); - void after_field_value_string(const FT & field_type, ModelEnv * model_env); + void before_field_value_string(const FT & field_type, ModelEnv * model_env) override; + void after_field_value_string(const FT & field_type, ModelEnv * model_env) override; - bool esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); + bool esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) override; }; diff --git a/src/xmlconnector.cpp b/src/xmlconnector.cpp index bdab448..4eee2bf 100644 --- a/src/xmlconnector.cpp +++ b/src/xmlconnector.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2022-2023, Tomasz Sowa + * Copyright (c) 2022-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -100,7 +100,7 @@ void XMLConnector::allocate_default_expression() } -void XMLConnector::to_text(pt::TextStream & stream, Model & model, Export exp) +void XMLConnector::to_text(pt::Stream & stream, Model & model, Export exp) { allocate_default_expression_if_needed(); @@ -118,7 +118,7 @@ void XMLConnector::to_text(pt::TextStream & stream, Model & model, Export exp) } -void XMLConnector::put_doctype_definition(pt::TextStream & stream) +void XMLConnector::put_doctype_definition(pt::Stream & stream) { if( put_doctype ) { @@ -127,7 +127,7 @@ void XMLConnector::put_doctype_definition(pt::TextStream & stream) } -void XMLConnector::put_opening_root_element(pt::TextStream & stream) +void XMLConnector::put_opening_root_element(pt::Stream & stream) { if( put_root_element ) { @@ -138,7 +138,7 @@ void XMLConnector::put_opening_root_element(pt::TextStream & stream) } -void XMLConnector::put_closing_root_element(pt::TextStream & stream) +void XMLConnector::put_closing_root_element(pt::Stream & stream) { if( put_root_element ) { @@ -149,7 +149,7 @@ void XMLConnector::put_closing_root_element(pt::TextStream & stream) } -void XMLConnector::put_root_element_name(pt::TextStream & stream) +void XMLConnector::put_root_element_name(pt::Stream & stream) { if( root_element_name.empty() ) { diff --git a/src/xmlconnector.h b/src/xmlconnector.h index bbeab41..5f54554 100644 --- a/src/xmlconnector.h +++ b/src/xmlconnector.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2022-2023, Tomasz Sowa + * Copyright (c) 2022-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -57,7 +57,7 @@ public: virtual void set_root_element(const std::wstring & root_name); virtual std::wstring & get_root_element(); - void to_text(pt::TextStream & stream, Model & model, Export exp); + void to_text(pt::Stream & stream, Model & model, Export exp) override; protected: @@ -66,12 +66,12 @@ protected: bool put_root_element; std::wstring root_element_name; - void allocate_default_expression(); + void allocate_default_expression() override; - virtual void put_doctype_definition(pt::TextStream & stream); - virtual void put_opening_root_element(pt::TextStream & stream); - virtual void put_closing_root_element(pt::TextStream & stream); - virtual void put_root_element_name(pt::TextStream & stream); + virtual void put_doctype_definition(pt::Stream & stream); + virtual void put_opening_root_element(pt::Stream & stream); + virtual void put_closing_root_element(pt::Stream & stream); + virtual void put_root_element_name(pt::Stream & stream); }; diff --git a/src/xmlexpression.cpp b/src/xmlexpression.cpp index d100b49..07ae13f 100644 --- a/src/xmlexpression.cpp +++ b/src/xmlexpression.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2022-2023, Tomasz Sowa + * Copyright (c) 2022-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -93,14 +93,13 @@ void XMLExpression::put_name_value_separator() } -bool XMLExpression::esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +bool XMLExpression::esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { return pt::try_esc_to_xml(val, stream); } - -void XMLExpression::esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env) +void XMLExpression::esc(const pt::Space & space, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) { bool pretty_print = field_type.is_pretty_print(); diff --git a/src/xmlexpression.h b/src/xmlexpression.h index 8f9aaf7..695778e 100644 --- a/src/xmlexpression.h +++ b/src/xmlexpression.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2022-2023, Tomasz Sowa + * Copyright (c) 2022-2024, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -47,27 +47,27 @@ class XMLExpression : public FlatExpression protected: - void put_field_closing_name(const wchar_t * field_name, const FT & field_type, ModelEnv * model_env); + void put_field_closing_name(const wchar_t * field_name, const FT & field_type, ModelEnv * model_env) override; - void before_field_name(); - void after_field_name(); + void before_field_name() override; + void after_field_name() override; - void put_name_value_separator(); + void put_name_value_separator() override; using BaseExpression::esc; - bool esc_char(wchar_t val, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); - void esc(const pt::Space & space, pt::TextStream & stream, const FT & field_type, ModelEnv * model_env); + bool esc_char(wchar_t val, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) override; + void esc(const pt::Space & space, pt::Stream & stream, const FT & field_type, ModelEnv * model_env) override; private: - void before_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env); - void after_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env); + void before_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env) override; + void after_field_value(const pt::Space &, const FT & field_type, ModelEnv * model_env) override; - void put_value_list_opening_index(size_t index, const FT & field_type); - void put_value_list_closing_index(size_t index, const FT & field_type); + void put_value_list_opening_index(size_t index, const FT & field_type) override; + void put_value_list_closing_index(size_t index, const FT & field_type) override; - void field_value_list_separator(); + void field_value_list_separator() override; };