Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks
Given the following snippet which adds a record into a simple Sqlite Database perfectly working
my $Tag1="hallo"; my $Tag2="bye"; my $dbh = DBI->connect( "dbi:SQLite:$DbFullPath", '', '', { sqlite_uni +code => 1 } ) || die "Cannot connect: $DBI::errstr"; $dbh->do('INSERT INTO Data (Tag1, Tag2) VALUES (?, ?)', undef, standardize($Tag1), standardize($Tag1)); $dbh->disconnect; sub standardize{ my $string=shift; #manipulating string $string=~ s/\'/\'\'/g; $string=~ s/^\s+|\s+$//g; $string=~ s/\t/ /g; return $string; }
Why is the following (updatin an entry) not working? (Error message "syntax error")
my $ID_read=1; my $dbh = DBI->connect( "dbi:SQLite:$DbFullPath", '', '', { sqlite_uni +code => 1 } ) || die "Cannot connect: $DBI::errstr"; $dbh->do ('UPDATE Data SET Tag1=?, Tag2=? WHERE ID=$ID_read VALUES (?, + ?)', undef, standardize($Tag1), standardize($Tag1)); $dbh->disconnect;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Update Sqlite References
by 1nickt (Canon) on Jan 05, 2017 at 20:19 UTC | |
by kennethk (Abbot) on Jan 05, 2017 at 20:24 UTC | |
|
Re: Update Sqlite References
by Anonymous Monk on Jan 05, 2017 at 20:25 UTC | |
by NetWallah (Canon) on Jan 06, 2017 at 05:37 UTC |