S015 sql - execute INSERT-UPDATE-DELETE-DML
#################################################;
# Execute INSERT UPDATE DELETE ALTER CREATE ... #;
#################################################;
#Create a connection 'demo_cm_mysql' to a MySQL Server;
#Do not add this into your code, this is a configuration;
cm set "demo_cm_mysql" {execute "db.mysql.config.get"
"[hostname]" "localhost"
"[port]" "3306"
"[database]" "test_db"
"[user]" "bob"
"[password]" "pwd"
;};
#Connect with the connection;
sql connect "session1" {cm get "demo_cm_mysql";};
#Execute an insert/update/delete SQL request;
sql dml "session1" (concat "insert into products (id, name, quantity) values (4582, 'other', '4567');");
#Disconnect a connection;
sql disconnect "session1";
#Disconnect all connections;
sql disconnect all;