--- a/src/Configuration.h Sat Jul 27 23:51:14 2019 +0200
+++ b/src/Configuration.h Mon Jul 29 19:49:12 2019 +0200
@@ -24,72 +24,36 @@
namespace tr {
namespace sql {
-class DefinitionRecipe {
+class Parameter {
public:
- virtual ~DefinitionRecipe() {
- }
-
- relpipe::writer::string_t name;
- relpipe::writer::string_t type;
relpipe::writer::string_t value;
+ // TODO: relpipe::writer::TypeId type;
};
-class RelationConfiguration {
+class Statement {
public:
- virtual ~RelationConfiguration() {
+ virtual ~Statement() {
}
- relpipe::writer::string_t relation;
- relpipe::writer::string_t sqlBeforeRecords;
- relpipe::writer::string_t sqlAfterRecords;
- relpipe::writer::string_t sqlForEach;
-
/**
- * If true, additional relation will be generated: mapping between relpipe attribute names and SQL variable names
- */
- bool debugVariableMapping = false;
-
- /**
- * If true, SQL code will be executed, but no output will be generated.
- */
- bool drop = false;
-
- /**
- * Variable definitions for this relation.
- * Can be used as a safe way for passing parameters from the outside environment.
- * See also Configuration::definitions (can be overridden by relation's definitions)
+ * output relation name;
+ * if empty, the SQL code (DML, DDL) will be executed, but no relational output will be generated
*/
- std::vector<DefinitionRecipe> definitions;
-
- /**
- * If empty, output relation will have same metadata as the input relation.
- */
- std::vector<relpipe::writer::AttributeMetadata> writerMetadata;
-
+ relpipe::writer::string_t relation;
/**
- * Whether original attributes should be appended to those specified using --output-attribute
+ * SQL code, usually some SELECT;
+ * might be also DML or DDL
*/
- bool inputAttributesAppend = false;
-
- /**
- * Whether original attributes should be prepended to those specified using --output-attribute
- */
- bool inputAttributesPrepend = false;
+ relpipe::writer::string_t sql;
+ std::vector<Parameter> parameters;
};
class Configuration {
public:
- std::vector<RelationConfiguration> relationConfigurations;
-
- /**
- * Global definitions for all relations.
- * Can be used as a safe way for passing parameters from the outside environment.
- * See also RelationConfiguration::definitions
- */
- std::vector<DefinitionRecipe> definitions;
+ std::vector<Statement> statements;
virtual ~Configuration() {
}
@@ -97,4 +61,4 @@
}
}
-}
\ No newline at end of file
+}