biblesearch / tmp / insert_content.pl /
fe02147 10 years ago
1 contributor
21 lines | 0.411kb
use strict;
use warnings;
use DBIx::Custom;
use Encode 'decode';

my ($book_id) = $ARGV[0] =~ /(\d+)/;

my @lines;
while (my $line = <>) {
  push @lines, decode('UTF-8', $line);
}

my $content = join '', @lines;

my $dbi = DBIx::Custom->connect(
  dsn => "dbi:SQLite:dbname=../db/bible.db",
  option => {sqlite_unicode => 1}
);

$dbi->update({content => $content}, table => 'book', where => {id => $book_id});