public static bool CompareMySQLVersion(string str_curver, string str_filever) { switch (DBMaintain.GetMySQLVersionRole()) { case 0: return(str_curver.CompareTo(str_filever) >= 0); case 1: { string majorVersion = DBMaintain.getMajorVersion(str_curver); string majorVersion2 = DBMaintain.getMajorVersion(str_filever); return(majorVersion.CompareTo(majorVersion2) >= 0); } default: return(true); } }
public static int SetMySQLConnectionInfo(DbConnection con, string dbname, string host, int i_port, string usr, string pwd) { DbCommand dbCommand = null; if (con != null && con.State == ConnectionState.Open) { try { dbCommand = con.CreateCommand(); string text = host; try { if (DBMaintain.IsLocalIP(host)) { text = "127.0.0.1"; } } catch { } dbCommand.CommandText = string.Concat(new object[] { "update dbsource set db_type='MYSQL',db_name='", dbname, "',host_path='", text, "',port= ", i_port, ",user_name = '", usr, "',pwd='", pwd, "' where active_flag = 2 " }); int num = dbCommand.ExecuteNonQuery(); int result; if (num < 0) { result = -1; return(result); } result = 1; return(result); } catch { } finally { try { dbCommand.Dispose(); } catch { } } return(-1); } return(-1); }