1 21 22 package org.apache.derby.impl.sql.execute.rts; 23 24 import org.apache.derby.iapi.services.io.StoredFormatIds; 25 26 import org.apache.derby.iapi.services.i18n.MessageService; 27 import org.apache.derby.iapi.reference.SQLState; 28 29 import org.apache.derby.iapi.services.io.FormatableHashtable; 30 31 import java.io.ObjectOutput ; 32 import java.io.ObjectInput ; 33 import java.io.IOException ; 34 35 41 public class RealInsertResultSetStatistics 42 extends RealNoRowsResultSetStatistics 43 { 44 45 46 public int rowCount; 47 public boolean deferred; 48 public int indexesUpdated; 49 public boolean userSpecifiedBulkInsert; 50 public boolean bulkInsertPerformed; 51 public boolean tableLock; 52 53 55 59 public RealInsertResultSetStatistics( 60 int rowCount, 61 boolean deferred, 62 int indexesUpdated, 63 boolean userSpecifiedBulkInsert, 64 boolean bulkInsertPerformed, 65 boolean tableLock, 66 long executeTime, 67 ResultSetStatistics sourceResultSetStatistics 68 ) 69 { 70 super(executeTime, sourceResultSetStatistics); 71 this.rowCount = rowCount; 72 this.deferred = deferred; 73 this.indexesUpdated = indexesUpdated; 74 this.userSpecifiedBulkInsert = userSpecifiedBulkInsert; 75 this.bulkInsertPerformed = bulkInsertPerformed; 76 this.tableLock = tableLock; 77 this.sourceResultSetStatistics = sourceResultSetStatistics; 78 } 79 80 82 89 public String getStatementExecutionPlanText(int depth) 90 { 91 initFormatInfo(depth); 92 93 String insertMode; 94 95 96 if (userSpecifiedBulkInsert) 97 { 98 if (bulkInsertPerformed) 99 { 100 insertMode = indent + MessageService.getTextMessage( 101 SQLState.RTS_INSERT_MODE_BULK); 102 } 103 else 104 { 105 insertMode = indent + MessageService.getTextMessage( 106 SQLState.RTS_INSERT_MODE_NOT_BULK); 107 } 108 } 109 else 110 { 111 insertMode = indent + MessageService.getTextMessage( 112 SQLState.RTS_INSERT_MODE_NORMAL); 113 } 114 115 insertMode += "\n"; 116 117 return 118 indent + MessageService.getTextMessage( 119 SQLState.RTS_INSERT_USING) + 120 " " + 121 MessageService.getTextMessage( 122 tableLock ? 123 SQLState.RTS_TABLE_LOCKING : 124 SQLState.RTS_ROW_LOCKING) + 125 ":\n" + 126 indent + MessageService.getTextMessage(SQLState.RTS_DEFERRED) + 127 ": " + deferred + "\n" + 128 insertMode + 129 indent + MessageService.getTextMessage( 130 SQLState.RTS_ROWS_INSERTED) + 131 " = " + rowCount + "\n" + 132 indent + MessageService.getTextMessage( 133 SQLState.RTS_INDEXES_UPDATED) + 134 " = " + indexesUpdated + "\n" + 135 dumpTimeStats(indent) + ((sourceResultSetStatistics == null)? null : 136 sourceResultSetStatistics.getStatementExecutionPlanText(1)); 137 } 138 139 149 public String getScanStatisticsText(String tableName, int depth) 150 { 151 if (sourceResultSetStatistics == null) 152 return null; 153 154 return sourceResultSetStatistics.getScanStatisticsText(tableName, depth); 155 } 156 157 158 160 public String toString() 161 { 162 return getStatementExecutionPlanText(0); 163 } 164 168 public String getNodeName(){ 169 return MessageService.getTextMessage(SQLState.RTS_INSERT); 170 } 171 } 172 | Popular Tags |