| Bug #58554 | Error when creating relationship between tables created from a plugin | ||
|---|---|---|---|
| Submitted: | 29 Nov 2010 10:37 | Modified: | 4 Mar 2011 15:11 |
| Reporter: | Peter Pfannkuch | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Workbench | Severity: | S1 (Critical) |
| Version: | 5.2.29 | OS: | Windows (7) |
| Assigned to: | Alfredo Kojima | CPU Architecture: | Any |
[29 Nov 2010 10:37]
Peter Pfannkuch
[29 Nov 2010 17:02]
Alfredo Kojima
Please provide the plugin or the code from the plugin where the tables are created. Sounds like the plugin is not creating the tables correctly.
[30 Nov 2010 7:26]
Peter Pfannkuch
here is the code, where the tables are created:
schema = catalog.defaultSchema
myfile = open(f.tbfile.get_string_value(),'r')
for line in myfile:
line = line[7:]
line = line.replace('`', '')
bracket = line.find('(')
tableName = line[0:bracket]
table = schema.addNewTable('db.mysql')
table.name = tableName
line = line[bracket:]
comma = line.find(',')
while comma != -1:
atrStr = line[0:comma]
parts = atrStr.split(':')
column = grt.classes.db_mysql_Column()
column.name = parts[0][1:]
atrStr = parts[1][1:]
parts = atrStr.split(' ')
column.setParseType(parts[0], grt.root.wb.doc.physicalModels[0].catalog.simpleDatatypes)
if len(parts) >= 2:
column.flags.append('UNSIGNED')
table.addColumn(column)
line = line[comma + 1:]
comma = line.find(',')
column = grt.classes.db_mysql_Column()
parts = line.split(':')
column.name = parts[0][1:]
line = parts[1][1:]
parts = line.split(' ')
if len(parts) >= 2:
column.setParseType(parts[0], grt.root.wb.doc.physicalModels[0].catalog.simpleDatatypes)
column.flags.append('UNSIGNED')
else:
column.setParseType(parts[0][0:-2], grt.root.wb.doc.physicalModels[0].catalog.simpleDatatypes)
table.addColumn(column)
And here are some lines from the input file:
Create `Capacity`(`upperDeviation`: Integer, `weight`: Integer, `resourceId`: Integer, `rate`: Integer, `recCreatedDate`: Datetime, `isAbsValue`: Boolean, `id`: Integer, `timeDimensionId`: Integer, `upperAmount`: Integer, `amount`: Integer, `priority`: Integer, `lowerAmount`: Integer, `deviation`: Integer, `forPreselection`: Boolean, `calendarId`: Integer, `recCreator`: Integer, `enumerationId`: Integer, `recUser`: Integer, `groupId`: Integer, `productStructureElementId`: Integer, `filter`: String, `lowerDeviation`: Integer, `attributeId`: Integer, `recChangedDate`: Datetime, `shiftNumber`: Integer)
Create `OrderMixModelLimits`(`orderMixModelId`: Integer, `orderMixLimitId`: Integer)
Create `SeqModelRuleVarValue`(`name`: String, `ruleId`: Integer, `rulevarId`: Integer, `value`: String, `id`: Integer, `modelId`: Integer)
[7 Dec 2010 12:54]
Alfredo Kojima
Duplicate of bug #58752
[7 Dec 2010 13:28]
Alfredo Kojima
Sorry, jumped on the gun. This is actually not a duplicate, you must set the owner field of the columns to the table. I'll change addColumn so that it's done automatically.
[3 Mar 2011 13:55]
Johannes Taxacher
fix confirmed in repository
[4 Mar 2011 15:11]
Tony Bedford
An entry has been added to the 5.2.32 changelog:
When trying to create a relationship between two tables, created
in a plugin, the following error was generated:
MySQL Workbench has encountered a problem
Es wurde versucht, im geschützten Speicher zu lesen oder zu schreiben. Dies ist häufig
ein Hinweis darauf, dass anderer Speicher beschädigt ist.
