cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBI/DBD::Pg changing my sql query somehow?
by talexb (Chancellor) on Jul 25, 2024 at 03:56 UTC | |
by cavac (Prior) on Jul 25, 2024 at 07:17 UTC | |
by parv (Parson) on Jul 25, 2024 at 08:15 UTC | |
by hippo (Archbishop) on Jul 25, 2024 at 08:43 UTC | |
Re: DBI/DBD::Pg changing my sql query somehow?
by bliako (Abbot) on Jul 24, 2024 at 19:42 UTC | |
by kikuchiyo (Hermit) on Jul 24, 2024 at 20:32 UTC |