Hi,
I have this error when i try to insert some values into the database via perl script.
there is my code
Please help
I have this error when i try to insert some values into the database via perl script.
there is my code
Code:
sub addWords { my $self = shift; my $wordsRef = shift; my @words = \$wordsRef; my $language = Language->new(); my $classId = undef; my $wordId = undef; if (!@words || !$language){ die "addWords invalid arguments."; } my $languageId = $language->id(); my $db = DBI->connect("dbi:SQLite:$dbFile","","",{RaiseError =>1, AutoCommit => 1, sqlite_unicode => 1}) or die "Unable to connect: $DBI::errstr\n"; foreach my $word (@words){ $db->do("INSERT INTO words(wordId, languageId, word, classId) VALUES ($wordId, $languageId, \"$word\", $classId);"); } $db->disconnect or warn "Disconnection failed: $DBI::errstr\n";; }
Comment