@@ -9567,30 +9567,33 @@ void DatabaseModel::loadObjectsMetadata(const QString &filename, MetaAttrOptions
95679567
95689568 xmlparser.restorePosition ();
95699569 }
9570- else if (elem_name== Attributes::Info)
9570+ else if (elem_name == Attributes::Info)
95719571 {
95729572 xmlparser.getElementAttributes (attribs);
9573- obj_name= attribs[Attributes::Object];
9573+ obj_name = attribs[Attributes::Object];
95749574 xmlparser.savePosition ();
95759575
9576- obj_type=BaseObject::getObjectType (attribs[Attributes::Type]);
9577- progress=xmlparser.getCurrentBufferLine ()/static_cast <double >(xmlparser.getBufferLineCount ()) * 100 ;
9576+ obj_type = BaseObject::getObjectType (attribs[Attributes::Type]);
9577+ progress = xmlparser.getCurrentBufferLine ()/static_cast <double >(xmlparser.getBufferLineCount ()) * 100 ;
9578+
9579+ if (obj_type == ObjectType::Constraint)
9580+ obj_name.length ();
95789581
9579- if (obj_type== ObjectType::Database)
9582+ if (obj_type == ObjectType::Database)
95809583 {
95819584 if (load_db_attribs)
95829585 {
9583- QStringList pos= attribs[Attributes::LastPosition].split (' ,' );
9586+ QStringList pos = attribs[Attributes::LastPosition].split (' ,' );
95849587
9585- default_objs[ObjectType::Schema]= getSchema (attribs[Attributes::DefaultSchema]);
9586- default_objs[ObjectType::Role]= getRole (attribs[Attributes::DefaultOwner]);
9587- default_objs[ObjectType::Collation]= getCollation (attribs[Attributes::DefaultCollation]);
9588- default_objs[ObjectType::Tablespace]= getTablespace (attribs[Attributes::DefaultTablespace]);
9589- author= attribs[Attributes::ModelAuthor];
9590- last_zoom= attribs[Attributes::LastZoom].toDouble ();
9588+ default_objs[ObjectType::Schema] = getSchema (attribs[Attributes::DefaultSchema]);
9589+ default_objs[ObjectType::Role] = getRole (attribs[Attributes::DefaultOwner]);
9590+ default_objs[ObjectType::Collation] = getCollation (attribs[Attributes::DefaultCollation]);
9591+ default_objs[ObjectType::Tablespace] = getTablespace (attribs[Attributes::DefaultTablespace]);
9592+ author = attribs[Attributes::ModelAuthor];
9593+ last_zoom = attribs[Attributes::LastZoom].toDouble ();
95919594
95929595 if (pos.size ()>=2 )
9593- last_pos= QPoint (pos[0 ].toInt (), pos[1 ].toInt ());
9596+ last_pos = QPoint (pos[0 ].toInt (), pos[1 ].toInt ());
95949597 }
95959598
95969599 if (load_objs_layers_cfg && !attribs[Attributes::Layers].isEmpty () &&
@@ -9609,7 +9612,7 @@ void DatabaseModel::loadObjectsMetadata(const QString &filename, MetaAttrOptions
96099612 is_layer_rects_visible = attribs[Attributes::ShowLayerRects] == Attributes::True;
96109613 }
96119614
9612- object= this ;
9615+ object = this ;
96139616 }
96149617 else if (TableObject::isTableObject (obj_type))
96159618 {
@@ -9621,12 +9624,12 @@ void DatabaseModel::loadObjectsMetadata(const QString &filename, MetaAttrOptions
96219624 if (base_tab)
96229625 object = base_tab->getObject (attribs[Attributes::Object], obj_type);
96239626
9624- // Discarding the object if it was added by relationship
9625- if (object && dynamic_cast <TableObject *>(object)->isAddedByRelationship ())
9627+ // Discarding the object if it was added by relationship or the parent table couldnt be found
9628+ if (!base_tab || ( object && dynamic_cast <TableObject *>(object)->isAddedByRelationship () ))
96269629 object = nullptr ;
96279630 }
96289631 else
9629- object= getObject (obj_name, obj_type);
9632+ object = getObject (obj_name, obj_type);
96309633
96319634 /* If the object does not exists but it is a relationship, we try to get the relationship
96329635 involving the tables in paramenters src-table and dst-table */
0 commit comments