DBTools.h++ generates a unique table alias each time a select statement is executed

Article ID: 804
Last updated: 29 Jan, 2008
Article ID: 804
Last updated: 29 Jan, 2008
Revision: 1
Views: 2894
Posted: 12 Aug, 1998
by --
Updated: 29 Jan, 2008
by
Problem


DBTools.h++ generates a unique table alias each time a SQL select statement is executed.

For example the statement:

    select name from customer
    

gets translated by DBTools.h++ the first time to

    select t1.name from customer t1
    
The next time the statement is executed, DBTools.h++ generates the following:
    select t2.name from customer t2
    

and so forth.

Since each SQL statement is unique, Oracle is forced to re-load and re-parse the statement each time, which is very inefficient.


Cause





Action


You can work around this problem by using the tag() method on the RWDBTable object. This forces DBTools.h++ to use the user provided alias. For example,
    RWDBTable custTable = m_Database.table(CUSTOMER).tag(CUST) 

causes DBTools.h++ to generate

    select CUST.name from customer CUST
    

each time.

Using the tag() method as well as RWDBBoundExpr should force DBToolsh++ to generate SQL that Oracle can re-use.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 804
Last updated: 29 Jan, 2008
Revision: 1
Views: 2894
Posted: 12 Aug, 1998 by --
Updated: 29 Jan, 2008 by

Others in this category