removed: doc functionality (generating documentation from a model)
we can use our own class (based on FlatConnector and FlatExpression) to generate documentation git-svn-id: svn://ttmath.org/publicrep/morm/trunk@1213 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
bb3f69fe8d
commit
a5d5a81a57
|
@ -17,8 +17,7 @@ main.o: ../../morm/src/cursorhelper.h ../../morm/src/finderhelper.h
|
||||||
main.o: ../../morm/src/fieldvaluehelper.h ../../morm/src/flatexpression.h
|
main.o: ../../morm/src/fieldvaluehelper.h ../../morm/src/flatexpression.h
|
||||||
main.o: ../../morm/src/finder.h ../../pikotools/utf8/utf8.h
|
main.o: ../../morm/src/finder.h ../../pikotools/utf8/utf8.h
|
||||||
main.o: ../../morm/src/cursor.h ../../morm/src/jsonexpression.h
|
main.o: ../../morm/src/cursor.h ../../morm/src/jsonexpression.h
|
||||||
main.o: ../../morm/src/postgresqlexpression.h
|
main.o: ../../morm/src/postgresqlexpression.h ../../morm/src/jsonconnector.h
|
||||||
main.o: ../../morm/src/dochtmlexpression.h ../../morm/src/jsonconnector.h
|
|
||||||
main.o: ../../morm/src/postgresqlconnector.h
|
main.o: ../../morm/src/postgresqlconnector.h
|
||||||
main.o: ../../morm/src/postgresqlqueryresult.h
|
main.o: ../../morm/src/postgresqlqueryresult.h person.h language.h
|
||||||
main.o: ../../morm/src/dochtmlconnector.h person.h language.h attachment.h
|
main.o: attachment.h
|
||||||
|
|
|
@ -48,29 +48,6 @@ dbexpression.o: ../../pikotools/textstream/types.h morm_types.h modelenv.h
|
||||||
dbexpression.o: modeldata.h cursorhelper.h queryresult.h
|
dbexpression.o: modeldata.h cursorhelper.h queryresult.h
|
||||||
dbexpression.o: ../../pikotools/log/log.h ../../pikotools/log/filelog.h
|
dbexpression.o: ../../pikotools/log/log.h ../../pikotools/log/filelog.h
|
||||||
dbexpression.o: finderhelper.h fieldvaluehelper.h
|
dbexpression.o: finderhelper.h fieldvaluehelper.h
|
||||||
dochtmlconnector.o: dochtmlconnector.h flatconnector.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/textstream/textstream.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/space/space.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/textstream/types.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/date/date.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/convert/inttostr.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/membuffer/membuffer.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/textstream/types.h dochtmlexpression.h
|
|
||||||
dochtmlconnector.o: flatexpression.h baseexpression.h morm_types.h modelenv.h
|
|
||||||
dochtmlconnector.o: modeldata.h cursorhelper.h queryresult.h
|
|
||||||
dochtmlconnector.o: ../../pikotools/log/log.h ../../pikotools/log/filelog.h
|
|
||||||
dochtmlconnector.o: finderhelper.h fieldvaluehelper.h
|
|
||||||
dochtmlexpression.o: dochtmlexpression.h flatexpression.h baseexpression.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/textstream/textstream.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/space/space.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/textstream/types.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/date/date.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/convert/inttostr.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/membuffer/membuffer.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/textstream/types.h morm_types.h
|
|
||||||
dochtmlexpression.o: modelenv.h modeldata.h cursorhelper.h queryresult.h
|
|
||||||
dochtmlexpression.o: ../../pikotools/log/log.h ../../pikotools/log/filelog.h
|
|
||||||
dochtmlexpression.o: finderhelper.h fieldvaluehelper.h
|
|
||||||
flatconnector.o: flatconnector.h ../../pikotools/textstream/textstream.h
|
flatconnector.o: flatconnector.h ../../pikotools/textstream/textstream.h
|
||||||
flatconnector.o: ../../pikotools/space/space.h
|
flatconnector.o: ../../pikotools/space/space.h
|
||||||
flatconnector.o: ../../pikotools/textstream/types.h
|
flatconnector.o: ../../pikotools/textstream/types.h
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
o = baseexpression.o clearer.o dbconnector.o dbexpression.o dochtmlconnector.o dochtmlexpression.o flatconnector.o flatexpression.o jsonconnector.o jsonexpression.o model.o modelconnector.o postgresqlconnector.o postgresqlexpression.o postgresqlqueryresult.o queryresult.o
|
o = baseexpression.o clearer.o dbconnector.o dbexpression.o flatconnector.o flatexpression.o jsonconnector.o jsonexpression.o model.o modelconnector.o postgresqlconnector.o postgresqlexpression.o postgresqlqueryresult.o queryresult.o
|
|
@ -122,19 +122,6 @@ void BaseExpression::dump_additional_info(Model & model)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
void BaseExpression::put_field_doc(void * pointer)
|
|
||||||
{
|
|
||||||
if( out_stream )
|
|
||||||
{
|
|
||||||
before_generate_from_model();
|
|
||||||
model.doc_field_pointer = pointer;
|
|
||||||
model.map_doc_fields();
|
|
||||||
after_generate_from_model();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void BaseExpression::before_generate_from_model()
|
void BaseExpression::before_generate_from_model()
|
||||||
{
|
{
|
||||||
is_first_field = true;
|
is_first_field = true;
|
||||||
|
@ -265,14 +252,6 @@ void BaseExpression::save_foreign_key(const wchar_t * field_name, ModelEnv * mod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseExpression::put_field_doc(Model & model, const void * field_pointer, bool insertable, bool updatable, bool is_primary_key, ModelEnv * model_env)
|
|
||||||
{
|
|
||||||
//model.doc_field_pointer = field_pointer;
|
|
||||||
model.model_env = model_env;
|
|
||||||
model.map_doc_fields();
|
|
||||||
model.model_env = nullptr;
|
|
||||||
//model.doc_field_pointer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseExpression::before_field_name()
|
void BaseExpression::before_field_name()
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,9 +70,6 @@ public:
|
||||||
virtual void allow_to_use_prefix(bool use_prefix);
|
virtual void allow_to_use_prefix(bool use_prefix);
|
||||||
virtual bool get_allow_to_use_prefix();
|
virtual bool get_allow_to_use_prefix();
|
||||||
|
|
||||||
// give me a better name
|
|
||||||
virtual void put_field_doc(Model & model, const void * field_pointer, bool insertable, bool updatable, bool is_primary_key, ModelEnv * model_env);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename FieldValue>
|
template<typename FieldValue>
|
||||||
|
@ -124,27 +121,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename FieldValue>
|
|
||||||
void field_doc(Model & model, const wchar_t * field_name, const FieldValue & field_value, bool insertable, bool updatable, bool is_primary_key, ModelEnv * model_env)
|
|
||||||
{
|
|
||||||
if( out_stream )
|
|
||||||
{
|
|
||||||
field_before();
|
|
||||||
|
|
||||||
put_field_name(field_name, model_env);
|
|
||||||
put_name_value_separator();
|
|
||||||
|
|
||||||
put_field_doc(model, reinterpret_cast<const void*>(&field_value), insertable, updatable, is_primary_key, model_env);
|
|
||||||
put_name_value_separator();
|
|
||||||
|
|
||||||
put_type(field_value, *out_stream);
|
|
||||||
|
|
||||||
field_after();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename FieldValue>
|
template<typename FieldValue>
|
||||||
void field_in(PT::TextStream & stream, const wchar_t * field_name, const std::set<FieldValue> & container, ModelEnv * model_env)
|
void field_in(PT::TextStream & stream, const wchar_t * field_name, const std::set<FieldValue> & container, ModelEnv * model_env)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is a part of morm
|
|
||||||
* and is distributed under the 2-Clause BSD licence.
|
|
||||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "dochtmlconnector.h"
|
|
||||||
#include "dochtmlexpression.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace morm
|
|
||||||
{
|
|
||||||
|
|
||||||
void DocHtmlConnector::allocate_default_expression()
|
|
||||||
{
|
|
||||||
deallocate_expression();
|
|
||||||
flat_expression = new DocHtmlExpression();
|
|
||||||
expression_allocated = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DocHtmlConnector::to_text(PT::TextStream & stream, Model & model)
|
|
||||||
{
|
|
||||||
allocate_default_expression_if_needed();
|
|
||||||
|
|
||||||
if( flat_expression )
|
|
||||||
{
|
|
||||||
// flat_expression->set_work_mode(MORM_WORK_MODE_MODEL_FIELDS);
|
|
||||||
|
|
||||||
stream << "<tr><th>Name</th><th>Description</th><th>Type</th></tr>\n";
|
|
||||||
|
|
||||||
flat_expression->generate_from_model(stream, model);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is a part of morm
|
|
||||||
* and is distributed under the 2-Clause BSD licence.
|
|
||||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_morm_dochtmlconnector
|
|
||||||
#define headerfile_morm_dochtmlconnector
|
|
||||||
|
|
||||||
#include "flatconnector.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace morm
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class DocHtmlConnector : public FlatConnector
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
void to_text(PT::TextStream & stream, Model & model);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void allocate_default_expression();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is a part of morm
|
|
||||||
* and is distributed under the 2-Clause BSD licence.
|
|
||||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dochtmlexpression.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace morm
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DocHtmlExpression::field_before()
|
|
||||||
{
|
|
||||||
(*out_stream) << "<tr><td>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DocHtmlExpression::field_after()
|
|
||||||
{
|
|
||||||
(*out_stream) << "</td></tr>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DocHtmlExpression::put_name_value_separator()
|
|
||||||
{
|
|
||||||
(*out_stream) << "</td><td>";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is a part of morm
|
|
||||||
* and is distributed under the 2-Clause BSD licence.
|
|
||||||
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef headerfile_morm_dochtmlexpression
|
|
||||||
#define headerfile_morm_dochtmlexpression
|
|
||||||
|
|
||||||
#include "flatexpression.h"
|
|
||||||
|
|
||||||
|
|
||||||
namespace morm
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
class DocHtmlExpression : public FlatExpression
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual void field_before();
|
|
||||||
virtual void field_after();
|
|
||||||
|
|
||||||
|
|
||||||
void put_name_value_separator();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -579,50 +579,6 @@ void Model::generate_select_columns(PT::TextStream & stream)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Model::generate_doc_for_flat(PT::TextStream & stream, bool clear_stream)
|
|
||||||
{
|
|
||||||
if( clear_stream )
|
|
||||||
{
|
|
||||||
stream.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
model_env->model_work_mode = MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_FLAT;
|
|
||||||
|
|
||||||
if( model_connector )
|
|
||||||
{
|
|
||||||
FlatConnector * flat_connector = model_connector->get_doc_connector(); // different connector will be here
|
|
||||||
|
|
||||||
if( flat_connector )
|
|
||||||
{
|
|
||||||
flat_connector->to_text(stream, *this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model_env->model_work_mode = MORM_MODEL_WORK_MODE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Model::generate_doc_for_db(PT::TextStream & stream, bool clear_stream)
|
|
||||||
{
|
|
||||||
if( clear_stream )
|
|
||||||
{
|
|
||||||
stream.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
model_env->model_work_mode = MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_DB;
|
|
||||||
|
|
||||||
if( model_connector )
|
|
||||||
{
|
|
||||||
FlatConnector * flat_connector = model_connector->get_doc_connector(); // different connector will be here
|
|
||||||
|
|
||||||
if( flat_connector )
|
|
||||||
{
|
|
||||||
flat_connector->to_text(stream, *this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
model_env->model_work_mode = MORM_MODEL_WORK_MODE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Model::map_values_from_query()
|
void Model::map_values_from_query()
|
||||||
|
|
371
src/model.h
371
src/model.h
|
@ -86,7 +86,6 @@ public:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
virtual void map_fields() = 0;
|
virtual void map_fields() = 0;
|
||||||
virtual void map_doc_fields() {} ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,9 +125,6 @@ public:
|
||||||
|
|
||||||
virtual void generate_select_columns(PT::TextStream & stream);
|
virtual void generate_select_columns(PT::TextStream & stream);
|
||||||
|
|
||||||
virtual void generate_doc_for_flat(PT::TextStream & stream, bool clear_stream = true);
|
|
||||||
virtual void generate_doc_for_db(PT::TextStream & stream, bool clear_stream = true);
|
|
||||||
|
|
||||||
// set object to default values
|
// set object to default values
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
|
@ -441,234 +437,6 @@ protected:
|
||||||
field_list(db_field_name, flat_field_name, field_value, list_model_null_pointer, insertable, updatable);
|
field_list(db_field_name, flat_field_name, field_value, list_model_null_pointer, insertable, updatable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
void doc(const wchar_t * field_name, char & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, unsigned char & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, std::wstring & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// void doc(const wchar_t * field_name, wchar_t * field_value)
|
|
||||||
// {
|
|
||||||
// doc_field_generic(field_name, field_name, field_value);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, std::string & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// void doc(const wchar_t * field_name, char * field_value)
|
|
||||||
// {
|
|
||||||
// doc_field_generic(field_name, field_name, field_value);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, bool & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, short & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, unsigned short & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, int & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, unsigned int & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, unsigned long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, long long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, unsigned long long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, float & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, double & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, long double & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// void doc(const wchar_t * field_name, void * field_value)
|
|
||||||
// {
|
|
||||||
// doc_field_generic(field_name, field_name, field_value);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, PT::Date & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * field_name, Model & field_value)
|
|
||||||
{
|
|
||||||
doc_field_model(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ModelClass>
|
|
||||||
void doc(const wchar_t * field_name, std::list<ModelClass> & field_value)
|
|
||||||
{
|
|
||||||
doc_field_list(field_name, field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, char & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, unsigned char & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, std::wstring & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, wchar_t * field_value)
|
|
||||||
// {
|
|
||||||
// doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, std::string & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, char * field_value)
|
|
||||||
// {
|
|
||||||
// doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, bool & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, short & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, unsigned short & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, int & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, unsigned int & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, unsigned long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, long long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, unsigned long long & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, float & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, double & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, long double & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, void * field_value)
|
|
||||||
// {
|
|
||||||
// doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
// }
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, PT::Date & field_value)
|
|
||||||
{
|
|
||||||
doc_field_generic(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, Model & field_value)
|
|
||||||
{
|
|
||||||
doc_field_model(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename ModelClass>
|
|
||||||
void doc(const wchar_t * db_field_name, const wchar_t * flat_field_name, std::list<ModelClass> & field_value)
|
|
||||||
{
|
|
||||||
doc_field_list(db_field_name, flat_field_name, field_value);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -800,25 +568,6 @@ protected:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// will be changed
|
|
||||||
template<typename FieldValue>
|
|
||||||
void field_generic_generate_doc_for_flat(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, bool insertable, bool updatable, bool is_primary_key)
|
|
||||||
{
|
|
||||||
FlatConnector * doc_connector = model_connector->get_doc_connector(); // different connector will be here (doc, flat)
|
|
||||||
|
|
||||||
if( doc_connector )
|
|
||||||
{
|
|
||||||
FlatExpression * doc_expression = doc_connector->get_expression();
|
|
||||||
|
|
||||||
// potrzebujemy dwa rozne doce, jeden dla flat drugi dla bazy danych
|
|
||||||
if( doc_expression && !is_empty_field(flat_field_name) )
|
|
||||||
{
|
|
||||||
// insertable, updatable and is_primary_key are ignored here
|
|
||||||
doc_expression->field_doc(*this, flat_field_name, field_value, insertable, updatable, is_primary_key, model_env);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename FieldValue>
|
template<typename FieldValue>
|
||||||
void field_generic(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, bool insertable, bool updatable, bool is_primary_key)
|
void field_generic(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value, bool insertable, bool updatable, bool is_primary_key)
|
||||||
|
@ -854,11 +603,6 @@ protected:
|
||||||
{
|
{
|
||||||
field_generic_clear_value(db_field_name, flat_field_name, field_value, insertable, updatable, is_primary_key);
|
field_generic_clear_value(db_field_name, flat_field_name, field_value, insertable, updatable, is_primary_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_FLAT )
|
|
||||||
{
|
|
||||||
field_generic_generate_doc_for_flat(db_field_name, flat_field_name, field_value, insertable, updatable, is_primary_key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1126,24 +870,6 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void field_model_generate_doc_flat(const wchar_t * db_field_name, const wchar_t * flat_field_name, Model & field_model, bool insertable, bool updatable, bool has_foreign_key)
|
|
||||||
{
|
|
||||||
FlatConnector * doc_connector = model_connector->get_doc_connector(); // different connector will be here (doc, flat)
|
|
||||||
|
|
||||||
if( doc_connector )
|
|
||||||
{
|
|
||||||
FlatExpression * doc_expression = doc_connector->get_expression();
|
|
||||||
|
|
||||||
// potrzebujemy dwa rozne doce, jeden dla flat drugi dla bazy danych
|
|
||||||
if( doc_expression && !is_empty_field(flat_field_name) )
|
|
||||||
{
|
|
||||||
// insertable, updatable and is_primary_key are ignored here
|
|
||||||
doc_expression->field_doc(*this, flat_field_name, field_model, insertable, updatable, false, model_env);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void field_model_read_values_from_queryresult(const wchar_t * db_field_name, const wchar_t * flat_field_name, Model & field_model, bool insertable, bool updatable, bool has_foreign_key)
|
void field_model_read_values_from_queryresult(const wchar_t * db_field_name, const wchar_t * flat_field_name, Model & field_model, bool insertable, bool updatable, bool has_foreign_key)
|
||||||
{
|
{
|
||||||
DbConnector * db_connector = model_connector->get_db_connector();
|
DbConnector * db_connector = model_connector->get_db_connector();
|
||||||
|
@ -1224,11 +950,6 @@ protected:
|
||||||
field_model_clear_values(db_field_name, flat_field_name, field_model, insertable, updatable, has_foreign_key);
|
field_model_clear_values(db_field_name, flat_field_name, field_model, insertable, updatable, has_foreign_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_FLAT )
|
|
||||||
{
|
|
||||||
field_model_generate_doc_flat(db_field_name, flat_field_name, field_model, insertable, updatable, has_foreign_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_READING_VALUE_FROM_DB_RESULTSET )
|
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_READING_VALUE_FROM_DB_RESULTSET )
|
||||||
{
|
{
|
||||||
field_model_read_values_from_queryresult(db_field_name, flat_field_name, field_model, insertable, updatable, has_foreign_key);
|
field_model_read_values_from_queryresult(db_field_name, flat_field_name, field_model, insertable, updatable, has_foreign_key);
|
||||||
|
@ -1295,23 +1016,6 @@ protected:
|
||||||
clearer->clear_container(field_container);
|
clearer->clear_container(field_container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( model_env->model_work_mode == MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_FLAT )
|
|
||||||
{
|
|
||||||
FlatConnector * doc_connector = model_connector->get_doc_connector(); // different connector will be here (doc, flat)
|
|
||||||
|
|
||||||
if( doc_connector )
|
|
||||||
{
|
|
||||||
FlatExpression * doc_expression = doc_connector->get_expression();
|
|
||||||
|
|
||||||
// potrzebujemy dwa rozne doce, jeden dla flat drugi dla bazy danych
|
|
||||||
if( doc_expression && !is_empty_field(flat_field_name) )
|
|
||||||
{
|
|
||||||
// insertable, updatable and is_primary_key are ignored here
|
|
||||||
doc_expression->field_doc(*this, flat_field_name, field_container, insertable, updatable, false, model_env);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1378,81 +1082,6 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////
|
|
||||||
template<typename FieldValue>
|
|
||||||
void doc_field_generic(const wchar_t * db_field_name, const wchar_t * flat_field_name, FieldValue & field_value)
|
|
||||||
{
|
|
||||||
if( reinterpret_cast<const void*>(&field_value) == model_env->doc_field_pointer && model_connector )
|
|
||||||
{
|
|
||||||
FlatConnector * doc_connector = model_connector->get_doc_connector();
|
|
||||||
|
|
||||||
if( doc_connector )
|
|
||||||
{
|
|
||||||
FlatExpression * doc_expression = doc_connector->get_expression();
|
|
||||||
|
|
||||||
if( doc_expression )
|
|
||||||
{
|
|
||||||
PT::TextStream * out_stream = doc_expression->get_current_stream();
|
|
||||||
|
|
||||||
if( out_stream )
|
|
||||||
{
|
|
||||||
(*out_stream) << flat_field_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void doc_field_model(const wchar_t * db_field_name, const wchar_t * flat_field_name, Model & field_model)
|
|
||||||
{
|
|
||||||
if( reinterpret_cast<const void*>(&field_model) == model_env->doc_field_pointer && model_connector )
|
|
||||||
{
|
|
||||||
FlatConnector * doc_connector = model_connector->get_doc_connector();
|
|
||||||
|
|
||||||
if( doc_connector )
|
|
||||||
{
|
|
||||||
FlatExpression * doc_expression = doc_connector->get_expression();
|
|
||||||
|
|
||||||
if( doc_expression )
|
|
||||||
{
|
|
||||||
PT::TextStream * out_stream = doc_expression->get_current_stream();
|
|
||||||
|
|
||||||
if( out_stream )
|
|
||||||
{
|
|
||||||
(*out_stream) << flat_field_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename ModelContainer>
|
|
||||||
void doc_field_list(const wchar_t * db_field_name, const wchar_t * flat_field_name, ModelContainer & field_container)
|
|
||||||
{
|
|
||||||
if( reinterpret_cast<const void*>(&field_container) == model_env->doc_field_pointer && model_connector )
|
|
||||||
{
|
|
||||||
FlatConnector * doc_connector = model_connector->get_doc_connector();
|
|
||||||
|
|
||||||
if( doc_connector )
|
|
||||||
{
|
|
||||||
FlatExpression * doc_expression = doc_connector->get_expression();
|
|
||||||
|
|
||||||
if( doc_expression )
|
|
||||||
{
|
|
||||||
PT::TextStream * out_stream = doc_expression->get_current_stream();
|
|
||||||
|
|
||||||
if( out_stream )
|
|
||||||
{
|
|
||||||
(*out_stream) << flat_field_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
virtual void set_parent_key_in_childs()
|
virtual void set_parent_key_in_childs()
|
||||||
{
|
{
|
||||||
if( model_env )
|
if( model_env )
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
* Copyright (c) 2018-2019, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -43,7 +43,6 @@ ModelConnector::ModelConnector()
|
||||||
{
|
{
|
||||||
flat_connector = nullptr;
|
flat_connector = nullptr;
|
||||||
db_connector = nullptr;
|
db_connector = nullptr;
|
||||||
doc_connector = nullptr;
|
|
||||||
log = nullptr;
|
log = nullptr;
|
||||||
|
|
||||||
out_stream = nullptr;
|
out_stream = nullptr;
|
||||||
|
@ -174,18 +173,6 @@ DbConnector * ModelConnector::get_db_connector()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ModelConnector::set_doc_connector(FlatConnector & doc_connector)
|
|
||||||
{
|
|
||||||
this->doc_connector = &doc_connector;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FlatConnector * ModelConnector::get_doc_connector()
|
|
||||||
{
|
|
||||||
return this->doc_connector;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ModelConnector::set_clearer(Clearer & clearer)
|
void ModelConnector::set_clearer(Clearer & clearer)
|
||||||
{
|
{
|
||||||
deallocate_clearer();
|
deallocate_clearer();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
* Copyright (c) 2018-2019, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -73,9 +73,6 @@ public:
|
||||||
virtual void set_db_connector(DbConnector & db_connector);
|
virtual void set_db_connector(DbConnector & db_connector);
|
||||||
virtual DbConnector * get_db_connector();
|
virtual DbConnector * get_db_connector();
|
||||||
|
|
||||||
virtual void set_doc_connector(FlatConnector & doc_connector);
|
|
||||||
virtual FlatConnector * get_doc_connector();
|
|
||||||
|
|
||||||
virtual void set_clearer(Clearer & clearer);
|
virtual void set_clearer(Clearer & clearer);
|
||||||
virtual Clearer * get_clearer();
|
virtual Clearer * get_clearer();
|
||||||
|
|
||||||
|
@ -87,7 +84,6 @@ protected:
|
||||||
|
|
||||||
FlatConnector * flat_connector;
|
FlatConnector * flat_connector;
|
||||||
DbConnector * db_connector;
|
DbConnector * db_connector;
|
||||||
FlatConnector * doc_connector;
|
|
||||||
|
|
||||||
PT::TextStream * out_stream; // IMPROVE ME give here an interface to the base stream (implement him)
|
PT::TextStream * out_stream; // IMPROVE ME give here an interface to the base stream (implement him)
|
||||||
bool out_stream_allocated;
|
bool out_stream_allocated;
|
||||||
|
|
|
@ -59,10 +59,6 @@ public:
|
||||||
int model_work_submode;
|
int model_work_submode;
|
||||||
bool dump_mode;
|
bool dump_mode;
|
||||||
|
|
||||||
// local objects
|
|
||||||
// (for only one model)
|
|
||||||
const void * doc_field_pointer;
|
|
||||||
|
|
||||||
PT::TextStream table_name; // CHECK ME may it should be PT::WTextStream?
|
PT::TextStream table_name; // CHECK ME may it should be PT::WTextStream?
|
||||||
PT::TextStream table_name_short;
|
PT::TextStream table_name_short;
|
||||||
int table_index;
|
int table_index;
|
||||||
|
@ -93,7 +89,6 @@ public:
|
||||||
model_work_submode = e.model_work_submode;
|
model_work_submode = e.model_work_submode;
|
||||||
dump_mode = e.dump_mode;
|
dump_mode = e.dump_mode;
|
||||||
table_index = e.table_index;
|
table_index = e.table_index;
|
||||||
doc_field_pointer = e.doc_field_pointer;
|
|
||||||
set_field_name_helper = e.set_field_name_helper;
|
set_field_name_helper = e.set_field_name_helper;
|
||||||
field_value_helper_tab = e.field_value_helper_tab;
|
field_value_helper_tab = e.field_value_helper_tab;
|
||||||
field_index = e.field_index;
|
field_index = e.field_index;
|
||||||
|
@ -112,10 +107,9 @@ public:
|
||||||
model_work_mode = e.model_work_mode;
|
model_work_mode = e.model_work_mode;
|
||||||
model_work_submode = e.model_work_submode;
|
model_work_submode = e.model_work_submode;
|
||||||
dump_mode = e.dump_mode;
|
dump_mode = e.dump_mode;
|
||||||
|
|
||||||
// what about doc_field_pointer?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
model_data = nullptr;
|
model_data = nullptr;
|
||||||
|
@ -124,7 +118,6 @@ public:
|
||||||
model_work_mode = MORM_MODEL_WORK_MODE_NONE;
|
model_work_mode = MORM_MODEL_WORK_MODE_NONE;
|
||||||
model_work_submode = MORM_MODEL_WORK_SUBMODE_NONE;
|
model_work_submode = MORM_MODEL_WORK_SUBMODE_NONE;
|
||||||
dump_mode = false;
|
dump_mode = false;
|
||||||
doc_field_pointer = nullptr;
|
|
||||||
table_name.clear();
|
table_name.clear();
|
||||||
table_name_short.clear();
|
table_name_short.clear();
|
||||||
table_index = 0;
|
table_index = 0;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, Tomasz Sowa
|
* Copyright (c) 2018-2019, Tomasz Sowa
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -42,11 +42,9 @@
|
||||||
|
|
||||||
#include "jsonexpression.h"
|
#include "jsonexpression.h"
|
||||||
#include "postgresqlexpression.h"
|
#include "postgresqlexpression.h"
|
||||||
#include "dochtmlexpression.h"
|
|
||||||
|
|
||||||
#include "jsonconnector.h"
|
#include "jsonconnector.h"
|
||||||
#include "postgresqlconnector.h"
|
#include "postgresqlconnector.h"
|
||||||
#include "dochtmlconnector.h"
|
|
||||||
|
|
||||||
#include "modelconnector.h"
|
#include "modelconnector.h"
|
||||||
#include "clearer.h"
|
#include "clearer.h"
|
||||||
|
|
|
@ -36,23 +36,15 @@
|
||||||
#define headerfile_morm_morm_types
|
#define headerfile_morm_morm_types
|
||||||
|
|
||||||
#define MORM_MODEL_WORK_MODE_NONE 0
|
#define MORM_MODEL_WORK_MODE_NONE 0
|
||||||
#define MORM_MODEL_WORK_MODE_GENERATING_FLAT_STRING 1
|
#define MORM_MODEL_WORK_MODE_GENERATING_DB_SQL 1
|
||||||
#define MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_FLAT 2
|
#define MORM_MODEL_WORK_MODE_GENERATING_FLAT_STRING 2
|
||||||
#define MORM_MODEL_WORK_MODE_GENERATING_DOC_FOR_DB 3
|
#define MORM_MODEL_WORK_MODE_READING_VALUE_FROM_DB_RESULTSET 3
|
||||||
#define MORM_MODEL_WORK_MODE_GENERATING_DB_SQL 4
|
#define MORM_MODEL_WORK_MODE_CLEARING_VALUE 4
|
||||||
|
#define MORM_MODEL_WORK_MODE_ITERATE_THROUGH_CHILDS_WITH_FOREIGN_KEY 5
|
||||||
// not used at the moment, there are not any flat parsers (json parser)
|
#define MORM_MODEL_WORK_MODE_ITERATE_THROUGH_CHILDS_WITHOUT_FOREIGN_KEY 6
|
||||||
#define MORM_MODEL_WORK_MODE_READING_VALUE_FROM_FLAT_STRING 5
|
#define MORM_MODEL_WORK_MODE_SET_PARENT_ID 7
|
||||||
|
#define MORM_MODEL_WORK_MODE_ITERATE_PRIMARY_KEY_VALUES 8
|
||||||
#define MORM_MODEL_WORK_MODE_READING_VALUE_FROM_DB_RESULTSET 6
|
#define MORM_MODEL_WORK_MODE_SET_FIELD_VALUE 9
|
||||||
#define MORM_MODEL_WORK_MODE_CLEARING_VALUE 7
|
|
||||||
|
|
||||||
#define MORM_MODEL_WORK_MODE_ITERATE_THROUGH_CHILDS_WITH_FOREIGN_KEY 8
|
|
||||||
#define MORM_MODEL_WORK_MODE_ITERATE_THROUGH_CHILDS_WITHOUT_FOREIGN_KEY 9
|
|
||||||
|
|
||||||
#define MORM_MODEL_WORK_MODE_SET_PARENT_ID 10
|
|
||||||
#define MORM_MODEL_WORK_MODE_ITERATE_PRIMARY_KEY_VALUES 11
|
|
||||||
#define MORM_MODEL_WORK_MODE_SET_FIELD_VALUE 12
|
|
||||||
|
|
||||||
|
|
||||||
// submodes used in some cases
|
// submodes used in some cases
|
||||||
|
|
Loading…
Reference in New Issue