CSV - Comma Separated Values ---------------------------- Contents: 1 Data layout 1.1 Commas 1.2 Spaces 1.3 Double-Quotes ---------------------------- 1. Data Layout The implementation for CSV in libdba is as follows: Data is stored as ASCII text in a table layout. Each line in the file corresponds to a row in the table. Each column is separated by a comma in the file. An example: mike,brownlow,pizza joe,somebody,peanuts 1.1 Commas In the above example, the table is 3 columns by 2 rows. In the case where a comma is needed as part of the value, the value itself is enclosed in double-quotes: mike,brownlow,"pizza, rolls" joe,somebody,"peanuts, jellybeans" 1.2 Spaces At this point it should be noted that the following entry would include the spaces before and after the commas and values (there is space after rolls): mike,brownlow, pizza and rolls The third column above (within single quotes) would be: ' pizza and rolls ' 1.3 Double-Quotes Because we have introduced double-quotes, it is necessary to allow for a way to have double-quotes in the value. This can be done by using two double-quotes directly one after the other: mike,brownlow,"pizza and ""sausage rolls""" Here, the true value of the third column is: pizza and "sausage rolls"