Jump to content

Onset - Import SQL Data.


Khurune

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Who's Online   0 Members, 0 Anonymous, 153 Guests (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use