Re: bind_param oddity?




On Nov 22, 2006, at 12:10 PM, Kevin Spencer wrote:

Hi guys,
<snip>

Now, because I want use use placeholders instead, I attempt the following:

my $SQL = <<EOSQL;
select count(*) from ?
where TRXSTATUS = ?
and (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(TRXTIMESTAMP)) < ?
EOSQL

<snip>
Anyone see an obvious error in my code that I'm overlooking?

Thanks.

--
Kevin.

You can't replace table names with placeholders. The quick sort-of intuitive
explanation is that the database can cache an internal version of the
query with a execution plan, and can put in placeholder values at
execution time for constants, but it can't do this for table or column names,
or for a different number of variables in "IN" lists (because this might parse
to a concatenation of 'OR' clauses, for example).

--
Christopher Sarnowski
csarnows@xxxxxxxxxxxxxx
Penn Bioinformatics Core
1316 Blockley Hall MC 6021
(215) 746-7784


.



Relevant Pages

  • Re: As a generale rule - Query or VBA?
    ... I agree with you Rick, I was recently working on a database that had ... the query is saved, then JET will save the fastest execution path. ...
    (comp.databases.ms-access)
  • Re: How can I achieve efficiency and speed for high traffic dating web site
    ... you have to do an individual query. ... there of the stuff you will need on every page, call it a cache. ... you write to the real database. ...
    (comp.lang.php)
  • Re: [Info-Ingres] Insert performance (was "Sun buys MySQL")
    ... In Java I used to trap front-end queries en-route to the database ... As well as the query text, ... cache a limited number of queries and would cull the least recently used ...
    (comp.databases.ingres)
  • Re: Query Help
    ... > objects in any database. ... that parcitular script is executed, I somehow tought that it shouln't put it ... Unless I misunderstand your tables and query, ... I have seen execution plans where the subquery gets ...
    (microsoft.public.sqlserver.programming)
  • Re: Business Entity Hierarchy OO question
    ... create a query that will pull the exact data you need. ... The more you cache, the less you have to go to the database (over ... loads most of the tables upon first reference (because they're small, ...
    (microsoft.public.dotnet.languages.csharp)