Ich schreibe ein kleines Deployment-SQL-Skript für meine erste datenbankgesteuerte Anwendung.Hat [My] SQL eine Pre-Processor-like Facility?
Im Prozess finde ich, dass ich mich wiederhole viel, zum Beispiel:
GRANT USAGE ON *.* TO 'foo'@'localhost';
DROP USER 'foo'@'localhost';
CREATE USER 'foo'@'localhost' IDENTIFIED BY 'password';
Es wäre fantastisch, wenn ich eine Variable oder ein Makro zu ersetzen häufig gemeinsam vorkommen Daten nutzen könnten. Ist es möglich, etwas wie das folgende Snippet zu implementieren?
#define USER 'foo' #or "Type USER = 'foo'"
#define HOST 'localhost' #or "Type HOST = 'localhost'"
GRANT USAGE ON *.* TO [email protected]
DROP USER [email protected]
CREATE USER [email protected] IDENTIFIED BY 'password'