本文整理汇总了Java中com.mysql.jdbc.profiler.ProfilerEvent.getEventCreationPointAsString方法的典型用法代码示例。如果您正苦于以下问题:Java ProfilerEvent.getEventCreationPointAsString方法的具体用法?Java ProfilerEvent.getEventCreationPointAsString怎么用?Java ProfilerEvent.getEventCreationPointAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysql.jdbc.profiler.ProfilerEvent
的用法示例。
在下文中一共展示了ProfilerEvent.getEventCreationPointAsString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandProfilerEventIfNecessary
import com.mysql.jdbc.profiler.ProfilerEvent; //导入方法依赖的package包/类
public static Object expandProfilerEventIfNecessary(Object possibleProfilerEvent) {
if (possibleProfilerEvent instanceof ProfilerEvent) {
StringBuilder msgBuf = new StringBuilder();
ProfilerEvent evt = (ProfilerEvent) possibleProfilerEvent;
String locationInformation = evt.getEventCreationPointAsString();
if (locationInformation == null) {
locationInformation = Util.stackTraceToString(new Throwable());
}
msgBuf.append("Profiler Event: [");
switch (evt.getEventType()) {
case ProfilerEvent.TYPE_EXECUTE:
msgBuf.append("EXECUTE");
break;
case ProfilerEvent.TYPE_FETCH:
msgBuf.append("FETCH");
break;
case ProfilerEvent.TYPE_OBJECT_CREATION:
msgBuf.append("CONSTRUCT");
break;
case ProfilerEvent.TYPE_PREPARE:
msgBuf.append("PREPARE");
break;
case ProfilerEvent.TYPE_QUERY:
msgBuf.append("QUERY");
break;
case ProfilerEvent.TYPE_WARN:
msgBuf.append("WARN");
break;
case ProfilerEvent.TYPE_SLOW_QUERY:
msgBuf.append("SLOW QUERY");
break;
default:
msgBuf.append("UNKNOWN");
}
msgBuf.append("] ");
msgBuf.append(locationInformation);
msgBuf.append(" duration: ");
msgBuf.append(evt.getEventDuration());
msgBuf.append(" ");
msgBuf.append(evt.getDurationUnits());
msgBuf.append(", connection-id: ");
msgBuf.append(evt.getConnectionId());
msgBuf.append(", statement-id: ");
msgBuf.append(evt.getStatementId());
msgBuf.append(", resultset-id: ");
msgBuf.append(evt.getResultSetId());
String evtMessage = evt.getMessage();
if (evtMessage != null) {
msgBuf.append(", message: ");
msgBuf.append(evtMessage);
}
return msgBuf;
}
return possibleProfilerEvent;
}
示例2: expandProfilerEventIfNecessary
import com.mysql.jdbc.profiler.ProfilerEvent; //导入方法依赖的package包/类
public static Object expandProfilerEventIfNecessary(
Object possibleProfilerEvent) {
if (possibleProfilerEvent instanceof ProfilerEvent) {
StringBuffer msgBuf = new StringBuffer();
ProfilerEvent evt = (ProfilerEvent) possibleProfilerEvent;
String locationInformation = evt.getEventCreationPointAsString();
if (locationInformation == null) {
locationInformation = Util.stackTraceToString(new Throwable());
}
msgBuf.append("Profiler Event: [");
switch (evt.getEventType()) {
case ProfilerEvent.TYPE_EXECUTE:
msgBuf.append("EXECUTE");
break;
case ProfilerEvent.TYPE_FETCH:
msgBuf.append("FETCH");
break;
case ProfilerEvent.TYPE_OBJECT_CREATION:
msgBuf.append("CONSTRUCT");
break;
case ProfilerEvent.TYPE_PREPARE:
msgBuf.append("PREPARE");
break;
case ProfilerEvent.TYPE_QUERY:
msgBuf.append("QUERY");
break;
case ProfilerEvent.TYPE_WARN:
msgBuf.append("WARN");
break;
case ProfilerEvent.TYPE_SLOW_QUERY:
msgBuf.append("SLOW QUERY");
break;
default:
msgBuf.append("UNKNOWN");
}
msgBuf.append("] ");
msgBuf.append(locationInformation);
msgBuf.append(" duration: ");
msgBuf.append(evt.getEventDuration());
msgBuf.append(" ");
msgBuf.append(evt.getDurationUnits());
msgBuf.append(", connection-id: ");
msgBuf.append(evt.getConnectionId());
msgBuf.append(", statement-id: ");
msgBuf.append(evt.getStatementId());
msgBuf.append(", resultset-id: ");
msgBuf.append(evt.getResultSetId());
String evtMessage = evt.getMessage();
if (evtMessage != null) {
msgBuf.append(", message: ");
msgBuf.append(evtMessage);
}
return msgBuf;
}
return possibleProfilerEvent;
}
示例3: expandProfilerEventIfNecessary
import com.mysql.jdbc.profiler.ProfilerEvent; //导入方法依赖的package包/类
public static Object expandProfilerEventIfNecessary(Object possibleProfilerEvent) {
if (possibleProfilerEvent instanceof ProfilerEvent) {
StringBuffer msgBuf = new StringBuffer();
ProfilerEvent evt = (ProfilerEvent) possibleProfilerEvent;
String locationInformation = evt.getEventCreationPointAsString();
if (locationInformation == null) {
locationInformation = Util.stackTraceToString(new Throwable());
}
msgBuf.append("Profiler Event: [");
switch (evt.getEventType()) {
case ProfilerEvent.TYPE_EXECUTE:
msgBuf.append("EXECUTE");
break;
case ProfilerEvent.TYPE_FETCH:
msgBuf.append("FETCH");
break;
case ProfilerEvent.TYPE_OBJECT_CREATION:
msgBuf.append("CONSTRUCT");
break;
case ProfilerEvent.TYPE_PREPARE:
msgBuf.append("PREPARE");
break;
case ProfilerEvent.TYPE_QUERY:
msgBuf.append("QUERY");
break;
case ProfilerEvent.TYPE_WARN:
msgBuf.append("WARN");
break;
case ProfilerEvent.TYPE_SLOW_QUERY:
msgBuf.append("SLOW QUERY");
break;
default:
msgBuf.append("UNKNOWN");
}
msgBuf.append("] ");
msgBuf.append(locationInformation);
msgBuf.append(" duration: ");
msgBuf.append(evt.getEventDuration());
msgBuf.append(" ");
msgBuf.append(evt.getDurationUnits());
msgBuf.append(", connection-id: ");
msgBuf.append(evt.getConnectionId());
msgBuf.append(", statement-id: ");
msgBuf.append(evt.getStatementId());
msgBuf.append(", resultset-id: ");
msgBuf.append(evt.getResultSetId());
String evtMessage = evt.getMessage();
if (evtMessage != null) {
msgBuf.append(", message: ");
msgBuf.append(evtMessage);
}
return msgBuf;
}
return possibleProfilerEvent;
}