Paste: dump
Author: | foo |
Mode: | factor |
Date: | Mon, 2 Nov 2009 11:48:55 |
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/foo/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
begin-transaction
"/home/foo/dbdump/outgoing" [ [ add-data ] each ] with-directory-files
commit-transaction
] with-data ;
New Annotation