Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
No - that syntax is indeed illegal in Sybase ASE (and I suspect MS-SQL).

This has nothing to do with the placeholder type - it's because the main point of placeholders is performance - it's so that you can re-use a SQL statement many times with different parameters without having to re-compile and re-optimize it. With a complex SQL query this can make a very big difference in performance (SQL parsing and optimization can take many 100s of milliseconds, much more that the actual fetching of the data on a large system).

With Sybase and MS-SQL what happens is that DBD::Sybase detects that one or more ?-style placeholders are in the SQL statement. This is then passed to the ct_dynamic() API, which performs the "prepare" step on the server, identifies the parameter types (based on the column types in the WHERE clause) and returns a handle to this prepared statement. This is now basically a temporary stored procedure.

DBD::Sybase has never done any client-side placeholder processing.

Personally I fail to see the point of using placeholders in the SELECT clause, unless there's some weird variable quoting issue that the OP wants to handle.

BTW - the DBI docs also state that ?-style placeholders will normally only work in WHERE or VALUES clauses: https://metacpan.org/pod/DBI#Placeholders-and-Bind-Values

Michael


In reply to Re^5: fetchall_arrayref hangs with placeholders query with no results by mpeppler
in thread fetchall_arrayref hangs with placeholders query with no results by TieUpYourCamel

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2023-11-30 02:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?