Khurune Posted January 19, 2020 Share Posted January 19, 2020 Hi, I'm wanting to add more features to the Onset game set up for customers. We have the database scripts so all that is made, but for some of the more advanced stuff, like RP Mods, they also require SQL import for the premade tables. Is their currently a way that users can upload a SQL file to be imported into their database? Link to comment Share on other sites More sharing options...
LFA Posted January 20, 2020 Share Posted January 20, 2020 You have 3 options. 1- Give them access to phpmyadmin with a custom link so they can import it there. 2- If you use the mod installer use a script to import the sql file automatically when the mod is installed. 3- Have them upload the sql file to a specific folder. Create this custom script for custom icon or custom action event with prompt for variable values checked. Create a variable named MySQLScript and configure it as a script parameter. Configure it as a combobox that shows FolderName\*.sql import clr; import System; clr.AddReference("TCAdmin.DatabaseProviders.MySql"); clr.AddReference("TCAdmin.SDK"); from TCAdmin.DatabaseProviders.MySql import MySqlManager; from System import String; mysql_server="localhost"; with MySqlManager() as mysql2: mysql2.DisableReplication=True; mysql2.Connect(String.Format("Data Source={0};Database={1};User Id= {1};Password={2};Pooling=False;", mysql_server, ThisService.Variables["MySQLUser"], ThisService.Variables["MySQLPassword"])); mysql2.ImportDatabase(ThisService.Variables["MySQLScript"]); Link to comment Share on other sites More sharing options...
Khurune Posted January 20, 2020 Author Share Posted January 20, 2020 Will give that a try, thank you very much LFA. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now