Determine if a column value needs to be quoted

from the Artful MySQL Tips List



    public bool MustQuoteValue( string schema, string table, string column ) {
      bool quote = false;
      string type = ColumnType( schema, table, column ).Substring(0,3).ToUpper();
      switch ( type ) {
        case "CHA":
        case "DAT":
        case "BIN":
        case "TEX":
        case "TIM":
        case "VAR": quote = true; break;
        default: break;
      }
      return quote;
    }




Return to the Artful MySQL Tips page