fix: connect to a database
This commit is contained in:
		
							
								
								
									
										11
									
								
								Database.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								Database.py
									
									
									
									
									
								
							| @ -20,6 +20,17 @@ class Database: | ||||
|         password = password, | ||||
|         ) | ||||
|         self.cursor = self.mydb.cursor() | ||||
|         self.cursor.execute("SHOW DATABASES"); | ||||
|         if (not "zeolak" in self.cursor): | ||||
|             self.cursor.execute("CREATE DATABASE zeolak") | ||||
|         self.mydb = mysql.connector.connect( | ||||
|         host = host, | ||||
|         port = port, | ||||
|         user = user, | ||||
|         password = password, | ||||
|         database = "zeolak" | ||||
|         ) | ||||
|         self.cursor = self.mydb.cursor() | ||||
|  | ||||
|     def _create_table(self, name: str, content: dict): | ||||
|         command: str = f"CREATE TABLE {name} (" | ||||
|  | ||||
		Reference in New Issue
	
	Block a user