(self, dbAddress: Optional[str], dbPort: Optional[str], userName: Optional[str], password: Optional[str], dbName: Optional[str], dbID: Optional[str])
| 65 | return -1, -1 |
| 66 | |
| 67 | def add_db(self, dbAddress: Optional[str], dbPort: Optional[str], userName: Optional[str], password: Optional[str], dbName: Optional[str], dbID: Optional[str]) -> str: |
| 68 | db = pymysql.connect(host=dbAddress, port=int(dbPort), user=userName, password=password, database=dbName) |
| 69 | |
| 70 | for key, value in self.dbMap.items(): |
| 71 | if value.host == dbAddress and value.port == int(dbPort) and value.user == userName and value.password == password and value.database == dbName: |
| 72 | return key |
| 73 | |
| 74 | if dbID is None: |
| 75 | dbID = self.generated_id() |
| 76 | self.dbMap[dbID] = db |
| 77 | else: |
| 78 | self.dbMap[dbID] = db |
| 79 | return dbID |
| 80 | |
| 81 | def generated_id(self) -> str: |
| 82 | characters = string.ascii_letters + string.digits |
nothing calls this directly
no test coverage detected