SQLite Forum

Extract files from sqlar with a directory prepended
Login
Here is what I see. I don't quite understand where `dirOnly` and `dir`are defined.

<https://sqlite.org/cli.html>

writefile() only has two arguments according to the above page. Why does it have  4 arguments below `($dir || name)`, `sqlar_uncompress(data, sz)`, `mode`, `mtime`?

Why does the same select command appear twice below?


What does `name NOT GLOB '*..[/\]*'` mean? So things like `abc../` is ignored? This does not make sense to me.

```
$ sqlite3 -Axfn my.db
-- open database 'my.db'
SELECT  ($dir || name), writefile(($dir || name), sqlar_uncompress(data, sz), mode, mtime) FROM sqlar WHERE (1) AND (data IS NULL OR $dirOnly = 0) AND name NOT GLOB '*..[/\]*'
SELECT  ($dir || name), writefile(($dir || name), sqlar_uncompress(data, sz), mode, mtime) FROM sqlar WHERE (1) AND (data IS NULL OR $dirOnly = 0) AND name NOT GLOB '*..[/\]*'
```