diff options
author | emkael <emkael@tlen.pl> | 2018-10-13 18:01:37 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-10-27 14:53:06 +0100 |
commit | 4414cc3a6f2b9fe9c318a9c7438ee139ef830099 (patch) | |
tree | 4a210f24a68fef7fdca4b34816cba6387b401ecc /kurier/MySQL.cs | |
parent | ae9fddd795e67f3b6129053020fdb15856601285 (diff) |
Renaming project
Diffstat (limited to 'kurier/MySQL.cs')
-rw-r--r-- | kurier/MySQL.cs | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/kurier/MySQL.cs b/kurier/MySQL.cs deleted file mode 100644 index 88b4fbf..0000000 --- a/kurier/MySQL.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using MySql.Data.MySqlClient; - -namespace kurier -{ - public class MySQL - { - private MySqlConnection conn; - private MySqlCommand cmd; - private string database; - - public MySQL(string database) - { - this.database = database; - connect(); - } - - public void connect() - { - conn = new MySqlConnection((database != "" ? ("Database=" + database + ";") : "") - + "Data Source=" + getHost() + ";User Id=" + getUser() + ";Password=" + getPass() - + ";Port=" + getPort() + ";charset=utf8;"); - - conn.Open(); - } - - public void close() - { - try - { - conn.Close(); - conn = null; - } - catch (Exception) - { - } - } - - public bool isOpen() - { - return conn != null; - } - - public static string test() - { - try - { - MySqlConnection conn = new MySqlConnection("Data Source=" + getHost() + ";User Id=" + getUser() + ";Password=" + getPass() - + ";Port=" + getPort() + ";charset=utf8;"); - conn.Open(); - } - catch (MySqlException e) - { - return e.Message; - } - catch (Exception e) - { - return "Prawdopodobnie brakuje Ci dll-ki od MySQL'a.\n\n" + e.Message; - } - return ""; - } - - public MySqlDataReader select(string query) - { - MySqlCommand comm = new MySqlCommand(query, conn); - return comm.ExecuteReader(); - } - - public static string getHost() { return Properties.Settings.Default.HOST; } - public static string getUser() { return Properties.Settings.Default.USER; } - public static string getPass() { return Properties.Settings.Default.PASS; } - public static string getPort() { return Properties.Settings.Default.PORT; } - public static bool getConfigured() { return Properties.Settings.Default.CONFIGURED; } - - internal void backup(string filePath) - { - cmd = new MySqlCommand(); - cmd.Connection = conn; - MySqlBackup backup = new MySqlBackup(cmd); - backup.ExportInfo.AddCreateDatabase = true; - backup.ExportToFile(filePath); - } - } -} |