Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-93

Allow the handling of NULL values

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.9.0
    • Documentation, Parser, Printer
    • None

    Description

      Requirement

      To use the CSV parser and printer for SQL Dumps it would be nice if they could handle null values.

      Specification

      To distinguish between an empty or null value empty values always gets quoted to denote an empty string. The absence of an quote denotes a null value

      Configuration

      To activate the behavior call the method withNullObjectPatternEnabled of the CSVFormat with parameter true.

      Modifications

      See attached patch.

      Example

      This example using as base the DEFAULT CSVFormat modified by the NullObjectPattern behavior.

      Array-Data CSV-Data
      {null,"","A"," "}; ,"A",""," "
      {"",null,"A"," "} "",,"A"," "
      {"","A",null} "","A",
      NULL in DBMS proprietary CSV formats
      Product Strategy Documentation / Link
      PostgreSQL If NULL should be preserved all non NULL values gets quoted PostgreSQL 8.1 Manual
      MySQL NULL Values will be replaced by the letters NULL or escaped by \n not found, verified with MySQL Workbench
      MS SQL NULL values will be exported as empty strings (no quotes). Strings will be quoted if needed. Import can interpret them as null MSDN
      Oracle NULL Values will be replaced by the letters NULL Manual

      Attachments

        1. CSV-93.diff
          11 kB
          Gary D. Gregory
        2. patch.txt
          16 kB
          Georg Tsakumagos

        Issue Links

          Activity

            People

              Unassigned Unassigned
              geo Georg Tsakumagos
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: