7 #include "Reflex/Reflex.h"
11 m_tableRegister( schema ){
23 std::stringstream messg;
24 messg <<
"Cannot process default mapping for class \"" << className+
"\"";
30 if(m_tableRegister.checkTable(tableName)){
31 throwException(
"Table \"" +tableName+
"\" already assigned, cannot be allocated for the mapping of class \""+className+
"\"",
32 "MappingGenerator::processClass");
34 m_tableRegister.insertTable(tableName);
38 m_tableRegister.insertColumns(tableName, topElement.
columnNames() );
40 std::auto_ptr<IRelationalMapping> processor( mappingFactory.
newProcessor( classDictionary ) );
43 processor->process( topElement, className, nameForSchema, scope );
50 createNewMapping( containerName, classDictionary, destination );
53 "MappingGenerator::createNewMapping" );
65 std::stringstream messg;
66 messg <<
"Cannot process default mapping for class \"" << className+
"\"";
75 while(m_tableRegister.checkTable(tableName)){
79 m_tableRegister.insertTable(tableName);
84 std::vector<std::string> columns;
88 m_tableRegister.insertColumns(tableName, columns );
90 std::auto_ptr<IRelationalMapping> processor( mappingFactory.
newProcessor( classDictionary ) );
93 processor->process( classElement, className, nameForSchema, scope );
100 createNewDependentMapping( classDictionary, parentClassMapping, destination );
103 "MappingGenerator::createNewDependentMapping" );
105 destination.
override( dependentClassBaseMapping );
void override(const MappingTree &source)
replace present data with the provided source
MappingGenerator(coral::ISchema &schema)
Constructor.
const std::string & className() const
static std::string newNameForDepSchemaObject(const std::string &initialName, unsigned int index, size_t maxLength)
void createNewDependentMapping(const Reflex::Type &dependentClassDictionary, const MappingTree &parentClassMapping, MappingTree &destination)
static std::string columnNameForRefColumn()
MappingElement & setTopElement(const std::string &className, const std::string &tableName, bool isDependent=false)
~MappingGenerator()
Destructor.
const MappingElement & topElement() const
void createNewMapping(const std::string &containerName, const Reflex::Type &classDictionary, MappingTree &destination)
static std::string columnNameForId()
const std::vector< std::string > & columnNames() const
size_t sizeInColumns(const Reflex::Type &topLevelClassType)
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
static const size_t MaxColumnsPerTable
static const size_t ClassNameLengthForSchema
size parameters for table creation
static std::string tableNameForItem(const std::string &itemName)
schema object naming
const std::string & tableName() const
void setDependency(const MappingTree &parentTree)
static const size_t MaxTableNameLength
static std::string formatName(const std::string &variableName, size_t maxLength)
formatting for variable names to schema object names
IRelationalMapping * newProcessor(const Reflex::Type &attributeType, bool blobStreaming=false)
std::string className(const T &t)
void setColumnNames(const std::vector< std::string > &columns)