001 package com.allaire.cfx; 002 003 import railo.loader.engine.CFMLEngineFactory; 004 import railo.runtime.cfx.QueryWrap; 005 006 /** 007 * Implementation of the DebugQuery 008 */ 009 public final class DebugQuery extends QueryWrap { 010 011 /** 012 * Constructor of the DebugQuery 013 * @param name 014 * @param columns 015 * @param data 016 * @throws IllegalArgumentException 017 */ 018 public DebugQuery(String name, String[] columns, String[][] data) throws IllegalArgumentException { 019 super(toQuery(name, columns, data),name); 020 } 021 022 /** 023 * Constructor of the DebugQuery 024 * @param name 025 * @param columns 026 * @throws IllegalArgumentException 027 */ 028 public DebugQuery(String name, String[] columns) throws IllegalArgumentException { 029 super(toQuery(name, columns,0),name); 030 } 031 032 private static railo.runtime.type.Query toQuery(String name, String[] columns, String[][] data) { 033 034 railo.runtime.type.Query query=toQuery(name, columns,data.length); 035 036 for(int row=0;row<data.length;row++) { 037 int len=data[row].length>columns.length?columns.length:data[row].length; 038 for(int col=0;col<len;col++) { 039 try { 040 query.setAt(columns[col],row+1,data[row][col]); 041 } catch (Exception e) {} 042 } 043 } 044 return query; 045 } 046 private static railo.runtime.type.Query toQuery(String name, String[] columns, int rows) { 047 return CFMLEngineFactory.getInstance().getCreationUtil().createQuery(columns,rows,name); 048 } 049 }