001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.debug; 020 021import lucee.runtime.db.SQL; 022import lucee.runtime.type.Query; 023import lucee.runtime.type.QueryImpl; 024 025/** 026 * 027 */ 028public final class QueryEntryImpl implements QueryEntryPro { 029 030 private static final long serialVersionUID = 8655915268130645466L; 031 032 private final String src; 033 private final SQL sql; 034 private final long exe; 035 private final String name; 036 private final int recordcount; 037 private final String datasource; 038 private final Query qry; 039 private final long startTime; 040 041 /** 042 * constructor of the class 043 * @param recordcount 044 * @param query 045 * @param src 046 * @param exe 047 */ 048 public QueryEntryImpl(Query qry,String datasource, String name,SQL sql,int recordcount, String src, long exe) { 049 this.startTime=System.currentTimeMillis()-(exe/1000000); 050 this.datasource=datasource; 051 this.recordcount=recordcount; 052 this.name=name; 053 this.src=src; 054 this.sql=sql; 055 this.exe=exe; 056 this.qry=qry; 057 } 058 059 @Override 060 public Query getQry() { 061 return qry; 062 } 063 064 @Override 065 public int getExe() { 066 return (int)getExecutionTime(); 067 } 068 069 @Override 070 public long getExecutionTime() { 071 return exe; 072 } 073 074 075 @Override 076 public SQL getSQL() { 077 return sql; 078 } 079 @Override 080 public String getSrc() { 081 return src; 082 } 083 @Override 084 public String getName() { 085 return name; 086 } 087 @Override 088 public int getRecordcount() { 089 return recordcount; 090 } 091 @Override 092 public String getDatasource() { 093 return datasource; 094 } 095 096 // FUTURE add to interface 097 public long getStartTime() { 098 return startTime; 099 } 100 101 @Override 102 public String getCacheType() { 103 return (qry instanceof QueryImpl)?((QueryImpl)qry).getCacheType():null; 104 } 105}