Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

appending with (nolock) to the SQL

edited December 2003 in General
Using D6, RB Enterprise 7 against MSSQL Server 2000.
I have a lot of reports, some of them access a heavy load of data, and
therefore causing locks on the tables. More worse, lock escalation can
occur. In my app, I have quietened my Sql statements by adding "with
(nolock)" to the table names. I want to do this with the reports too, but I
am unsure how to achieve this. I am sure, this is not possible using DADE
only.

My preferred solution therefore would be a RAP function I can call in some
event:

Function AddWithNoLock(Report: TppReport; sTableName: String):Boolean;

How can I isolate the sql-statement before execution but after the auto
search fields are set and how can I write back the modified sql-statement?

Thank you for every opinion.
Bernd

Comments

  • edited December 2003
    Hi Bernd,

    Unfortunately you will not be able to do this in RAP. You could possibly
    add some code to the DADE plugin you are using to connect to the database.
    I assume you are using ADO, so you could take a look inside the daADO.pas
    file and find the TdaADOQueryDataView.SQLChanged method. This is where the
    sql text is extracted and then assigned to the query. Before the
    SQL.MagicSQLText is assigned to the query (at the bottom), you could add
    some code to place your nolock code in the sql.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.