コード例 #1
0
ファイル: TreePanel.py プロジェクト: struts2spring/sql-editor
 def onRefresh(self, event=None):
     logger.debug('onRefresh')
     '''
     1. find current active connection.
     2. refresh only that connection.
     '''
     ##################################################################################
     sqlExecuter = SQLExecuter(database='_opal.sqlite')
     textCtrl = self.GetTopLevelParent()._ctrl
     selectedItemText = textCtrl.GetValue()
     dbFilePath = sqlExecuter.getDbFilePath(selectedItemText)
     logger.debug("dbFilePath: %s", dbFilePath)
コード例 #2
0
 def findingConnectionName(self):
     '''
     This method defines connection name based on selected connection in the tree.
     @return: (connectionName, databaseAbsolutePath)
     '''
     ##################################################################################
     sqlExecuter = SQLExecuter(database='_opal.sqlite')
     textCtrl = self.GetTopLevelParent()._ctrl
     connectionName = textCtrl.GetValue()
     databaseAbsolutePath = sqlExecuter.getDbFilePath(connectionName)
     logger.debug("databaseAbsolutePath: %s", databaseAbsolutePath)
     
     ##################################################################################        
     return connectionName, databaseAbsolutePath
コード例 #3
0
ファイル: TreePanel.py プロジェクト: struts2spring/sql-editor
    def onDeleteWithDatabaseTable(self, event):
        logger.debug('onDeleteWithDatabaseTable')
#         self.onDeleteConnection(event)
        ##################################################################################
        sqlExecuter = SQLExecuter(database='_opal.sqlite')
        selectedItemId = self.tree.GetSelection()
        selectedItemText = self.tree.GetItemText(self.tree.GetSelection())
        dbFilePath = sqlExecuter.getDbFilePath(selectedItemText)
        logger.debug("dbFilePath: %s", dbFilePath)
        
        ##################################################################################
        fileOperations = FileOperations()
        fileRemoved = fileOperations.removeFile(filename=dbFilePath)
        if selectedItemText and fileRemoved:
            self.sqlExecuter.removeConnctionRow(selectedItemText)
            self.recreateTree()
コード例 #4
0
ファイル: TreePanel.py プロジェクト: struts2spring/sql-editor
 def onCreateErDiagramItem(self, event):
     logger.debug('onCreateErDiagramItem')
     ##################################################################################
     sqlExecuter = SQLExecuter(database='_opal.sqlite')
     textCtrl = self.GetTopLevelParent()._ctrl
     selectedItemText = textCtrl.GetValue()
     dbFilePath = sqlExecuter.getDbFilePath(selectedItemText)
     logger.debug("dbFilePath: %s", dbFilePath)
     
     ################################################################################## 
     depth = self.tree.GetItemData(self.tree.GetSelection())['depth']   
     if os.path.isfile(dbFilePath):     
         dbObjects = ManageSqliteDatabase(connectionName=selectedItemText , databaseAbsolutePath=dbFilePath).getObject()   
          
     createErDiagramFrame = CreateErDiagramFrame(None)
     createErDiagramFrame.setDbObjects(dbObjects=dbObjects)
     createErDiagramFrame.Show()        
コード例 #5
0
ファイル: TreePanel.py プロジェクト: struts2spring/sql-editor
    def onDeleteTable(self, event):
        logger.debug('onDeleteTable')
        try:
#             data = self.tree.GetPyData(self.tree.GetSelection()).Data
            depth = self.tree.GetItemData(self.tree.GetSelection())['depth']
            ##################################################################################
            sqlExecuter = SQLExecuter(database='_opal.sqlite')
            textCtrl = self.GetTopLevelParent()._ctrl
            selectedItemText = textCtrl.GetValue()
            databaseAbsolutePath = sqlExecuter.getDbFilePath(selectedItemText)
            logger.debug("dbFilePath: %s", databaseAbsolutePath)
            
            ##################################################################################
    #         connectionName = data['connection_name']
#             databaseAbsolutePath = data['db_file_path']
            if os.path.isfile(databaseAbsolutePath) and depth == 3:     
                text = "DROP TABLE '{}'".format(self.tree.GetItemText(self.tree.GetSelection()))
                dbObjects = ManageSqliteDatabase(connectionName=selectedItemText , databaseAbsolutePath=databaseAbsolutePath).executeText(text)
                self.recreateTree(event) 
        except Exception as e:
            logger.error(e, exc_info=True)