Changes between Initial Version and Version 2 of Ticket #4397
- Timestamp:
- Dec 16, 2011, 9:37:09 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #4397 – Description
initial v2 1 I've noticed an issue in OGRFeature::GetFieldAsString() 1 Hi Even, 2 2 3 when a StringList value is exported, the following serialized notation is adopted: 4 {{{ 5 - value#1 = "A01" 6 - value#2 = "B02" 7 - serialized = "(2:A01,B01)" 8 }}} 3 so standing things there is a strong inconsistency in the SQLite [output] driver implementation.[[BR]] 9 4 10 this serialized format is generally fine (and is easily parsable by other apps), but will introduce fatal ambiguities when any COMMA is used by some value to be serialized: 11 {{{ 12 - value#1 = "A,01" 13 - value#2 = "B,02" 14 - serialized = "(2:A,01,B,01)" 15 }}} 5 I'll actually find several "serialized" values in any SpatiaLite DB created by ogr2ogr, and I'm completely unable to parse such values in a safe and consistent way. that's not all, such "serialized" values could be actually truncated, and there is no way to understand if some truncation occurred when readind the DB. Sorry, I didn't noticed this further issue. So, such "serialized" values into the DB are irremediably useless. 16 6 17 quite obviously, a serialized value like this can never be succesfully parsed so to retrieve the initial values. 7 On the other side I notice that the SHP driver completely omits to create any attribute/column of the StringList, IntegerList or RealList type: may be this one could be a better (and more consistent) design choice for the SQLite driver as well ? 18 8 19 suggested remedy: applying the same criteria used to mask quotes in SQL string, i.e. masking any COMMA found in the string value to be exported as COMMA-COMMA. 20 This would produce the following output: 21 {{{ 22 - value#1 = "A,01" 23 - value#2 = "B,02" 24 - serialized = "(2:A,,01,B,,01)" 25 }}} 26 27 a serialized string like this has no longer any ambiguity at all; and can be easily and safely parsed so to retrieve the original values. 28 29 please see the attached patch 30 31 best regards, 32 Sandro Furieri 9 by Sandro