ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Schall" <mike.sch...@gmail.com>
Subject Profiling Prepared Statements
Date Wed, 06 Feb 2008 21:09:08 GMT
I need to be able to profile statements and quickly get back to the id that
I gave the statement within the sql map file.  We are using MSSQL 2005 and
have always used sql traces to produce a top 10 longest running stored
procedures.  We have introduced dynamic sql statements and are now trying to
use the same trace method to profile the statements as they go through. The
sql trace only provides the prepared statement text without the id assigned
to the statement in the map file.

What I would like to do is add the statement id to the sql text as a comment
before it is prepared.  Adding the following code to the
DomSqlMapBuilder.csfor select tag (other tags would need similar code)
would solve my
problems.  I'm not sure if multiline comment syntax is common across
databases, but it could be added to providers.config if not.

How are others performance monitoring your statements?   Thoughts?

                if (_configScope.UseStatementNamespaces)
                {
                    select.Id = _configScope.ApplyNamespace(select.Id);
                }
                _configScope.ErrorContext.ObjectId = select.Id;

                //ADDED CODE
                XmlNode nameComment =
xmlNode.OwnerDocument.CreateCDataSection("/*" + select.Id + "*/");
                _configScope.NodeContext.PrependChild(nameComment);

                select.Initialize( _configScope );

Mime
View raw message