I am using this to insert some crowdtangle data. After the 17th line, $sqlstatement looks like this:sub insertsql { my ($dbh,$table,$data) = @_; my @qm; my @keys; my @values; my $i = -1; foreach my $k (keys %$data) { if (defined($data->{$k})) { $i++; $keys[$i] = $k; $values[$i] = $data->{$k}; $qm[$i] = '?'; } } my $keylist = join(",",@keys); my $qlist = join(",",@qm); my $sqlstatement = "insert into $table ($keylist) values ($qlist) +returning id"; my $sth = $dbh->prepare($sqlstatement); $sth->execute(@values) || die $sth->errstr; $sth->finish(); return; }
insert into crowdtangle (postUrl,crowdtangle_id,statistics,account,dew +indowfy_content,expandedLinks,score,description,message,posted,media, +subscriberCount,updated,platform,type) values (?,?,?,?,?,?,?,?,?,?,?, +?,?,?,?) returning id
When I execute the query I get this:
It is right, column posturl does not exist. The column name is postUrl with a capital U, like I had it in the query. What could be going on here?DBD::Pg::st execute failed: ERROR: column "posturl" of relation "crow +dtangle" does not exist LINE 1: insert into crowdtangle (postUrl,crowdtangle_id,statistics,a.. +. ^ at c:/perlmodules/SqlSupport.pm lin +e 70.
In reply to DBI/DBD::Pg changing my sql query somehow? by cormanaz
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |