You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Douglas Smith <do...@aciwebs.com> on 2006/10/24 05:00:13 UTC

RE: viewing generated SQL without Log4Net?

Hi Ron,

1) I have some complicate dynamic queries, and I want to make sure I am
creating the expected SQL.  

2) In general, I would like an easy way to get the generated SQL out of
iBatis, and use it any way *I* want in the context of my app, and not
have to rely on Log4Net (although it may be a perfectly good tool).  I
may want to do a custom log or use or display the SQL in other ways, for
tracing, debugging, performance/load testing, etc.

For example, I think it would be a nice feature to be able to do
something like this:

	Mapper.insert("MyInsertStatement",MyParams);
	IDBCommand MyLastCommand = Mapper.LastCommand;
	Console.WriteLine(MyLastCommand.CommandText);

3) I have not seen anything about the console logger, in the
documentation, help files, wiki etc.  Sounds like a good start.  Where
do I find it?  I guess I will take another look at the web site....

Douglas

-----Original Message-----
From: Ron Grabowski [mailto:rongrabowski@yahoo.com] 
Sent: Monday, October 23, 2006 10:12 PM
To: user-cs@ibatis.apache.org
Subject: Re: viewing generated SQL without Log4Net?


Logging is currently the most straightforward way of viewing what's
being sent to the database. IBatisNet comes with a Console logger so you
technically don't need to setup log4net to view the sql inside of
nunit-gui.

What exactly are you wanting to do?


----- Original Message ----

From: Douglas Smith <do...@aciwebs.com>

To: user-cs@ibatis.apache.org

Sent: Monday, October 23, 2006 1:04:12 PM

Subject: viewing generated SQL without Log4Net?



Hi guys,

     

   I have read the manual, and the forums, and it looks like the only
way to view the generated/prepared SQL statements is to log them, using
Log4Net.

     

   Is this correct?  Is there a way to get to the CommandText  property
of DBCommand object, for any given ISQLMapper command (QueryFor...,
insert, select, etc).

     

   Is it possible to expose this property by tweaking the source code?

     

   I would really love to view the prepared SQL statement on the NUnit
console output, and possibly elsewhere.

     

     

   

  










Re: viewing generated SQL without Log4Net?

Posted by Gilles Bayon <ib...@gmail.com>.
See doc

http://ibatis.apache.org/docs/dotnet/datamapper/ch04s05.html

-- 
Cheers,
Gilles

<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>