context: using MySql.Data.MySqlClient;
  using System;
  using USC.GISResearchLab.Common.Core.Databases;
  using USC.GISResearchLab.Common.Databases.TypeConverters;
  
  namespace USC.GISResearchLab.Common.Databases.MySql
  {
      public class MySqlTypeConverter : AbstractDatabaseDataProviderTypeConverterManager
      {
  
          #region TypeNames
          public static string TYPENAME_BigInt = "BigInt";
          public static string TYPENAME_Binary = "Binary";
          public static string TYPENAME_Bit = "Bit";
          public static string TYPENAME_Blob = "Blob";
          public static string TYPENAME_Byte = "Byte";
          public static string TYPENAME_Char = "Char";
          public static string TYPENAME_Date = "Date";
          public static string TYPENAME_Datetime = "Datetime";
          public static string TYPENAME_Decimal = "Decimal";
          public static string TYPENAME_Double = "Double";
          public static string TYPENAME_Enum = "Enum";
          public static string TYPENAME_Float = "Float";
          public static string TYPENAME_Geometry = "Geometry";
          public static string TYPENAME_Int = "Int";
          public static string TYPENAME_Int16 = "Int16";
          public static string TYPENAME_Int24 = "Int24";
          public static string TYPENAME_Int32 = "Int32";
          public static string TYPENAME_Int64 = "Int64";
          public static string TYPENAME_LongText = "LongText";
          public static string TYPENAME_LongBlob = "LongBlob";
          public static string TYPENAME_MediumBlob = "MediumBlob";
          public static string TYPENAME_MediumText = "MediumText";
          public static string TYPENAME_Newdate = "Newdate";
          public static string TYPENAME_NewDecimal = "NewDecimal";
          public static string TYPENAME_Set = "Set";
          public static string TYPENAME_String = "String";
          public static string TYPENAME_Text = "Text";
          public static string TYPENAME_Time = "Time";
          public static string TYPENAME_Timestamp = "Timestamp";
          public static string TYPENAME_TinyBlob = "TinyBlob";
          public static string TYPENAME_TinyText = "TinyText";
          public static string TYPENAME_UByte = "UByte";
          public static string TYPENAME_UInt16 = "UInt16";
          public static string TYPENAME_UInt24 = "UInt24";
          public static string TYPENAME_UInt32 = "UInt32";
          public static string TYPENAME_UInt64 = "UInt64";
          public static string TYPENAME_VarBinary = "VarBinary";
          public static string TYPENAME_VarChar = "VarChar";
          public static string TYPENAME_VarString = "VarString";
          public static string TYPENAME_Year = "Year";
          #endregion
  
          public MySqlTypeConverter()
          {
              DatabaseType = DatabaseType.MySql;
              DataProviderType = DataProviderType.MySql;
          }
  
          public override int GetDefaultLength(DatabaseSuperDataType type)
          {
              throw new NotImplementedException();
          }
  
  
          public override int GetDefaultPrecision(DatabaseSuperDataType type)
          {
              throw new NotImplementedException();
          }
  
          public override DatabaseSuperDataType ToSuperType(object dbType)
          {
              DatabaseSuperDataType ret;
              MySqlDbType type = (MySqlDbType)dbType;
  
              switch (type)
              {
                  case MySqlDbType.Binary:
                      ret = DatabaseSuperDataType.Binary;
                      break;
                  case MySqlDbType.Bit:
                      ret = DatabaseSuperDataType.Bit;
                      break;
                  case MySqlDbType.Blob:
                      ret = DatabaseSuperDataType.Blob;
                      break;
                  case MySqlDbType.Date:
                      ret = DatabaseSuperDataType.Date;
                      break;
                  case MySqlDbType.Datetime:
                      ret = DatabaseSuperDataType.DateTime;
                      break;
                  case MySqlDbType.Decimal:
                      ret = DatabaseSuperDataType.Decimal;
                      break;
                  case MySqlDbType.Double:
                      ret = DatabaseSuperDataType.Double;
                      break;
                  case MySqlDbType.Float:
                      ret = DatabaseSuperDataType.Float;
                      break;
                  case MySqlDbType.Geometry:
                      ret = DatabaseSuperDataType.Geometry;
                      break;
                  case MySqlDbType.Int16:
                      ret = DatabaseSuperDataType.Int16;
                      break;
                  case MySqlDbType.Int24:
                      ret = DatabaseSuperDataType.Int24;
                      break;
                  case MySqlDbType.Int32:
                      ret = DatabaseSuperDataType.Int32;
                      break;
                  case MySqlDbType.Int64:
                      ret = DatabaseSuperDataType.Int64;
                      break;
                  case MySqlDbType.MediumBlob:
                      ret = DatabaseSuperDataType.MediumBlob;
                      break;
                  case MySqlDbType.Newdate:
                      ret = DatabaseSuperDataType.Newdate;
                      break;
                  case MySqlDbType.NewDecimal:
                      ret = DatabaseSuperDataType.NewDecimal;
                      break;
                  case MySqlDbType.Set:
                      ret = DatabaseSuperDataType.Set;
                      break;
                  case MySqlDbType.String:
                      ret = DatabaseSuperDataType.String;
                      break;
                  case MySqlDbType.Text:
                      ret = DatabaseSuperDataType.Text;
                      break;
                  case MySqlDbType.Time:
                      ret = DatabaseSuperDataType.Time;
                      break;
                  case MySqlDbType.Timestamp:
                      ret = DatabaseSuperDataType.Timestamp;
                      break;
                  case MySqlDbType.TinyBlob:
                      ret = DatabaseSuperDataType.TinyBlob;
                      break;
                  case MySqlDbType.TinyText:
                      ret = DatabaseSuperDataType.TinyText;
                      break;
                  case MySqlDbType.UByte:
                      ret = DatabaseSuperDataType.UByte;
                      break;
                  case MySqlDbType.UInt16:
                      ret = DatabaseSuperDataType.UInt16;
                      break;
                  case MySqlDbType.UInt24:
                      ret = DatabaseSuperDataType.UInt24;
                      break;
                  case MySqlDbType.UInt32:
                      ret = DatabaseSuperDataType.UInt32;
                      break;
                  case MySqlDbType.UInt64:
                      ret = DatabaseSuperDataType.UInt64;
                      break;
                  case MySqlDbType.VarBinary:
                      ret = DatabaseSuperDataType.VarBinary;
                      break;
                  case MySqlDbType.VarChar:
                      ret = DatabaseSuperDataType.VarChar;
                      break;
                  case MySqlDbType.VarString:
                      ret = DatabaseSuperDataType.VarString;
                      break;
                  case MySqlDbType.Year:
                      ret = DatabaseSuperDataType.Year;
                      break;
                  default:
                      throw new Exception("Unexpected type: " + type);
              }
              return ret;
          }
  
  
          public MySqlDbType FromShowColumnsString(string type)
          {
              MySqlDbType ret = MySqlDbType.Text;
  
              if (String.Compare(type, TYPENAME_BigInt, true) == 0)
              {
                  ret = MySqlDbType.UInt64;
              }
              else if (String.Compare(type, TYPENAME_Binary, true) == 0)
              {
                  ret = MySqlDbType.Binary;
              }
              else if (String.Compare(type, TYPENAME_Bit, true) == 0)
              {
                  ret = MySqlDbType.Bit;
              }
              else if (String.Compare(type, TYPENAME_Blob, true) == 0)
              {
                  ret = MySqlDbType.Blob;
              }
              else if (String.Compare(type, TYPENAME_Byte, true) == 0)
              {
                  ret = MySqlDbType.Byte;
              }
              else if (String.Compare(type, TYPENAME_Char, true) == 0)
              {
                  ret = MySqlDbType.VarChar;
              }
  
gt:             else if (String.Compare(type, TYPENAME_Date, true) == 0)