Is events doable?

C

CNemo

Hi all!

I need to write some tracing code for legacy applications. Basically there
is the need to trace SQL sent to server from ASP app. Code is very
unstructured and dirty, so there is no single point where i can inject this
functionality.

What i would like to do is create some procedure and attach it to connection
object when i need it.
The only concern is that i'm not sure that i can attach events. Is this
doable in ASP + ADO?

Or may be somebody can advise another approach to track. But i havent acces
to servers (neither IIS nor Sybase database).

Any help will be gratly appreciated!
 
P

Pexi

I don't quite get what do you mean with events here, and I don't know
Sybase, but maybe there is a similar tool as Profiler is in SQLServer2000.
If yes, it can be used for tracing, no need to change anything in your app.

Another easy option which comes to my mind is that if your connection is via
ODBC, you should be able to configure the driver so that it writes some kind
of trace log.

Otherwise... if you are using ADO, you might consider writing an
ADO.Connection wrapper class with logging features. Then just your own
WrappedConnection instead of the ADO.Connection itself.

Just some ideas.
/pexi
 
C

CNemo

Thanks for your response!
Otherwise... if you are using ADO, you might consider writing an
ADO.Connection wrapper class with logging features. Then just your own
WrappedConnection instead of the ADO.Connection itself.

The idea was to alter existing code as less as possible. Having wrapper
means i need to alter object creation code, which is quite intrusive. Also,
this way i need to write wrapper and deploy it to the production server.
Greatly doubt that i have this luxury. By the same reason i cannot turn ODBC
tracing.

I was in hope that i can attach to connection object events somehow and only
when i need it. I know that VB has something like GetRef function to get
reference to the subroutine address. Is this available in ASP?
 
B

Bob Barrows [MVP]

CNemo said:
Thanks for your response!


The idea was to alter existing code as less as possible. Having
wrapper means i need to alter object creation code, which is quite
intrusive. Also, this way i need to write wrapper and deploy it to
the production server. Greatly doubt that i have this luxury. By the
same reason i cannot turn ODBC tracing.

I was in hope that i can attach to connection object events somehow
and only when i need it. I know that VB has something like GetRef
function to get reference to the subroutine address.

How would that help? Knowing the address of the subroutine is a far cry
from monitoring the inputs or outputs of that process at runtime.
Is this
available in ASP?

There is no way to achieve what you want without altering the existing
code.
Sorry
 
P

Patrice

You could start wrapping Recordset.Open in your own function so that you can
add the tracing (you'll have to change the code anyway even if for nothing
else than anbling tracing). Knowing exactly what you are doing exactly might
help (for example we store just the last statement so that we can have this
in our error reporting page, do you want to trace all statements ? where ?
When do you clear ? etc...)
 
C

CNemo

You could start wrapping Recordset.Open in your own function so that you
can add the tracing (you'll have to change the code anyway even if for
nothing else than anbling tracing). Knowing exactly what you are doing
exactly might help (for example we store just the last statement so that
we can have this in our error reporting page, do you want to trace all
statements ? where ? When do you clear ? etc...)

My client wants to switch to the new ODBC driver version. They asked to do
kind of test harness, very primitive one.
I need collect input from app and find out what's changed in database. Then
do same input with new driver and compare results. They don't care if
result is correct, but they want same result. :-0 The problem is that they
do not want to do this properly using server tools, but app itself only.
Look like i have to go all over this old crappy code and found every single
place where sql constructed and save and document it.

I cannot use ODBC tracing, because it's on production server i cannot
control. By the same reason i cannot install any other components there.
Also, Sybase used, so there is no profiler on the client (as far as i know).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top