use warnings; use strict; use DBI; use Data::Dumper; runTest(''); runTest(';tdsLevel=CS_TDS_495'); sub runTest { my ($tdsLevel) = @_; my $dsn = "dbi:Sybase:server=172.28.79.294$tdsLevel"; my $UserName = 'myusername'; my $Password = 'supersecretpassword'; my $dbh = DBI->connect( $dsn, $UserName, $Password, ) or ( print "Can't connect to the DB: $DBI::errstr\n" and die ); print "\nTesting no placeholders, no results $dsn\n"; my $sth = $dbh->prepare("select 'test' where 1=0"); $sth->execute(); my $results = $sth->fetchall_arrayref( {} ); print Dumper $results; print "\nTesting placeholders with results $dsn\n"; my $sthSecond = $dbh->prepare("select ? where 1=1"); $sthSecond->execute("test"); my $resultsSecond = $sthSecond->fetchall_arrayref( {} ); print Dumper $resultsSecond; print "\nTesting placeholders with no results $dsn\n"; my $sthThird = $dbh->prepare("select ? where 1=0"); $sthThird->execute("test"); my $resultsThird = $sthThird->fetchall_arrayref( {} ); print Dumper $resultsThird; $dbh->disconnect(); }