Paste: sqlite compresses/importer
Author: | vegai |
Mode: | factor |
Date: | Sun, 27 Sep 2009 11:36:26 |
Plain Text |
USING: accessors compression.zlib sequences io.files io.encodings.binary io.directories byte-arrays kernel namespaces db.tuples db.types db db.sqlite fry ;
IN: dataimporter
TUPLE: row id data ;
C: <row> row
row "ROW"
{
{ "id" "ID" VARCHAR +unique+ }
{ "data" "DATA" BLOB }
} define-persistent
: with-data ( quot -- )
'[ "/home/vegai/dbdump/fac-xml.db" <sqlite-db> _ with-db ] call ; inline
: add-data ( file -- )
dup binary file-contents compress data>>
<row> insert-tuple ;
: main ( -- )
[
row recreate-table
"/home/vegai/dbdump/outgoing" [ [ add-data ] each ] with-directory-files
] with-data ;
New Annotation