daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest May 26th, 2018 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     public class DatabaseManager : BaseScript
  3.     {
  4.         public MySqlConnection Connection;
  5.  
  6.         public static DatabaseManager Instance;
  7.  
  8.         public DatabaseManager()
  9.         {
  10.             Instance = this;
  11.             Connect();
  12.         }
  13.  
  14.         private void Connect()
  15.         {
  16.             string connectionString = "server=pirp.site;database=pirpsite_gameserver;user=pirpsite;password=CdZjQ7iHWg";
  17.             Connection = new MySqlConnection(connectionString);
  18.         }
  19.  
  20.         public MySqlDataReader StartQuery(string query)
  21.         {
  22.             MySqlCommand queryCommand = new MySqlCommand(query, Connection);
  23.             queryCommand.Connection.Open();
  24.             return queryCommand.ExecuteReader(); ;
  25.         }
  26.  
  27.         public void EndQuery(MySqlDataReader reader)
  28.         {
  29.             reader.Close();
  30.             Connection.Close();
  31.         }
  32.  
  33.         public object Scalar(string query)
  34.         {  
  35.             MySqlCommand queryCommand = new MySqlCommand(query, Connection);
  36.             queryCommand.Connection.Open();
  37.             var ret = queryCommand.ExecuteScalar();
  38.             Connection.Close();
  39.             return ret;
  40.         }
  41.  
  42.         public void Execute(string query)
  43.         {
  44.             MySqlCommand queryCommand = new MySqlCommand(query,Connection);
  45.             queryCommand.Connection.Open();
  46.             queryCommand.ExecuteNonQuery();
  47.             queryCommand.Connection.Close();
  48.         }
  49.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top