@@ -1364,31 +1364,38 @@ public String execute(@RequestBody String request, HttpSession session) {
1364
1364
config .setPrepared (true );
1365
1365
config .setPreparedValueList (valueList );
1366
1366
1367
+ String sqlPrefix =EXECUTE_STRICTLY ?sql .substring (0 ,7 ).toUpperCase () :"" ;
1368
+ boolean isWrite =sqlPrefix .startsWith ("INSERT " ) ||sqlPrefix .startsWith ("UPDATE " ) ||sqlPrefix .startsWith ("DELETE " );
1369
+
1370
+ long executeStartTime =System .currentTimeMillis ();
1371
+
1367
1372
Statement statement =executor .getStatement (config ,sql );
1368
1373
if (statement instanceof PreparedStatement ) {
1369
1374
if (EXECUTE_STRICTLY ) {
1370
- if (sql .startsWith ("SELECT " )) {
1371
- ((PreparedStatement )statement ).executeQuery ();
1372
- }else {
1375
+ if (isWrite ) {
1373
1376
((PreparedStatement )statement ).executeUpdate ();
1377
+ }else {
1378
+ ((PreparedStatement )statement ).executeQuery ();
1374
1379
}
1375
1380
}
1376
1381
else {
1377
1382
((PreparedStatement )statement ).execute ();
1378
1383
}
1379
1384
}else {
1380
1385
if (EXECUTE_STRICTLY ) {
1381
- if (sql .startsWith ("SELECT " )) {
1382
- statement .executeQuery (sql );
1383
- }else {
1386
+ if (isWrite ) {
1384
1387
statement .executeUpdate (sql );
1388
+ }else {
1389
+ statement .executeQuery (sql );
1385
1390
}
1386
1391
}
1387
1392
else {
1388
1393
statement .execute (sql );
1389
1394
}
1390
1395
}
1391
1396
1397
+ long executeDuration =System .currentTimeMillis () -executeStartTime ;
1398
+
1392
1399
ResultSet rs =statement .getResultSet ();
1393
1400
ResultSetMetaData rsmd =rs .getMetaData ();
1394
1401
int length =rsmd .getColumnCount ();
@@ -1424,14 +1431,17 @@ public String execute(@RequestBody String request, HttpSession session) {
1424
1431
long endTime =System .currentTimeMillis ();
1425
1432
long duration =endTime -startTime ;
1426
1433
1427
- long sqlDuration =cursorDuration +rsDuration ;
1434
+ long sqlDuration =executeDuration + cursorDuration +rsDuration ;
1428
1435
long parseDuration =duration -sqlDuration ;
1429
1436
1430
1437
result .put ("time:start|duration|end|parse|sql" ,startTime +"|" +duration +"|" +endTime +"|" +parseDuration +"|" +sqlDuration );
1431
1438
1432
1439
return result .toJSONString ();
1433
1440
}catch (Exception e ) {
1434
- return DemoParser .newErrorResult (e ).toJSONString ();
1441
+ JSONObject result =DemoParser .newErrorResult (e );
1442
+ result .put ("throw" ,e .getClass ().getName ());
1443
+ result .put ("trace:stack" ,e .getStackTrace ());
1444
+ return result .toJSONString ();
1435
1445
}
1436
1446
1437
1447
}