コード例 #1
0
        ///<summary>Returns a list of strings in a specific order.
        ///The strings are as follows; socket (service name), version_comment (service comment), hostname (server name), and MySQL version
        ///Oracle is not supported and will throw an exception to have the customer call us to add support.</summary>
        public static List <string> GetServiceInfo()
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <List <string> >(MethodBase.GetCurrentMethod()));
            }
            if (DataConnection.DBtype == DatabaseType.Oracle)
            {
                throw new Exception(Lans.g("Computer", "Currently not Oracle compatible.  Please call support."));
            }
            List <string> retVal = new List <string>();
            DataTable     table  = Db.GetTable("SHOW VARIABLES WHERE Variable_name='socket'");     //service name

            if (table.Rows.Count > 0)
            {
                retVal.Add(table.Rows[0]["VALUE"].ToString());
            }
            else
            {
                retVal.Add("Not Found");
            }
            table = Db.GetTable("SHOW VARIABLES WHERE Variable_name='version_comment'");          //service comment
            if (table.Rows.Count > 0)
            {
                retVal.Add(table.Rows[0]["VALUE"].ToString());
            }
            else
            {
                retVal.Add("Not Found");
            }
            try {
                table = Db.GetTable("SELECT @@hostname");              //server name
                if (table.Rows.Count > 0)
                {
                    retVal.Add(table.Rows[0][0].ToString());
                }
                else
                {
                    retVal.Add("Not Found");
                }
            }
            catch {
                retVal.Add("Not Found");                //hostname variable doesn't exist
            }
            retVal.Add(MiscData.GetMySqlVersion());
            return(retVal);
        }