]> gitweb.factorcode.org Git - factor.git/blob - extra/db/info/info.factor
parsed -> suffix!, add append!
[factor.git] / extra / db / info / info.factor
1 USING: accessors sequences generalizations io.encodings.utf8 db.postgresql parser combinators vocabs.parser db.sqlite
2 io.files ;
3 IN: db.info
4 ! having sensative (and likely to change) information directly in source code seems a bad idea
5 : get-info ( -- lines ) current-vocab name>> "vocab:" "/dbinfo.txt" surround utf8 file-lines ;
6 SYNTAX: get-psql-info <postgresql-db> get-info 5 firstn
7     {
8         [ >>host ]
9         [ >>port ]
10         [ >>username ]
11         [ [ f ] [ ] if-empty >>password ]
12         [ >>database ]
13     } spread suffix! ;
14
15 SYNTAX: get-sqlite-info get-info first <sqlite-db> suffix! ;