Bootstrapping my database
Posted: Tue 17 Apr 2018 19:08
I have been a very happy Devart Delphi MySQL access components for many years, not a very GOOD user, I admit, but what I've previously written worked, and worked well.
Now I have been asked to add new functionality to my program, specifically creating code that will allow the program to determine if the database I access exists, and if it doesn't create it, create a user if one doesn't exist, assign privileges, and create all the tables, if they don't exist. Since the code is still under active development, I have a habit of adding new tables occasionally, and to be able to detect its non-existence and create a new table would also be good.
Previously, all this sort of thing I manage from MySQL administrator. I configured each of the bespoke machines individually, no problem.
I have managed to write a snippet that creates an instance of Tmyconnection to check if the DB exists, in the project level of my app, expecting I could access it in the application proper, instead of the component Tmyconnection I used in my main app, but it seems to be only local to the project code.
How else can I do this ? Tmycommand or Tmyscript have to be bound to an existing database connection.
Sorry to sound like a newbie, but I feel like one right now.
Steve
Now I have been asked to add new functionality to my program, specifically creating code that will allow the program to determine if the database I access exists, and if it doesn't create it, create a user if one doesn't exist, assign privileges, and create all the tables, if they don't exist. Since the code is still under active development, I have a habit of adding new tables occasionally, and to be able to detect its non-existence and create a new table would also be good.
Previously, all this sort of thing I manage from MySQL administrator. I configured each of the bespoke machines individually, no problem.
I have managed to write a snippet that creates an instance of Tmyconnection to check if the DB exists, in the project level of my app, expecting I could access it in the application proper, instead of the component Tmyconnection I used in my main app, but it seems to be only local to the project code.
How else can I do this ? Tmycommand or Tmyscript have to be bound to an existing database connection.
Sorry to sound like a newbie, but I feel like one right now.
Steve