mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 02:46:10 +02:00
Implement support for \' as the CSV separator.
The option "fields optionally enclosed by" was missing a way to easily specify a single quote as the quoting character. Add '\'' to the existing solution '0x27' which isn't as friendly. See #705.
This commit is contained in:
parent
07cdf3e7e5
commit
81be9ae60e
BIN
docs/_build/doctrees/environment.pickle
vendored
BIN
docs/_build/doctrees/environment.pickle
vendored
Binary file not shown.
BIN
docs/_build/doctrees/ref/csv.doctree
vendored
BIN
docs/_build/doctrees/ref/csv.doctree
vendored
Binary file not shown.
14
docs/_build/html/_sources/ref/csv.rst.txt
vendored
14
docs/_build/html/_sources/ref/csv.rst.txt
vendored
@ -184,10 +184,16 @@ When loading from a `CSV` file, the following options are supported:
|
||||
|
||||
- *fields optionally enclosed by*
|
||||
|
||||
Takes a single character as argument, which must be found inside
|
||||
single quotes, and might be given as the printable character itself,
|
||||
the special value \t to denote a tabulation character, or `0x` then
|
||||
an hexadecimal value read as the ASCII code for the character.
|
||||
Takes a single character as argument, which must be found inside single
|
||||
quotes, and might be given as the printable character itself, the
|
||||
special value \t to denote a tabulation character, the special value \'
|
||||
to denote a single-quote, or `0x` then an hexadecimal value read as the
|
||||
ASCII code for the character.
|
||||
|
||||
The following options specify the same enclosing character, a single quote::
|
||||
|
||||
fields optionally enclosed by '\''
|
||||
fields optionally enclosed by '0x27'
|
||||
|
||||
This character is used as the quoting character in the `CSV` file,
|
||||
and defaults to double-quote.
|
||||
|
||||
14
docs/_build/html/ref/csv.html
vendored
14
docs/_build/html/ref/csv.html
vendored
@ -215,10 +215,16 @@ default.</p>
|
||||
between the separator and the value.</p>
|
||||
</li>
|
||||
<li><p class="first"><em>fields optionally enclosed by</em></p>
|
||||
<p>Takes a single character as argument, which must be found inside
|
||||
single quotes, and might be given as the printable character itself,
|
||||
the special value t to denote a tabulation character, or <cite>0x</cite> then
|
||||
an hexadecimal value read as the ASCII code for the character.</p>
|
||||
<p>Takes a single character as argument, which must be found inside single
|
||||
quotes, and might be given as the printable character itself, the
|
||||
special value t to denote a tabulation character, the special value ‘
|
||||
to denote a single-quote, or <cite>0x</cite> then an hexadecimal value read as the
|
||||
ASCII code for the character.</p>
|
||||
<p>The following options specify the same enclosing character, a single quote:</p>
|
||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">fields</span> <span class="n">optionally</span> <span class="n">enclosed</span> <span class="n">by</span> <span class="s1">'</span><span class="se">\'</span><span class="s1">'</span>
|
||||
<span class="n">fields</span> <span class="n">optionally</span> <span class="n">enclosed</span> <span class="n">by</span> <span class="s1">'0x27'</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This character is used as the quoting character in the <cite>CSV</cite> file,
|
||||
and defaults to double-quote.</p>
|
||||
</li>
|
||||
|
||||
2
docs/_build/html/searchindex.js
vendored
2
docs/_build/html/searchindex.js
vendored
File diff suppressed because one or more lines are too long
@ -184,10 +184,16 @@ When loading from a `CSV` file, the following options are supported:
|
||||
|
||||
- *fields optionally enclosed by*
|
||||
|
||||
Takes a single character as argument, which must be found inside
|
||||
single quotes, and might be given as the printable character itself,
|
||||
the special value \t to denote a tabulation character, or `0x` then
|
||||
an hexadecimal value read as the ASCII code for the character.
|
||||
Takes a single character as argument, which must be found inside single
|
||||
quotes, and might be given as the printable character itself, the
|
||||
special value \t to denote a tabulation character, the special value \'
|
||||
to denote a single-quote, or `0x` then an hexadecimal value read as the
|
||||
ASCII code for the character.
|
||||
|
||||
The following options specify the same enclosing character, a single quote::
|
||||
|
||||
fields optionally enclosed by '\''
|
||||
fields optionally enclosed by '0x27'
|
||||
|
||||
This character is used as the quoting character in the `CSV` file,
|
||||
and defaults to double-quote.
|
||||
|
||||
@ -36,7 +36,9 @@
|
||||
|
||||
(defrule tab (and #\\ #\t) (:constant #\Tab))
|
||||
|
||||
(defrule separator (and #\' (or hex-char-code tab character ) #\')
|
||||
(defrule single-quote (and #\\ #\') (:constant #\'))
|
||||
|
||||
(defrule separator (and #\' (or hex-char-code tab single-quote character) #\')
|
||||
(:lambda (sep)
|
||||
(bind (((_ char _) sep)) char)))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user