Subject: | sth->bind_param broken |
assigning parameters via bind_param doesn't work. The STR script (attached) produces
DBD::Cassandra::st execute failed: Error 8704: there were 1 markers(?) in CQL but 0 bound variables at /vagrant/pswitchshare/bind_param_cassandra.pl line 11.
the problem/fix may appear here:
--- /usr/share/perl5/vendor_perl/DBD/Cassandra/st.pm.orig 2017-04-13 00:52:47.466845955 +0000
+++ /usr/share/perl5/vendor_perl/DBD/Cassandra/st.pm 2017-04-13 00:53:11.097029807 +0000
@@ -8,7 +8,7 @@
sub bind_param {
my ($sth, $pNum, $val, $attr)= @_;
- my $params= $sth->{cass_params};
+ my $params= $sth->{cass_params} //= [];
$params->[$pNum-1] = $val;
1;
}
Subject: | bind_param_cassandra.pl |
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect("DBI:Cassandra:keyspace=system;host=cassandra", 'cassandra', 'cassandra', {RaiseError => 1});
my $sth = $dbh->prepare("select * from hints WHERE target_id = ?");
$sth->bind_param(1 => 'someuuid');
$sth->execute();
$dbh->disconnect();