NDBT_Attribute(const char* _name, NdbDictionary::Column::Type _type, int _length = 1, bool _pk = false, bool _nullable = false, CHARSET_INFO *cs= 0, NdbDictionary::Column::StorageType storage = NdbDictionary::Column::StorageTypeMemory, bool dynamic = false, const void* defaultVal = NULL, Uint32 defaultValBytes = 0): NdbDictionary::Column(_name) { assert(_name != 0); setType(_type); setLength(_length); setNullable(_nullable); setPrimaryKey(_pk); if (cs) { setCharset(cs); } setStorageType(storage); setDynamic(dynamic); setDefaultValue(defaultVal, defaultValBytes); }
StelShortcut::StelShortcut(const QString &id, StelShortcutGroup* group, const QString &text, const QString &primaryKey, const QString &altKey, bool checkable, bool autoRepeat, bool global, QGraphicsWidget *parent) : m_id(id), m_temporary(false) { if (parent == NULL) { parent = StelMainGraphicsView::getInstance().getStelAppGraphicsWidget(); } m_action = new QAction(parent); m_action->setObjectName(id); m_group = group; setText(text); setPrimaryKey(primaryKey); setAltKey(altKey); setCheckable(checkable); setAutoRepeat(autoRepeat); setGlobal(global); parent->addAction(m_action); }
void TextUI::processCommand() { string choice; cin >> choice; switch(atoi(choice.c_str())) { case Load: loadERDiagram(); displayMenu(); break; case Save: saveERDiagram(); displayMenu(); break; case Add: addNewNode(); displayMenu(); break; case Connect: addConnection(); displayMenu(); break; case GetTable: displayComponentTable(); displayConnectionTable(); displayMenu(); break; case SetPK: setPrimaryKey(); displayMenu(); break; case GetERTable: displayERDiagramTable(); displayMenu(); break; case Delete: deleteComponent(); displayMenu(); break; case Undo: undoCmd(); displayMenu(); break; case Redo: redoCmd(); displayMenu(); break; case Exit: exitERDiagram(); break; default: cout << TEXT_MENU_ERRORCHOICE; displayMenu(); break; } }
vector<pair<int, bool>> ERModel::reBuildPrimaryKey( Component* oldAttributeNode, int newEntityNodeID, int newAttributeNodeID ) { vector<pair<int, bool>> reBuildPrimaryKeySet; vector<int> primaryKey; NodeAttribute* tempOldAttributeNode = static_cast<NodeAttribute*>(oldAttributeNode); if (tempOldAttributeNode->getIsPrimaryKey()) { primaryKey.push_back(newAttributeNodeID); setPrimaryKey(newEntityNodeID, primaryKey); reBuildPrimaryKeySet.push_back(make_pair(newAttributeNodeID, true)); return reBuildPrimaryKeySet; } return reBuildPrimaryKeySet; }
// 重建PK void ERModel::recoveryPrimaryKey( vector<string> primaryKeysSet ) { // primaryKeysSet is composed by entityNodeID, primarykey set. pair<string,vector<string>> splitPrimaryKey; vector<int> primaryKeyData; for (int i = 0; i < primaryKeysSet.size(); i++) { primaryKeyData.clear(); // splitter.first是EntityID, splitter.second是primary key的集合 splitPrimaryKey = splitter(primaryKeysSet[i]); for (int j = 0; j < splitPrimaryKey.second.size(); j++) primaryKeyData.push_back(atoi(splitPrimaryKey.second[j].c_str())); setPrimaryKey(atoi(splitPrimaryKey.first.c_str()), primaryKeyData); } }
NDBT_Attribute(const char* _name, NdbDictionary::Column::Type _type, int _length = 1, bool _pk = false, bool _nullable = false, CHARSET_INFO *cs= 0, NdbDictionary::Column::StorageType storage = NdbDictionary::Column::StorageTypeMemory): NdbDictionary::Column(_name) { assert(_name != 0); setType(_type); setLength(_length); setNullable(_nullable); setPrimaryKey(_pk); if (cs) { setCharset(cs); } setStorageType(storage); }