Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: fetchall_arrayref hangs with placeholders query with no results

by perlfan (Vicar)
on Apr 15, 2021 at 17:13 UTC ( [id://11131337]=note: print w/replies, xml ) Need Help??


in reply to fetchall_arrayref hangs with placeholders query with no results

How does selectall_arrayref work out? This necessarily uses fetchall_arrayref.

Replies are listed 'Best First'.
Re^2: fetchall_arrayref hangs with placeholders query with no results
by TieUpYourCamel (Scribe) on Apr 15, 2021 at 17:38 UTC
    Thanks for the suggestion; unfortunately it produces the same results.
    print "\nTesting no placeholders, no results $dsn\n"; my $sth = $dbh->prepare("select 'test' where 1=0"); print Dumper $dbh->selectall_arrayref($sth); print "\nTesting placeholders with results $dsn\n"; my $sthSecond = $dbh->prepare("select ? where 1=1"); print Dumper $dbh->selectall_arrayref($sthSecond); print "\nTesting placeholders with no results $dsn\n"; my $sthThird = $dbh->prepare("select ? where 1=0"); print Dumper $dbh->selectall_arrayref($sthThird);
    Results:
    Testing no placeholders, no results dbi:Sybase:server=xxx.xxx.xxx.xxx $VAR1 = []; Testing placeholders with results dbi:Sybase:server=xxx.xxx.xxx.xxx $VAR1 = [ [ undef ] ]; Testing placeholders with no results dbi:Sybase:server=xxx.xxx.xxx.xxx $VAR1 = []; Testing no placeholders, no results dbi:Sybase:server=xxx.xxx.xxx.xxx; +tdsLevel=CS_TDS_495 $VAR1 = []; Testing placeholders with results dbi:Sybase:server=xxx.xxx.xxx.xxx;td +sLevel=CS_TDS_495 $VAR1 = [ [ undef ] ]; Testing placeholders with no results dbi:Sybase:server=xxx.xxx.xxx.xxx +;tdsLevel=CS_TDS_495 (hang)
      I'd be worried if it didn't produce the same result.

      I was surprised to read this in DBD::Sybase, might be your client lib:

      >DBD::Sybase supports the use of ? placeholders in SQL statements as long as the underlying library and database engine supports it. It does this by using what Sybase calls Dynamic SQL. The ? placeholders allow you to write something like: ...
        When you use ? placeholders Sybase goes and creates a temporary stored procedure that corresponds to your SQL statement. You then pass variables to $sth->execute or $dbh->do, which get inserted in the query, and any rows are returned.

        So ... Sybase is obviously very different from the usual SQL standard ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131337]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (None)
    As of 2024-04-25 00:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found