Guest User

Untitled

a guest
Feb 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. class database_creator():
  2.  
  3. def __init__(self , username , password):
  4. self.username = username
  5. self.password = password
  6. self.cursor = None # this is the cursor
  7. self.connect = None # this is the cnx the mysql object
  8. self.tables = [] # this shows how many databse table are there
  9.  
  10. def initializer(self): # sets the cursor and starts the engine
  11.  
  12. self.connect = mysql.connector.connect(user=self.username, password= self.password)
  13. self.cursor = self.connect.cursor()
  14.  
  15. def connect (self , c_database ):
  16. # c_database is the name of the database that i want to make
  17.  
  18. self.cursor.execute("CREATE DATABASE(c_database)")
  19.  
  20.  
  21. self.connect.database = c_database #
Add Comment
Please, Sign In to add comment