DBD::Sybase placeholder support

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
I was provided with an interesting rumor today: it seems placeholders *do*
work in DBD::Sybase!  I haven't been able to test it yet, but perhaps
someone out there would?  

--jkl

Begin forwarded message:


The following DBD-Sybase seems to be working:


  foreach $router (keys(%{$results})) {
	my($oid);
	foreach $oid (keys(%{$$results{$router}})) {

	    # now do db updates, raw first.
	    my ($sth);
	    if (!($sth = $dbh->prepare(
		      "insert into test_raw_interface_info (
                     netdevicename,
                     update_time,
                     ifDescr,
                     ifAlias,
                     ifHCInOctets,
		    ifHCInUcastPkts,
                     ifHCInMulticastPkts,
                     ifHCInBroadcastPkts,
                     ifHCOutOctets,
                     ifHCOutUcastPkts,
                     ifHCOutMulticastPkts,
                     ifHCOutBroadcastPkts,
                     ifInErrors,
                     ifOutErrors,
  	            cportQosDropPktsIngress,
                     cportQosDropPktsEgress,
                     ifSpeed,
                     ifOperStatus )
                     values (  ?,
                     GETUTCDATE(),
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
                     ?,
  	            ?,
                     ?,
                     ?,
                     ? )")))
	    {
		warn "Could not prepare statement: " . $dbh->errstr;
		next;
	    }
	
	    if ( ! ( $sth->bind_param(1,$router))) {
		warn "Could not bind parameter 1: " . $sth->{Statement} .
$dbh->errstr;
		next;
	    }
	
	    if ( ! ($sth->bind_param(2,$$results{$router}{$oid}{'ifDescr'},
				     { TYPE => SQL_VARCHAR}))) {
		warn "Could not bind parameter 2: " . $sth->{Statement} .
$dbh->errstr;
		next;
	    }
	
	    if ( ! ($sth->bind_param(3,$$results{$router}{$oid}{'ifAlias'},
				     { TYPE => SQL_VARCHAR}))) {
		warn "Could not bind parameter 3: " . $sth->{Statement} .
$dbh->errstr;
		next;
	    }
	
	    $sth->bind_param(4,$$results{$router}{$oid}{'ifHCInOctets'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(5,$$results{$router}{$oid}{'ifHCInUcastPkts'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(6,$$results{$router}{$oid}{'ifHCInMulticastPkts'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(7,$$results{$router}{$oid}{'ifHCInBroadcastPkts'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(8,$$results{$router}{$oid}{'ifHCOutOctets'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(9,$$results{$router}{$oid}{'ifHCOutUcastPkts'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(10,
			     $$results{$router}{$oid}{'ifHCOutMulticastPkts'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(11,
			     $$results{$router}{$oid}{'ifHCOutBroadcastPkts'},
			     { TYPE => SQL_BIGINT});
             $sth->bind_param(12,$$results{$router}{$oid}{'ifInErrors'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(13,$$results{$router}{$oid}{'ifOutErrors'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(14,
			     $$results{$router}{$oid}{'cportQosDropPktsIngress'},
			     { TYPE => SQL_BIGINT});
             $sth->bind_param(15,
			     $$results{$router}{$oid}{'cportQosDropPktsEgress'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(16,$$results{$router}{$oid}{'ifSpeed'},
			     { TYPE => SQL_BIGINT});
	    $sth->bind_param(17,$$results{$router}{$oid}{'ifOperStatus'},
			     { TYPE => SQL_INTEGER});

	    if ( ! $sth->execute()) {
		warn "Could not execute statement: " . $sth->{Statement} .
$sth->errstr;
		next;
	    }



This is on linux x86_64.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.