예제 #1
0
 internal void OnInfoMessage(MySqlInfoMessageEventArgs args)
 {
     if (InfoMessage != null)
     {
         InfoMessage(this, args);
     }
 }
예제 #2
0
        public virtual List <MySqlError> ReportWarnings(MySqlConnection connection)
        {
            List <MySqlError> warnings = new List <MySqlError>();

            MySqlCommand cmd = new MySqlCommand("SHOW WARNINGS", connection);

            cmd.InternallyCreated = true;
            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    warnings.Add(new MySqlError(reader.GetString(0),
                                                reader.GetInt32(1), reader.GetString(2)));
                }
            }

            MySqlInfoMessageEventArgs args = new MySqlInfoMessageEventArgs();

            args.errors = warnings.ToArray();
            if (connection != null)
            {
                connection.OnInfoMessage(args);
            }
            return(warnings);
        }
예제 #3
0
파일: Driver.cs 프로젝트: tvrjcf/Demo
        public void ReportWarnings()
        {
            ArrayList errors = new ArrayList();

            MySqlCommand cmd = new MySqlCommand("SHOW WARNINGS", connection);

            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    errors.Add(new MySqlError(reader.GetString(0),
                                              reader.GetInt32(1), reader.GetString(2)));
                }

                hasWarnings = false;
                // MySQL resets warnings before each statement, so a batch could indicate
                // warnings when there aren't any
                if (errors.Count == 0)
                {
                    return;
                }

                MySqlInfoMessageEventArgs args = new MySqlInfoMessageEventArgs();
                args.errors = (MySqlError[])errors.ToArray(typeof(MySqlError));
                if (connection != null)
                {
                    connection.OnInfoMessage(args);
                }
            }
        }