-
1. Re: getting the SQL out of PreparedStatement
bill.burke Jun 1, 2005 6:41 PM (in response to drakonis)proxy the return from prepareStatement(). The proxy can hold the SQL and then you could get it at runtime.
-
2. Re: getting the SQL out of PreparedStatement
drakonis Jun 2, 2005 2:42 PM (in response to drakonis)Something like this?:
public class sqlPreparedStatement implements PreparedStatement {
PreparedStatement st;
SQLString SQLstr;
public sqlPreparedStatement(PreparedStatement st) {
this.st=st;
}
public setString(int par, String str) {
//do the wright work on the string
...
st.setString(par,str);
}
........
.......
}
and in the interceptor:
return new sqlPreparedStatement((PreparedStatement)invocation.invokeNext());
well that would be a great idea. If I understood it corectly i could say the solution is simplisticaly beautiful.
PS: 10x again Bill, just wondering how the hell do u get the time to answer on the forum when i've seen articles on aop,interviews on theserverside, the aop panel(that AspectJ IBM guy was boring:) ), heard u on ejb 3.0 tutorials on jboss, developing JBossAop, jessus u shouldn;t be answering the forum(although not many other people seem to be answering). -
3. Re: getting the SQL out of PreparedStatement
drakonis Jun 5, 2005 4:26 AM (in response to drakonis)i can't seem to be able to intercept prepareStatement. Could it be because Connection is an interface or i;m doing something wrong?
-
4. Re: getting the SQL out of PreparedStatement
drakonis Jun 5, 2005 4:27 AM (in response to drakonis)"drakonis" wrote:
i can't seem to be able to intercept prepareStatement. Could it be because Connection is an interface or i;m doing something wrong?
Darn XML<bind pointcut="execution(public * java.sql.Connection->prepareStatement(..))"> <interceptor class="com.project.SQLInterceptor"/> </bind>
-
5. Re: getting the SQL out of PreparedStatement
kabirkhan Jun 7, 2005 4:42 AM (in response to drakonis)We ignore all classes in the java.* and javax.* packages for the "normal" pointcuts. Use a caller side pointcut:
http://docs.jboss.org/aop/1.1/aspect-framework/examples/caller/caller.html -
6. Re: getting the SQL out of PreparedStatement
drakonis Jun 7, 2005 9:08 AM (in response to drakonis)Thanks, it killed the only remaining 2 braincels i got left du!#$2(can't even write) till i gave up. should work now.