diff --git a/README.md b/README.md index b9181c7..4ce71b7 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,13 @@ not found in Quicklisp yet at the time of this writing: cd ~/quicklisp/local-projects/ git clone https://github.com/marijnh/Postmodern.git + git clone -b empty-strings-and-nil https://github.com/dimitri/cl-csv.git + git clone http://git.tapoueh.org/git/pgloader.git -Now fetch pgloader sources using `git clone` then you can use the #! script. -You might have to modify it because it's now hard coded to use -`/usr/local/bin/sbcl` and you probably want to change that part then: +Now you can use the `#!` script or build a self-contained binary executable +file, as shown below. You might have to modify it the `pgloader.lisp` script +because it's now hard coded to use `/usr/local/bin/sbcl` and you probably +want to change that part then: ./pgloader.lisp --help @@ -48,6 +51,15 @@ download the dependencies. ## Compile into a self-contained binary file +First, make sure you have downloaded all the required Common Lisp +dependencies that pgloader uses, and install the +[buildapp](http://www.xach.com/lisp/buildapp/) application: + + $ sbcl + * (ql:quickload "pgloader") + * (ql:quickload "buildapp") + * (buildapp:build-buildapp "./buildapp") + If you just installed *SBCL* and *Quicklisp* to use pgloader, that command should do it: @@ -55,8 +67,12 @@ should do it: --asdf-tree ~/quicklisp/dists \ --load-system pgloader \ --entry pgloader:main \ + --dynamic-space-size 4096 \ --output pgloader.exe +You can also use the option `--compress-core` if your platform supports it, +so has to reduce the size of the generated binary. + When you're a Common Lisp developper or otherwise already using Quicklisp with some *local-projects* and a local source registry setup for *asdf*, use a command line like this: @@ -67,6 +83,7 @@ a command line like this: --asdf-tree ~/quicklisp/dists \ --load-system pgloader \ --entry pgloader:main \ + --dynamic-space-size 4096 \ --output pgloader.exe That command requires a `manifest.ql` file that you can obtain with the lisp @@ -76,9 +93,16 @@ command: ## Usage -Use the `--file` parameter to give pgloader a command file to parse, it will start +Give as many command files that you need to pgloader: - ./pgloader.lisp -f + ./pgloader.lisp + +See the documentation file `pgloader.1.md` for details. You can compile that +file into a manual page or an HTML page thanks to the `pandoc` application: + + $ apt-get install pandoc + $ pandoc pgloader.1.md -o pgloader.1 + $ pandoc pgloader.1.md -o pgloader.html ## TODO diff --git a/test/csv-empty-as-null.load b/test/csv-empty-as-null.load index d6bc9fc..febd638 100644 --- a/test/csv-empty-as-null.load +++ b/test/csv-empty-as-null.load @@ -1,5 +1,5 @@ LOAD CSV - FROM INLINE (f1, f2 null if "", f3) + FROM INLINE INTO postgresql://dim@localhost:54393/dim?nulls (f1, f2, f3) WITH truncate, fields optionally enclosed by '"', @@ -10,9 +10,10 @@ LOAD CSV $$ drop table if exists nulls; $$, $$ create table if not exists nulls (id serial, f1 text, f2 text, f3 text); $$; -"quoted empty string","","should be empty string when the CSV parser is improved" -"empty string",,"should be null" +"quoted empty string","","should be empty string" +"no value between separators",,"should be null" "quoted blanks"," ","should be blanks" -"blanks", ,"should be null" +"unquoted blanks between separators", ,"should be null" +"unquoted string",no quote,"should be 'no quote'" "quoted separator","a,b,c","should be 'a,b,c'"