The CsvWriter class for safe CSV data creation.
More...
#include <CsvWriter.qc.dox.h>
|
| | constructor (Qore::OutputStream output, *hash opts) |
| | creates the CsvWriter in single-type mode with the OutputStream and an optional option hash
|
| |
| | constructor (Qore::OutputStream output, hash spec, hash opts) |
| | creates the CsvWriter in multi-type mode with the OutputStream and an option hash
|
| |
| | constructor (string n_errname, *hash< auto > n_opts) |
| | Creates the AbstractCsvWriter in single-type mode.
|
| |
| | constructor (string n_errname, hash< auto > spec, hash< auto > n_opts) |
| | Creates the AbstractCsvWriter in single-type mode.
|
| |
|
*hash< string, AbstractDataField > | getRecordType () |
| | Returns the description of the record type, if any.
|
| |
| | write (list< auto > l) |
| | Stream the contents of the list into the output.
|
| |
| | write (Qore::AbstractIterator iterator) |
| | Stream an iterator into the output.
|
| |
| | write (Qore::SQL::SQLStatement iterator) |
| | Stream an iterator into the output.
|
| |
| | writeLine (hash< auto > values) |
| | Write a line with headers-values hash.
|
| |
| | writeLine (list< auto > values) |
| | Write a line with a list of values; data are checked against column rules.
|
| |
| | writeLine (string type, hash< auto > values) |
| | Write a line for a specific record from a hash to the output.
|
| |
| | writeLine (string type, list< auto > values) |
| | Write a line with headers-values list.
|
| |
|
|
| writeRawLine (list values) |
| | renders the line and writes it to the output stream
|
| |
| string | prepareRawLine (list< auto > values) |
| | Prepare a string (line with EOF) with formatting and escaping.
|
| |
|
| processCommonOptions (*hash< auto > n_opts, int C_OPTx) |
| | Process options and set internal variables.
|
| |
|
| processSpec () |
| | Process specification and set internal variable for mapping.
|
| |
|
| writeHeaders () |
| | Write csv headers.
|
| |
|
abstract | writeRawLine (list< auto > values) |
| | This method must be overridden in child classes to provide the output implementation.
|
| |
|
|
StreamWriter | output |
| | the output stream for the CSV data
|
| |
|
string | baseTemplate |
| | base template for value format
|
| |
|
int | block = 1000 |
| | block size for bulk DML
|
| |
|
bool | checkElementCounts = False |
| | verify the column count for every row; if a row does not match, then throw a CSVFILEITERATOR-DATA-ERROR exception
|
| |
|
string | encoding |
| | output file character encoding
|
| |
|
string | eol = EOL_UNIX |
| | end of line sequence
|
| |
|
*code | info_log |
| | a closure/call reference for informational logging when using write(SQLStatement)
|
| |
|
int | lineNo = 0 |
| | the latest line number
|
| |
|
hash | m_out_by_idx |
| | mapping output field by index
|
| |
|
hash | m_out_by_name |
| | mapping output field by name
|
| |
|
string | m_quoteEscapeChar = "\\" |
| | quote escape character
|
| |
|
bool | optimal_quotes = True |
| | stores the optimal quotes option
|
| |
|
const | Options = ... |
| | valid options for the object (a hash for quick lookups of valid keys)
|
| |
|
string | quote = "\"" |
| | field content delimiter
|
| |
|
string | separator = "," |
| | field separator
|
| |
|
bool | write_headers = True |
| | this flag determines if any stored headers are output
|
| |
The CsvWriter class for safe CSV data creation.
◆ constructor() [1/2]
| CsvUtil::CsvWriter::constructor |
( |
Qore::OutputStream | output, |
|
|
*hash | opts ) |
creates the CsvWriter in single-type mode with the OutputStream and an optional option hash
- Parameters
-
- Exceptions
-
| CSVSTREAMWRITER-ERROR | in the case of incorrect options |
◆ constructor() [2/2]
| CsvUtil::CsvWriter::constructor |
( |
Qore::OutputStream | output, |
|
|
hash | spec, |
|
|
hash | opts ) |
creates the CsvWriter in multi-type mode with the OutputStream and an option hash
- Parameters
-
- Exceptions
-
| CSVSTREAMWRITER-ERROR | in the case of incorrect options |