001 package railo.runtime.type.query; 002 003 import java.io.InputStream; 004 import java.io.Reader; 005 import java.math.BigDecimal; 006 import java.net.URL; 007 import java.sql.Array; 008 import java.sql.Blob; 009 import java.sql.Clob; 010 import java.sql.Date; 011 import java.sql.NClob; 012 import java.sql.PreparedStatement; 013 import java.sql.Ref; 014 import java.sql.ResultSet; 015 import java.sql.ResultSetMetaData; 016 import java.sql.RowId; 017 import java.sql.SQLException; 018 import java.sql.SQLWarning; 019 import java.sql.SQLXML; 020 import java.sql.Statement; 021 import java.sql.Time; 022 import java.sql.Timestamp; 023 import java.sql.Types; 024 import java.util.ArrayList; 025 import java.util.Calendar; 026 import java.util.HashMap; 027 import java.util.Iterator; 028 import java.util.LinkedHashMap; 029 import java.util.List; 030 import java.util.Map; 031 import java.util.Map.Entry; 032 033 import railo.commons.lang.StringUtil; 034 import railo.loader.engine.CFMLEngineFactory; 035 import railo.runtime.PageContext; 036 import railo.runtime.db.DatasourceConnection; 037 import railo.runtime.db.DatasourceConnectionPro; 038 import railo.runtime.db.SQL; 039 import railo.runtime.db.SQLCaster; 040 import railo.runtime.db.SQLItem; 041 import railo.runtime.dump.DumpData; 042 import railo.runtime.dump.DumpProperties; 043 import railo.runtime.engine.ThreadLocalPageContext; 044 import railo.runtime.exp.ApplicationException; 045 import railo.runtime.exp.DatabaseException; 046 import railo.runtime.exp.ExpressionException; 047 import railo.runtime.exp.PageException; 048 import railo.runtime.exp.PageRuntimeException; 049 import railo.runtime.op.Caster; 050 import railo.runtime.timer.Stopwatch; 051 import railo.runtime.type.ArrayImpl; 052 import railo.runtime.type.ArrayInt; 053 import railo.runtime.type.Collection; 054 import railo.runtime.type.KeyImpl; 055 import railo.runtime.type.Objects; 056 import railo.runtime.type.Query; 057 import railo.runtime.type.QueryColumn; 058 import railo.runtime.type.QueryColumnRef; 059 import railo.runtime.type.QueryImpl; 060 import railo.runtime.type.QueryPro; 061 import railo.runtime.type.Struct; 062 import railo.runtime.type.StructImpl; 063 import railo.runtime.type.dt.DateTime; 064 import railo.runtime.type.it.CollectionIterator; 065 import railo.runtime.type.it.KeyIterator; 066 import railo.runtime.type.util.QueryUtil; 067 068 public class SimpleQuery implements QueryPro, ResultSet, Objects { 069 070 static final Object DEFAULT_VALUE = new Object(); 071 private ResultSet res; 072 private ResultSetMetaData meta; 073 private Collection.Key[] columnNames; 074 private Map<String,SimpleQueryColumn> columns=new LinkedHashMap<String, SimpleQueryColumn>(); 075 private int[] _types; 076 077 private String name; 078 private String template; 079 private SQL sql; 080 private int exeTime; 081 private int recordcount; 082 private ArrayInt arrCurrentRow=new ArrayInt(); 083 084 085 public SimpleQuery(DatasourceConnection dc,SQL sql,int maxrow, int fetchsize,int timeout, String name,String template) throws PageException { 086 this.name=name; 087 this.template=template; 088 this.sql=sql; 089 090 //ResultSet result=null; 091 Statement stat=null; 092 // check SQL Restrictions 093 if(dc.getDatasource().hasSQLRestriction()) { 094 QueryUtil.checkSQLRestriction(dc,sql); 095 } 096 097 Stopwatch stopwatch=new Stopwatch(); 098 stopwatch.start(); 099 boolean hasResult=false; 100 try { 101 SQLItem[] items=sql.getItems(); 102 if(items.length==0) { 103 stat=dc.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); 104 setAttributes(stat,maxrow,fetchsize,timeout); 105 // some driver do not support second argument 106 hasResult=stat.execute(sql.getSQLString()); 107 } 108 else { 109 // some driver do not support second argument 110 PreparedStatement preStat = ((DatasourceConnectionPro)dc).getPreparedStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); 111 stat=preStat; 112 setAttributes(preStat,maxrow,fetchsize,timeout); 113 setItems(preStat,items); 114 hasResult=preStat.execute(); 115 } 116 int uc; 117 ResultSet res; 118 119 do { 120 if(hasResult) { 121 res=stat.getResultSet(); 122 init(res); 123 break; 124 } 125 else 126 throw new ApplicationException("Simple queries can only be used for queries returning a resultset"); 127 } 128 while(true); 129 } 130 catch (SQLException e) { 131 throw new DatabaseException(e,sql,dc); 132 } 133 catch (Throwable e) { 134 throw Caster.toPageException(e); 135 } 136 exeTime=(int) stopwatch.time(); 137 } 138 139 private void setAttributes(Statement stat,int maxrow, int fetchsize,int timeout) throws SQLException { 140 if(maxrow>-1) stat.setMaxRows(maxrow); 141 if(fetchsize>0)stat.setFetchSize(fetchsize); 142 if(timeout>0)stat.setQueryTimeout(timeout); 143 } 144 private void setItems(PreparedStatement preStat, SQLItem[] items) throws DatabaseException, PageException, SQLException { 145 for(int i=0;i<items.length;i++) { 146 SQLCaster.setValue(preStat,i+1,items[i]); 147 } 148 } 149 150 private void init(ResultSet res) throws SQLException{ 151 this.res=res; 152 this.meta=res.getMetaData(); 153 154 // init columns 155 int columncount = meta.getColumnCount(); 156 List<Key> tmpKeys=new ArrayList<Key>(); 157 //List<Integer> tmpTypes=new ArrayList<Integer>(); 158 int count=0; 159 Collection.Key key; 160 String columnName; 161 int type; 162 for(int i=0;i<columncount;i++) { 163 try { 164 columnName=meta.getColumnName(i+1); 165 type=meta.getColumnType(i+1); 166 } catch (SQLException e) { 167 throw toRuntimeExc(e); 168 } 169 if(StringUtil.isEmpty(columnName))columnName="column_"+i; 170 key=KeyImpl.init(columnName); 171 int index=tmpKeys.indexOf(key); 172 if(index==-1) { 173 //mappings.put(key.getLowerString(), Caster.toInteger(i+1)); 174 tmpKeys.add(key); 175 //tmpTypes.add(type); 176 columns.put(key.getLowerString(), new SimpleQueryColumn(this,res, key,type, i+1)); 177 178 count++; 179 } 180 181 } 182 columnNames=tmpKeys.toArray(new Key[tmpKeys.size()]); 183 184 res.last(); 185 recordcount=res.getRow(); 186 res.beforeFirst(); 187 /*Iterator<Integer> it = tmpTypes.iterator(); 188 types=new int[tmpTypes.size()]; 189 int index=0; 190 while(it.hasNext()){ 191 types[index++]=it.next(); 192 }*/ 193 194 195 } 196 197 /** 198 * @see railo.runtime.type.QueryImpl#executionTime() 199 */ 200 201 public int executionTime() { 202 return exeTime; 203 } 204 205 /** 206 * @see railo.runtime.type.QueryImpl#getUpdateCount() 207 */ 208 209 public int getUpdateCount() { 210 throw notSupported(); 211 } 212 213 /** 214 * @see railo.runtime.type.QueryImpl#size() 215 */ 216 public int size() { 217 return columnNames.length; 218 } 219 220 /** 221 * @see railo.runtime.type.QueryImpl#keys() 222 */ 223 224 public Key[] keys() { 225 return columnNames; 226 } 227 228 229 230 /** 231 * @see railo.runtime.type.QueryImpl#keysAsString() 232 */ 233 234 public String[] keysAsString() { 235 return QueryUtil.toStringArray(keys()); 236 } 237 238 /** 239 * @see railo.runtime.type.QueryImpl#removeEL(java.lang.String) 240 */ 241 public synchronized Object removeEL(String key) { 242 throw notSupported(); 243 } 244 245 /** 246 * @see railo.runtime.type.QueryImpl#removeEL(railo.runtime.type.Collection.Key) 247 */ 248 249 public Object removeEL(Key key) { 250 throw notSupported(); 251 } 252 253 /** 254 * @see railo.runtime.type.QueryImpl#remove(java.lang.String) 255 */ 256 257 public synchronized Object remove(String key) throws PageException { 258 throw notSupported(); 259 } 260 261 /** 262 * @see railo.runtime.type.QueryImpl#remove(railo.runtime.type.Collection.Key) 263 */ 264 265 public Object remove(Key key) throws PageException { 266 throw notSupported(); 267 } 268 269 /** 270 * @see railo.runtime.type.QueryImpl#clear() 271 */ 272 273 public void clear() { 274 throw notSupported(); 275 } 276 277 /** 278 * @see railo.runtime.type.QueryImpl#get(Collection.Key, java.lang.Object) 279 */ 280 281 public Object get(Key key, Object defaultValue) { 282 return getAt(key, getCurrentrow(),getPid(),defaultValue); 283 } 284 285 /** 286 * @see railo.runtime.type.QueryImpl#get(railo.runtime.type.Collection.Key, java.lang.Object) 287 */ 288 289 public Object get(String key, Object defaultValue) { 290 return get(KeyImpl.init(key),defaultValue); 291 } 292 293 /** 294 * @see railo.runtime.type.QueryImpl#get(java.lang.String) 295 */ 296 297 public Object get(String key) throws PageException { 298 return get(KeyImpl.init(key)); 299 } 300 301 /** 302 * @see railo.runtime.type.QueryImpl#get(railo.runtime.type.Collection.Key) 303 */ 304 305 public Object get(Key key) throws PageException { 306 return getAt(key, getCurrentrow(),getPid()); 307 } 308 309 /** 310 * @see railo.runtime.type.QueryImpl#getAt(railo.runtime.type.Collection.Key, int, java.lang.Object) 311 */ 312 313 public Object getAt(Key key, int row, int pid, Object defaultValue) { 314 char c=key.lowerCharAt(0); 315 if(c=='r') { 316 if(key.equals(QueryImpl.RECORDCOUNT)) return new Double(getRecordcount()); 317 } 318 else if(c=='c') { 319 if(key.equals(QueryImpl.CURRENTROW)) return new Double(getCurrentrow(pid)); 320 else if(key.equals(QueryImpl.COLUMNLIST)) return getColumnlist(); 321 } 322 323 SimpleQueryColumn column = columns.get(key.getLowerString()); 324 if(column==null) return null; 325 try { 326 return column.get(row); 327 } 328 catch (Throwable t) { 329 return defaultValue; 330 } 331 } 332 333 /** 334 * @see railo.runtime.type.QueryImpl#getAt(railo.runtime.type.Collection.Key, int) 335 */ 336 337 public Object getAt(Key key, int row,int pid) throws PageException { 338 Object res = getAt(key,row,pid,DEFAULT_VALUE); 339 if(res!=DEFAULT_VALUE) return res; 340 throw new DatabaseException("key ["+key+"] not found",null,null,null); 341 } 342 343 344 /** 345 * @see railo.runtime.type.QueryImpl#getAt(Key, int, java.lang.Object) 346 */ 347 348 public Object getAt(Key key, int row, Object defaultValue) { 349 return getAt(key, row,getPid(),defaultValue); 350 } 351 352 353 public Object getAt(Key key, int row) throws PageException { 354 Object res = getAt(key,row,getPid(),DEFAULT_VALUE); 355 if(res!=DEFAULT_VALUE) return res; 356 throw new DatabaseException("key ["+key+"] not found",null,null,null); 357 } 358 359 public Object getAt(String key, int row, Object defaultValue) { 360 return getAt(KeyImpl.init(key), row,defaultValue); 361 } 362 363 /** 364 * @see railo.runtime.type.QueryImpl#getAt(java.lang.String, int) 365 */ 366 367 public Object getAt(String key, int row) throws PageException { 368 return getAt(KeyImpl.init(key), row); 369 } 370 371 372 /** 373 * @see railo.runtime.type.QueryImpl#removeRow(int) 374 */ 375 376 public synchronized int removeRow(int row) throws PageException { 377 throw notSupported(); 378 } 379 380 /** 381 * @see railo.runtime.type.QueryImpl#removeRowEL(int) 382 */ 383 384 public int removeRowEL(int row) { 385 throw notSupported(); 386 } 387 388 /** 389 * @see railo.runtime.type.QueryImpl#removeColumn(java.lang.String) 390 */ 391 392 public QueryColumn removeColumn(String key) throws DatabaseException { 393 throw notSupported(); 394 } 395 396 /** 397 * @see railo.runtime.type.QueryImpl#removeColumn(railo.runtime.type.Collection.Key) 398 */ 399 400 public QueryColumn removeColumn(Key key) throws DatabaseException { 401 throw notSupported(); 402 } 403 404 /** 405 * @see railo.runtime.type.QueryImpl#removeColumnEL(java.lang.String) 406 */ 407 408 public synchronized QueryColumn removeColumnEL(String key) { 409 throw notSupported(); 410 } 411 412 /** 413 * @see railo.runtime.type.QueryImpl#removeColumnEL(railo.runtime.type.Collection.Key) 414 */ 415 416 public QueryColumn removeColumnEL(Key key) { 417 throw notSupported(); 418 } 419 420 /** 421 * @see railo.runtime.type.QueryImpl#setEL(java.lang.String, java.lang.Object) 422 */ 423 424 public Object setEL(String key, Object value) { 425 throw notSupported(); 426 } 427 428 /** 429 * @see railo.runtime.type.QueryImpl#setEL(railo.runtime.type.Collection.Key, java.lang.Object) 430 */ 431 432 public Object setEL(Key key, Object value) { 433 throw notSupported(); 434 } 435 436 /** 437 * @see railo.runtime.type.QueryImpl#set(java.lang.String, java.lang.Object) 438 */ 439 440 public Object set(String key, Object value) throws PageException { 441 throw notSupported(); 442 } 443 444 /** 445 * @see railo.runtime.type.QueryImpl#set(railo.runtime.type.Collection.Key, java.lang.Object) 446 */ 447 448 public Object set(Key key, Object value) throws PageException { 449 throw notSupported(); 450 } 451 452 /** 453 * @see railo.runtime.type.QueryImpl#setAt(java.lang.String, int, java.lang.Object) 454 */ 455 456 public Object setAt(String key, int row, Object value) throws PageException { 457 throw notSupported(); 458 } 459 460 /** 461 * @see railo.runtime.type.QueryImpl#setAt(railo.runtime.type.Collection.Key, int, java.lang.Object) 462 */ 463 464 public Object setAt(Key key, int row, Object value) throws PageException { 465 throw notSupported(); 466 } 467 468 /** 469 * @see railo.runtime.type.QueryImpl#setAtEL(java.lang.String, int, java.lang.Object) 470 */ 471 472 public Object setAtEL(String key, int row, Object value) { 473 throw notSupported(); 474 } 475 476 /** 477 * @see railo.runtime.type.QueryImpl#setAtEL(railo.runtime.type.Collection.Key, int, java.lang.Object) 478 */ 479 480 public Object setAtEL(Key key, int row, Object value) { 481 throw notSupported(); 482 } 483 484 /** 485 * @see railo.runtime.type.QueryImpl#next() 486 */ 487 488 public synchronized boolean next() { 489 return next(getPid()); 490 } 491 492 /** 493 * @see railo.runtime.type.QueryImpl#next(int) 494 */ 495 496 public synchronized boolean next(int pid) { 497 if(recordcount>=(arrCurrentRow.set(pid,arrCurrentRow.get(pid,0)+1))) { 498 return true; 499 } 500 arrCurrentRow.set(pid,0); 501 return false; 502 } 503 504 /** 505 * @see railo.runtime.type.QueryImpl#reset() 506 */ 507 508 public synchronized void reset() { 509 reset(getPid()); 510 } 511 512 /** 513 * @see railo.runtime.type.QueryImpl#reset(int) 514 */ 515 516 public synchronized void reset(int pid) { 517 arrCurrentRow.set(pid,0); 518 } 519 520 /** 521 * @see railo.runtime.type.QueryImpl#getRecordcount() 522 */ 523 524 public int getRecordcount() { 525 return recordcount; 526 } 527 528 /** 529 * @see railo.runtime.type.QueryImpl#getCurrentrow() 530 */ 531 532 public synchronized int getCurrentrow() { 533 return getCurrentrow(getPid()); 534 } 535 536 /** 537 * @see railo.runtime.type.QueryImpl#getCurrentrow(int) 538 */ 539 540 public synchronized int getCurrentrow(int pid) { 541 return arrCurrentRow.get(pid, 1); 542 } 543 544 /** 545 * @see railo.runtime.type.QueryImpl#getColumnlist(boolean) 546 */ 547 public String getColumnlist(boolean upperCase) { 548 Key[] columnNames = keys(); 549 StringBuffer sb=new StringBuffer(); 550 for(int i=0;i<columnNames.length;i++) { 551 if(i>0)sb.append(','); 552 sb.append(upperCase?columnNames[i].getString().toUpperCase():columnNames[i].getString());// FUTURE getUpperString 553 } 554 return sb.toString(); 555 } 556 557 /** 558 * @see railo.runtime.type.QueryImpl#getColumnlist() 559 */ 560 561 public String getColumnlist() { 562 return getColumnlist(true); 563 } 564 565 public boolean go(int index) { 566 return go(index,getPid()); 567 } 568 569 public boolean go(int index, int pid) { 570 if(index>0 && index<=recordcount) { 571 arrCurrentRow.set(pid, index); 572 return true; 573 } 574 arrCurrentRow.set(pid, 0); 575 return false; 576 } 577 578 579 580 /*public synchronized boolean go(int index) { 581 if(index==getCurrentrow()) return true; 582 try { 583 return res.absolute(index); 584 } 585 catch (SQLException e) { 586 throw toRuntimeExc(e); 587 } 588 } 589 590 public boolean go(int index, int pid) { 591 return go(index); 592 }*/ 593 594 /** 595 * @see railo.runtime.type.QueryImpl#isEmpty() 596 */ 597 public boolean isEmpty() { 598 return recordcount+columnNames.length==0; 599 } 600 601 /** 602 * @see railo.runtime.type.QueryImpl#toDumpData(railo.runtime.PageContext, int, railo.runtime.dump.DumpProperties) 603 */ 604 public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) { 605 return QueryUtil.toDumpData(this, pageContext, maxlevel, dp); 606 } 607 608 /** 609 * @see railo.runtime.type.QueryImpl#sort(java.lang.String) 610 */ 611 612 public void sort(String column) throws PageException { 613 throw notSupported(); 614 } 615 616 /** 617 * @see railo.runtime.type.QueryImpl#sort(railo.runtime.type.Collection.Key) 618 */ 619 620 public void sort(Key column) throws PageException { 621 throw notSupported(); 622 } 623 624 /** 625 * @see railo.runtime.type.QueryImpl#sort(java.lang.String, int) 626 */ 627 628 public synchronized void sort(String strColumn, int order) 629 throws PageException { 630 throw notSupported(); 631 } 632 633 /** 634 * @see railo.runtime.type.QueryImpl#sort(railo.runtime.type.Collection.Key, int) 635 */ 636 637 public synchronized void sort(Key keyColumn, int order) 638 throws PageException { 639 throw notSupported(); 640 } 641 642 /** 643 * @see railo.runtime.type.QueryImpl#addRow(int) 644 */ 645 646 public synchronized boolean addRow(int count) { 647 throw notSupported(); 648 } 649 650 /** 651 * @see railo.runtime.type.QueryImpl#addColumn(java.lang.String, railo.runtime.type.Array) 652 */ 653 654 public boolean addColumn(String columnName, railo.runtime.type.Array content) 655 throws DatabaseException { 656 throw notSupported(); 657 } 658 659 /** 660 * @see railo.runtime.type.QueryImpl#addColumn(railo.runtime.type.Collection.Key, railo.runtime.type.Array) 661 */ 662 663 public boolean addColumn(Key columnName, railo.runtime.type.Array content) 664 throws PageException { 665 throw notSupported(); 666 } 667 668 /** 669 * @see railo.runtime.type.QueryImpl#addColumn(java.lang.String, railo.runtime.type.Array, int) 670 */ 671 672 public synchronized boolean addColumn(String columnName, 673 railo.runtime.type.Array content, int type) 674 throws DatabaseException { 675 throw notSupported(); 676 } 677 678 /** 679 * @see railo.runtime.type.QueryImpl#addColumn(railo.runtime.type.Collection.Key, railo.runtime.type.Array, int) 680 */ 681 682 public boolean addColumn(Key columnName, railo.runtime.type.Array content, 683 int type) throws DatabaseException { 684 throw notSupported(); 685 } 686 687 /** 688 * @see railo.runtime.type.QueryImpl#clone() 689 */ 690 691 public Object clone() { 692 return cloneQuery(true); 693 } 694 695 /** 696 * @see railo.runtime.type.QueryImpl#duplicate(boolean) 697 */ 698 699 public Collection duplicate(boolean deepCopy) { 700 return cloneQuery(deepCopy); 701 } 702 703 /** 704 * @see railo.runtime.type.QueryImpl#cloneQuery(boolean) 705 */ 706 707 public QueryImpl cloneQuery(boolean deepCopy) { 708 return QueryImpl.cloneQuery(this, deepCopy); 709 } 710 711 /** 712 * @see railo.runtime.type.QueryImpl#getTypes() 713 */ 714 715 public synchronized int[] getTypes() { 716 if(_types==null) { 717 _types=new int[columns.size()]; 718 int i=0; 719 Iterator<Entry<String, SimpleQueryColumn>> it = columns.entrySet().iterator(); 720 while(it.hasNext()){ 721 _types[i++]=it.next().getValue().getType(); 722 } 723 } 724 return _types; 725 } 726 /** 727 * @throws PageException 728 * @see railo.runtime.type.QueryImpl#getTypesAsMap() 729 */ 730 731 public synchronized Map getTypesAsMap() { 732 Map<String,String> map=new HashMap<String,String>(); 733 Iterator<SimpleQueryColumn> it = columns.values().iterator(); 734 SimpleQueryColumn c; 735 while(it.hasNext()){ 736 c=it.next(); 737 map.put(c.getKeyAsString(), c.getTypeAsString()); 738 } 739 return map; 740 } 741 742 /** 743 * @see railo.runtime.type.QueryImpl#getColumn(java.lang.String) 744 */ 745 746 public QueryColumn getColumn(String key) throws DatabaseException { 747 return getColumn(KeyImpl.init(key)); 748 } 749 750 /** 751 * @see railo.runtime.type.QueryImpl#getColumn(railo.runtime.type.Collection.Key) 752 */ 753 754 public QueryColumn getColumn(Key key) throws DatabaseException { 755 QueryColumn rtn = getColumn(key,null); 756 if(rtn!=null) return rtn; 757 throw new DatabaseException("key ["+key.getString()+"] not found in query, columns are ["+getColumnlist(false)+"]",null,null,null); 758 } 759 760 /** 761 * @see railo.runtime.type.QueryImpl#getColumn(java.lang.String, railo.runtime.type.QueryColumn) 762 */ 763 public QueryColumn getColumn(String key, QueryColumn defaultValue) { 764 return getColumn(KeyImpl.init(key),defaultValue); 765 } 766 767 /** 768 * @see railo.runtime.type.QueryImpl#getColumn(railo.runtime.type.Collection.Key, railo.runtime.type.QueryColumn) 769 */ 770 771 public QueryColumn getColumn(Key key, QueryColumn defaultValue) { 772 if(key.getString().length()>0) { 773 char c=key.lowerCharAt(0); 774 if(c=='r') { 775 if(key.equals(QueryImpl.RECORDCOUNT)) return new QueryColumnRef(this,key,Types.INTEGER); 776 } 777 else if(c=='c') { 778 if(key.equals(QueryImpl.CURRENTROW)) return new QueryColumnRef(this,key,Types.INTEGER); 779 else if(key.equals(QueryImpl.COLUMNLIST)) return new QueryColumnRef(this,key,Types.INTEGER); 780 } 781 SimpleQueryColumn col = columns.get(key.getLowerString()); 782 if(col!=null) return col; 783 784 } 785 return defaultValue; 786 } 787 788 /** 789 * @see railo.runtime.type.QueryImpl#rename(railo.runtime.type.Collection.Key, railo.runtime.type.Collection.Key) 790 */ 791 792 public synchronized void rename(Key columnName, Key newColumnName) 793 throws ExpressionException { 794 throw notSupported(); 795 //Integer index=mappings.get(columnName); 796 //if(index==null) throw new ExpressionException("invalid column name definitions"); 797 // TODO implement 798 } 799 800 /** 801 * @see railo.runtime.type.QueryImpl#toString() 802 */ 803 public String toString() { 804 return res.toString(); 805 } 806 807 /** 808 * @see railo.runtime.type.QueryImpl#setExecutionTime(long) 809 */ 810 811 public void setExecutionTime(long exeTime) { 812 throw notSupported(); 813 } 814 815 /** 816 * @see railo.runtime.type.QueryImpl#cutRowsTo(int) 817 */ 818 819 public synchronized boolean cutRowsTo(int maxrows) { 820 throw notSupported(); 821 } 822 823 /** 824 * @see railo.runtime.type.QueryImpl#setCached(boolean) 825 */ 826 827 public void setCached(boolean isCached) { 828 throw notSupported(); 829 } 830 831 /** 832 * @see railo.runtime.type.QueryImpl#isCached() 833 */ 834 835 public boolean isCached() { 836 return false; 837 } 838 839 /** 840 * @see railo.runtime.type.QueryImpl#addRow() 841 */ 842 843 public int addRow() { 844 throw notSupported(); 845 } 846 847 /** 848 * @see railo.runtime.type.QueryImpl#getColumnName(int) 849 */ 850 851 public Key getColumnName(int columnIndex) { 852 Iterator<SimpleQueryColumn> it = columns.values().iterator(); 853 SimpleQueryColumn c; 854 while(it.hasNext()){ 855 c = it.next(); 856 if(c.getIndex()==columnIndex) return c.getKey(); 857 } 858 return null; 859 } 860 861 /** 862 * @see railo.runtime.type.QueryImpl#getColumnIndex(java.lang.String) 863 */ 864 865 public int getColumnIndex(String coulmnName) { 866 SimpleQueryColumn col = columns.get(coulmnName.toLowerCase()); 867 if(col==null) return -1; 868 return col.getIndex(); 869 } 870 871 /** 872 * @see railo.runtime.type.QueryImpl#getColumns() 873 */ 874 875 public String[] getColumns() { 876 return getColumnNamesAsString(); 877 } 878 879 /** 880 * @see railo.runtime.type.QueryImpl#getColumnNames() 881 */ 882 883 public Key[] getColumnNames() { 884 Key[] _columns=new Key[columnNames.length]; 885 for(int i=0;i<columnNames.length;i++){ 886 _columns[i]=columnNames[i]; 887 } 888 return _columns; 889 } 890 891 /** 892 * @see railo.runtime.type.QueryImpl#setColumnNames(railo.runtime.type.Collection.Key[]) 893 */ 894 895 public void setColumnNames(Key[] trg) throws PageException { 896 throw notSupported(); 897 } 898 899 /** 900 * @see railo.runtime.type.QueryImpl#getColumnNamesAsString() 901 */ 902 903 public String[] getColumnNamesAsString() { 904 String[] _columns=new String[columnNames.length]; 905 for(int i=0;i<columnNames.length;i++){ 906 _columns[i]=columnNames[i].getString(); 907 } 908 return _columns; 909 } 910 911 /** 912 * @see railo.runtime.type.QueryImpl#getData(int, int) 913 */ 914 915 public synchronized String getData(int row, int col) throws IndexOutOfBoundsException { 916 try{ 917 int rowBefore=res.getRow(); 918 try{ 919 res.absolute(row); 920 if(col<1 || col>columnNames.length) { 921 new IndexOutOfBoundsException("invalid column index to retrieve Data from query, valid index goes from 1 to "+columnNames.length); 922 } 923 return Caster.toString(get(columnNames[col])); 924 925 } 926 finally{ 927 res.absolute(rowBefore); 928 } 929 } 930 catch(Throwable t){ 931 throw toRuntimeExc(t); 932 } 933 } 934 935 /** 936 * @see railo.runtime.type.QueryImpl#getName() 937 */ 938 939 public String getName() { 940 return name; 941 } 942 943 /** 944 * @see railo.runtime.type.QueryImpl#getRowCount() 945 */ 946 947 public int getRowCount() { 948 return getRecordcount(); 949 } 950 951 /** 952 * @see railo.runtime.type.QueryImpl#setData(int, int, java.lang.String) 953 */ 954 955 public void setData(int row, int col, String value) 956 throws IndexOutOfBoundsException { 957 throw notSupported(); 958 } 959 960 /** 961 * @see railo.runtime.type.QueryImpl#containsKey(java.lang.String) 962 */ 963 964 public boolean containsKey(String key) { 965 return columns.get(key.toLowerCase())!=null; 966 } 967 968 /** 969 * @see railo.runtime.type.QueryImpl#containsKey(railo.runtime.type.Collection.Key) 970 */ 971 972 public boolean containsKey(Key key) { 973 return containsKey(key.getString()); 974 } 975 976 /** 977 * @see railo.runtime.type.QueryImpl#castToString() 978 */ 979 980 public String castToString() throws ExpressionException { 981 throw notSupported(); 982 } 983 984 /** 985 * @see railo.runtime.type.QueryImpl#castToString(java.lang.String) 986 */ 987 988 public String castToString(String defaultValue) { 989 throw notSupported(); 990 } 991 992 /** 993 * @see railo.runtime.type.QueryImpl#castToBooleanValue() 994 */ 995 996 public boolean castToBooleanValue() throws ExpressionException { 997 throw notSupported(); 998 } 999 1000 /** 1001 * @see railo.runtime.type.QueryImpl#castToBoolean(java.lang.Boolean) 1002 */ 1003 1004 public Boolean castToBoolean(Boolean defaultValue) { 1005 throw notSupported(); 1006 } 1007 1008 /** 1009 * @see railo.runtime.type.QueryImpl#castToDoubleValue() 1010 */ 1011 1012 public double castToDoubleValue() throws ExpressionException { 1013 throw notSupported(); 1014 } 1015 1016 /** 1017 * @see railo.runtime.type.QueryImpl#castToDoubleValue(double) 1018 */ 1019 1020 public double castToDoubleValue(double defaultValue) { 1021 throw notSupported(); 1022 } 1023 1024 /** 1025 * @see railo.runtime.type.QueryImpl#castToDateTime() 1026 */ 1027 1028 public DateTime castToDateTime() throws ExpressionException { 1029 throw notSupported(); 1030 } 1031 1032 /** 1033 * @see railo.runtime.type.QueryImpl#castToDateTime(railo.runtime.type.dt.DateTime) 1034 */ 1035 1036 public DateTime castToDateTime(DateTime defaultValue) { 1037 throw notSupported(); 1038 } 1039 1040 /** 1041 * @see railo.runtime.type.QueryImpl#compareTo(boolean) 1042 */ 1043 1044 public int compareTo(boolean b) throws ExpressionException { 1045 throw notSupported(); 1046 } 1047 1048 /** 1049 * @see railo.runtime.type.QueryImpl#compareTo(railo.runtime.type.dt.DateTime) 1050 */ 1051 1052 public int compareTo(DateTime dt) throws PageException { 1053 throw notSupported(); 1054 } 1055 1056 /** 1057 * @see railo.runtime.type.QueryImpl#compareTo(double) 1058 */ 1059 1060 public int compareTo(double d) throws PageException { 1061 throw notSupported(); 1062 } 1063 1064 /** 1065 * @see railo.runtime.type.QueryImpl#compareTo(java.lang.String) 1066 */ 1067 1068 public int compareTo(String str) throws PageException { 1069 throw notSupported(); 1070 } 1071 1072 /** 1073 * @see railo.runtime.type.QueryImpl#getMetaDataSimple() 1074 */ 1075 public synchronized railo.runtime.type.Array getMetaDataSimple() { 1076 railo.runtime.type.Array cols=new ArrayImpl(); 1077 SimpleQueryColumn sqc; 1078 Struct column; 1079 Iterator<SimpleQueryColumn> it = columns.values().iterator(); 1080 while(it.hasNext()){ 1081 sqc=it.next(); 1082 column=new StructImpl(); 1083 column.setEL(KeyImpl.NAME,sqc.getKey()); 1084 column.setEL("isCaseSensitive",Boolean.FALSE); 1085 column.setEL("typeName",sqc.getTypeAsString()); 1086 cols.appendEL(column); 1087 } 1088 return cols; 1089 } 1090 1091 /** 1092 * @see railo.runtime.type.QueryImpl#getObject(java.lang.String) 1093 */ 1094 1095 public Object getObject(String columnName) throws SQLException { 1096 return res.getObject(toIndex(columnName)); 1097 } 1098 1099 /** 1100 * @see railo.runtime.type.QueryImpl#getObject(int) 1101 */ 1102 1103 public Object getObject(int columnIndex) throws SQLException { 1104 return res.getObject(columnIndex); 1105 } 1106 1107 /** 1108 * @see railo.runtime.type.QueryImpl#getString(int) 1109 */ 1110 1111 public String getString(int columnIndex) throws SQLException { 1112 return res.getString(columnIndex); 1113 } 1114 1115 /** 1116 * @see railo.runtime.type.QueryImpl#getString(java.lang.String) 1117 */ 1118 1119 public String getString(String columnName) throws SQLException { 1120 return res.getString(toIndex(columnName)); 1121 } 1122 1123 /** 1124 * @see railo.runtime.type.QueryImpl#getBoolean(int) 1125 */ 1126 1127 public boolean getBoolean(int columnIndex) throws SQLException { 1128 return res.getBoolean(columnIndex); 1129 } 1130 1131 /** 1132 * @see railo.runtime.type.QueryImpl#getBoolean(java.lang.String) 1133 */ 1134 1135 public boolean getBoolean(String columnName) throws SQLException { 1136 return res.getBoolean(toIndex(columnName)); 1137 } 1138 1139 /** 1140 * @see railo.runtime.type.QueryImpl#call(railo.runtime.PageContext, java.lang.String, java.lang.Object[]) 1141 */ 1142 1143 public Object call(PageContext pc, String methodName, Object[] arguments) 1144 throws PageException { 1145 throw notSupported(); 1146 } 1147 1148 /** 1149 * @see railo.runtime.type.QueryImpl#call(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object[]) 1150 */ 1151 1152 public Object call(PageContext pc, Key methodName, Object[] arguments) 1153 throws PageException { 1154 throw notSupported(); 1155 } 1156 1157 /** 1158 * @see railo.runtime.type.QueryImpl#callWithNamedValues(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct) 1159 */ 1160 1161 public Object callWithNamedValues(PageContext pc, String methodName, 1162 Struct args) throws PageException { 1163 throw notSupported(); 1164 } 1165 1166 /** 1167 * @see railo.runtime.type.QueryImpl#callWithNamedValues(railo.runtime.PageContext, railo.runtime.type.Collection.Key, railo.runtime.type.Struct) 1168 */ 1169 1170 public Object callWithNamedValues(PageContext pc, Key methodName, 1171 Struct args) throws PageException { 1172 throw notSupported(); 1173 } 1174 1175 /** 1176 * @see railo.runtime.type.QueryImpl#get(railo.runtime.PageContext, java.lang.String, java.lang.Object) 1177 */ 1178 1179 public Object get(PageContext pc, String key, Object defaultValue) { 1180 return getAt(KeyImpl.init(key), getCurrentrow(), pc.getId(),defaultValue); 1181 } 1182 1183 /** 1184 * @see railo.runtime.type.QueryImpl#get(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object) 1185 */ 1186 1187 public Object get(PageContext pc, Key key, Object defaultValue) { 1188 return getAt(key, getCurrentrow(), pc.getId(),defaultValue); 1189 } 1190 1191 /** 1192 * @see railo.runtime.type.QueryImpl#get(railo.runtime.PageContext, java.lang.String) 1193 */ 1194 1195 public Object get(PageContext pc, String key) throws PageException { 1196 return getAt(KeyImpl.init(key), getCurrentrow(), pc.getId()); 1197 } 1198 1199 /** 1200 * @see railo.runtime.type.QueryImpl#get(railo.runtime.PageContext, railo.runtime.type.Collection.Key) 1201 */ 1202 1203 public Object get(PageContext pc, Key key) throws PageException { 1204 return getAt(key, getCurrentrow(), pc.getId()); 1205 } 1206 1207 /** 1208 * @see railo.runtime.type.QueryImpl#isInitalized() 1209 */ 1210 1211 public boolean isInitalized() { 1212 return true; 1213 } 1214 1215 /** 1216 * @see railo.runtime.type.QueryImpl#set(railo.runtime.PageContext, java.lang.String, java.lang.Object) 1217 */ 1218 1219 public Object set(PageContext pc, String propertyName, Object value) 1220 throws PageException { 1221 throw notSupported(); 1222 } 1223 1224 /** 1225 * @see railo.runtime.type.QueryImpl#set(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object) 1226 */ 1227 1228 public Object set(PageContext pc, Key propertyName, Object value) 1229 throws PageException { 1230 throw notSupported(); 1231 } 1232 1233 /** 1234 * @see railo.runtime.type.QueryImpl#setEL(railo.runtime.PageContext, java.lang.String, java.lang.Object) 1235 */ 1236 1237 public Object setEL(PageContext pc, String propertyName, Object value) { 1238 throw notSupported(); 1239 } 1240 1241 /** 1242 * @see railo.runtime.type.QueryImpl#setEL(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object) 1243 */ 1244 1245 public Object setEL(PageContext pc, Key propertyName, Object value) { 1246 throw notSupported(); 1247 } 1248 1249 /** 1250 * @see railo.runtime.type.QueryImpl#wasNull() 1251 */ 1252 1253 public boolean wasNull() { 1254 try { 1255 return res.wasNull(); 1256 } catch (SQLException e) { 1257 throw toRuntimeExc(e); 1258 } 1259 } 1260 1261 /** 1262 * @see railo.runtime.type.QueryImpl#absolute(int) 1263 */ 1264 1265 public synchronized boolean absolute(int row) throws SQLException { 1266 return res.absolute(row); 1267 } 1268 1269 /** 1270 * @see railo.runtime.type.QueryImpl#afterLast() 1271 */ 1272 1273 public synchronized void afterLast() throws SQLException { 1274 res.afterLast(); 1275 } 1276 1277 /** 1278 * @see railo.runtime.type.QueryImpl#beforeFirst() 1279 */ 1280 1281 public synchronized void beforeFirst() throws SQLException { 1282 res.beforeFirst(); 1283 } 1284 1285 /** 1286 * @see railo.runtime.type.QueryImpl#cancelRowUpdates() 1287 */ 1288 1289 public synchronized void cancelRowUpdates() throws SQLException { 1290 res.cancelRowUpdates(); 1291 } 1292 1293 /** 1294 * @see railo.runtime.type.QueryImpl#clearWarnings() 1295 */ 1296 1297 public synchronized void clearWarnings() throws SQLException { 1298 res.clearWarnings(); 1299 } 1300 1301 /** 1302 * @see railo.runtime.type.QueryImpl#close() 1303 */ 1304 1305 public synchronized void close() throws SQLException { 1306 res.close(); 1307 } 1308 1309 /** 1310 * @see railo.runtime.type.QueryImpl#deleteRow() 1311 */ 1312 1313 public synchronized void deleteRow() throws SQLException { 1314 res.deleteRow(); 1315 } 1316 1317 /** 1318 * @see railo.runtime.type.QueryImpl#findColumn(java.lang.String) 1319 */ 1320 1321 public int findColumn(String columnName) throws SQLException { 1322 return res.findColumn(columnName); 1323 } 1324 1325 /** 1326 * @see railo.runtime.type.QueryImpl#first() 1327 */ 1328 1329 public synchronized boolean first() throws SQLException { 1330 return res.first(); 1331 } 1332 1333 /** 1334 * @see railo.runtime.type.QueryImpl#getArray(int) 1335 */ 1336 1337 public Array getArray(int i) throws SQLException { 1338 return res.getArray(i); 1339 } 1340 1341 /** 1342 * @see railo.runtime.type.QueryImpl#getArray(java.lang.String) 1343 */ 1344 1345 public Array getArray(String colName) throws SQLException { 1346 return res.getArray(toIndex(colName)); 1347 } 1348 1349 /** 1350 * @see railo.runtime.type.QueryImpl#getAsciiStream(int) 1351 */ 1352 1353 public InputStream getAsciiStream(int columnIndex) throws SQLException { 1354 return res.getAsciiStream(columnIndex); 1355 } 1356 1357 /** 1358 * @see railo.runtime.type.QueryImpl#getAsciiStream(java.lang.String) 1359 */ 1360 1361 public InputStream getAsciiStream(String columnName) throws SQLException { 1362 return res.getAsciiStream(toIndex(columnName)); 1363 } 1364 1365 /** 1366 * @see railo.runtime.type.QueryImpl#getBigDecimal(int) 1367 */ 1368 1369 public BigDecimal getBigDecimal(int columnIndex) throws SQLException { 1370 return res.getBigDecimal(columnIndex); 1371 } 1372 1373 /** 1374 * @see railo.runtime.type.QueryImpl#getBigDecimal(java.lang.String) 1375 */ 1376 1377 public BigDecimal getBigDecimal(String columnName) throws SQLException { 1378 return res.getBigDecimal(toIndex(columnName)); 1379 } 1380 1381 /** 1382 * @see railo.runtime.type.QueryImpl#getBigDecimal(int, int) 1383 */ 1384 1385 public BigDecimal getBigDecimal(int columnIndex, int scale) 1386 throws SQLException { 1387 return res.getBigDecimal(columnIndex, scale); 1388 } 1389 1390 /** 1391 * @see railo.runtime.type.QueryImpl#getBigDecimal(java.lang.String, int) 1392 */ 1393 1394 public BigDecimal getBigDecimal(String columnName, int scale) 1395 throws SQLException { 1396 return res.getBigDecimal(toIndex(columnName), scale); 1397 } 1398 1399 /** 1400 * @see railo.runtime.type.QueryImpl#getBinaryStream(int) 1401 */ 1402 1403 public InputStream getBinaryStream(int columnIndex) throws SQLException { 1404 return res.getBinaryStream(columnIndex); 1405 } 1406 1407 /** 1408 * @see railo.runtime.type.QueryImpl#getBinaryStream(java.lang.String) 1409 */ 1410 1411 public InputStream getBinaryStream(String columnName) throws SQLException { 1412 return res.getBinaryStream(toIndex(columnName)); 1413 } 1414 1415 /** 1416 * @see railo.runtime.type.QueryImpl#getBlob(int) 1417 */ 1418 1419 public Blob getBlob(int i) throws SQLException { 1420 return res.getBlob(i); 1421 } 1422 1423 /** 1424 * @see railo.runtime.type.QueryImpl#getBlob(java.lang.String) 1425 */ 1426 1427 public Blob getBlob(String colName) throws SQLException { 1428 return res.getBlob(toIndex(colName)); 1429 } 1430 1431 /** 1432 * @see railo.runtime.type.QueryImpl#getByte(int) 1433 */ 1434 1435 public byte getByte(int columnIndex) throws SQLException { 1436 return res.getByte(columnIndex); 1437 } 1438 1439 /** 1440 * @see railo.runtime.type.QueryImpl#getByte(java.lang.String) 1441 */ 1442 1443 public byte getByte(String columnName) throws SQLException { 1444 return res.getByte(toIndex(columnName)); 1445 } 1446 1447 /** 1448 * @see railo.runtime.type.QueryImpl#getBytes(int) 1449 */ 1450 1451 public byte[] getBytes(int columnIndex) throws SQLException { 1452 return res.getBytes(columnIndex); 1453 } 1454 1455 /** 1456 * @see railo.runtime.type.QueryImpl#getBytes(java.lang.String) 1457 */ 1458 1459 public byte[] getBytes(String columnName) throws SQLException { 1460 return res.getBytes(toIndex(columnName)); 1461 } 1462 1463 /** 1464 * @see railo.runtime.type.QueryImpl#getCharacterStream(int) 1465 */ 1466 1467 public Reader getCharacterStream(int columnIndex) throws SQLException { 1468 return res.getCharacterStream(columnIndex); 1469 } 1470 1471 /** 1472 * @see railo.runtime.type.QueryImpl#getCharacterStream(java.lang.String) 1473 */ 1474 1475 public Reader getCharacterStream(String columnName) throws SQLException { 1476 return res.getCharacterStream(toIndex(columnName)); 1477 } 1478 1479 /** 1480 * @see railo.runtime.type.QueryImpl#getClob(int) 1481 */ 1482 1483 public Clob getClob(int i) throws SQLException { 1484 return res.getClob(i); 1485 } 1486 1487 /** 1488 * @see railo.runtime.type.QueryImpl#getClob(java.lang.String) 1489 */ 1490 1491 public Clob getClob(String colName) throws SQLException { 1492 return res.getClob(toIndex(colName)); 1493 } 1494 1495 /** 1496 * @see railo.runtime.type.QueryImpl#getConcurrency() 1497 */ 1498 1499 public int getConcurrency() throws SQLException { 1500 return res.getConcurrency(); 1501 } 1502 1503 /** 1504 * @see railo.runtime.type.QueryImpl#getCursorName() 1505 */ 1506 1507 public String getCursorName() throws SQLException { 1508 return res.getCursorName(); 1509 } 1510 1511 /** 1512 * @see railo.runtime.type.QueryImpl#getDate(int) 1513 */ 1514 1515 public Date getDate(int columnIndex) throws SQLException { 1516 return res.getDate(columnIndex); 1517 } 1518 1519 /** 1520 * @see railo.runtime.type.QueryImpl#getDate(java.lang.String) 1521 */ 1522 1523 public Date getDate(String columnName) throws SQLException { 1524 return res.getDate(toIndex(columnName)); 1525 } 1526 1527 /** 1528 * @see railo.runtime.type.QueryImpl#getDate(int, java.util.Calendar) 1529 */ 1530 1531 public Date getDate(int columnIndex, Calendar cal) throws SQLException { 1532 return res.getDate(columnIndex, cal); 1533 } 1534 1535 /** 1536 * @see railo.runtime.type.QueryImpl#getDate(java.lang.String, java.util.Calendar) 1537 */ 1538 1539 public Date getDate(String columnName, Calendar cal) throws SQLException { 1540 return res.getDate(toIndex(columnName), cal); 1541 } 1542 1543 /** 1544 * @see railo.runtime.type.QueryImpl#getDouble(int) 1545 */ 1546 1547 public double getDouble(int columnIndex) throws SQLException { 1548 return res.getDouble(columnIndex); 1549 } 1550 1551 /** 1552 * @see railo.runtime.type.QueryImpl#getDouble(java.lang.String) 1553 */ 1554 1555 public double getDouble(String columnName) throws SQLException { 1556 return res.getDouble(toIndex(columnName)); 1557 } 1558 1559 /** 1560 * @see railo.runtime.type.QueryImpl#getFetchDirection() 1561 */ 1562 1563 public int getFetchDirection() throws SQLException { 1564 return res.getFetchDirection(); 1565 } 1566 1567 /** 1568 * @see railo.runtime.type.QueryImpl#getFetchSize() 1569 */ 1570 1571 public int getFetchSize() throws SQLException { 1572 return res.getFetchSize(); 1573 } 1574 1575 /** 1576 * @see railo.runtime.type.QueryImpl#getFloat(int) 1577 */ 1578 1579 public float getFloat(int columnIndex) throws SQLException { 1580 return res.getFloat(columnIndex); 1581 } 1582 1583 /** 1584 * @see railo.runtime.type.QueryImpl#getFloat(java.lang.String) 1585 */ 1586 1587 public float getFloat(String columnName) throws SQLException { 1588 return res.getFloat(toIndex(columnName)); 1589 } 1590 1591 /** 1592 * @see railo.runtime.type.QueryImpl#getInt(int) 1593 */ 1594 1595 public int getInt(int columnIndex) throws SQLException { 1596 return res.getInt(columnIndex); 1597 } 1598 1599 /** 1600 * @see railo.runtime.type.QueryImpl#getInt(java.lang.String) 1601 */ 1602 1603 public int getInt(String columnName) throws SQLException { 1604 return res.getInt(toIndex(columnName)); 1605 } 1606 1607 /** 1608 * @see railo.runtime.type.QueryImpl#getLong(int) 1609 */ 1610 1611 public long getLong(int columnIndex) throws SQLException { 1612 return res.getLong(columnIndex); 1613 } 1614 1615 /** 1616 * @see railo.runtime.type.QueryImpl#getLong(java.lang.String) 1617 */ 1618 1619 public long getLong(String columnName) throws SQLException { 1620 return res.getLong(toIndex(columnName)); 1621 } 1622 1623 /** 1624 * @see railo.runtime.type.QueryImpl#getObject(int, java.util.Map) 1625 */ 1626 1627 public Object getObject(int i, Map map) throws SQLException { 1628 return res.getObject(i, map); 1629 } 1630 1631 /** 1632 * @see railo.runtime.type.QueryImpl#getObject(java.lang.String, java.util.Map) 1633 */ 1634 1635 public Object getObject(String colName, Map map) throws SQLException { 1636 return res.getObject(toIndex(colName), map); 1637 } 1638 1639 /** 1640 * @see railo.runtime.type.QueryImpl#getRef(int) 1641 */ 1642 1643 public Ref getRef(int i) throws SQLException { 1644 return res.getRef(i); 1645 } 1646 1647 /** 1648 * @see railo.runtime.type.QueryImpl#getRef(java.lang.String) 1649 */ 1650 1651 public Ref getRef(String colName) throws SQLException { 1652 return res.getRef(toIndex(colName)); 1653 } 1654 1655 /** 1656 * @see railo.runtime.type.QueryImpl#getRow() 1657 */ 1658 1659 public int getRow() throws SQLException { 1660 return res.getRow(); 1661 } 1662 1663 /** 1664 * @see railo.runtime.type.QueryImpl#getShort(int) 1665 */ 1666 1667 public short getShort(int columnIndex) throws SQLException { 1668 return res.getShort(columnIndex); 1669 } 1670 1671 /** 1672 * @see railo.runtime.type.QueryImpl#getShort(java.lang.String) 1673 */ 1674 1675 public short getShort(String columnName) throws SQLException { 1676 return res.getShort(toIndex(columnName)); 1677 } 1678 1679 /** 1680 * @see railo.runtime.type.QueryImpl#getStatement() 1681 */ 1682 1683 public Statement getStatement() throws SQLException { 1684 return res.getStatement(); 1685 } 1686 1687 /** 1688 * @see railo.runtime.type.QueryImpl#getTime(int) 1689 */ 1690 1691 public Time getTime(int columnIndex) throws SQLException { 1692 return res.getTime(columnIndex); 1693 } 1694 1695 /** 1696 * @see railo.runtime.type.QueryImpl#getTime(java.lang.String) 1697 */ 1698 1699 public Time getTime(String columnName) throws SQLException { 1700 return res.getTime(toIndex(columnName)); 1701 } 1702 1703 /** 1704 * @see railo.runtime.type.QueryImpl#getTime(int, java.util.Calendar) 1705 */ 1706 1707 public Time getTime(int columnIndex, Calendar cal) throws SQLException { 1708 return res.getTime(columnIndex, cal); 1709 } 1710 1711 /** 1712 * @see railo.runtime.type.QueryImpl#getTime(java.lang.String, java.util.Calendar) 1713 */ 1714 1715 public Time getTime(String columnName, Calendar cal) throws SQLException { 1716 return res.getTime(toIndex(columnName), cal); 1717 } 1718 1719 /** 1720 * @see railo.runtime.type.QueryImpl#getTimestamp(int) 1721 */ 1722 1723 public Timestamp getTimestamp(int columnIndex) throws SQLException { 1724 return res.getTimestamp(columnIndex); 1725 } 1726 1727 /** 1728 * @see railo.runtime.type.QueryImpl#getTimestamp(java.lang.String) 1729 */ 1730 1731 public Timestamp getTimestamp(String columnName) throws SQLException { 1732 return res.getTimestamp(toIndex(columnName)); 1733 } 1734 1735 /** 1736 * @see railo.runtime.type.QueryImpl#getTimestamp(int, java.util.Calendar) 1737 */ 1738 1739 public Timestamp getTimestamp(int columnIndex, Calendar cal) 1740 throws SQLException { 1741 return res.getTimestamp(columnIndex, cal); 1742 } 1743 1744 /** 1745 * @see railo.runtime.type.QueryImpl#getTimestamp(java.lang.String, java.util.Calendar) 1746 */ 1747 1748 public Timestamp getTimestamp(String columnName, Calendar cal) 1749 throws SQLException { 1750 return res.getTimestamp(toIndex(columnName), cal); 1751 } 1752 1753 /** 1754 * @see railo.runtime.type.QueryImpl#getType() 1755 */ 1756 1757 public int getType() throws SQLException { 1758 return res.getType(); 1759 } 1760 1761 /** 1762 * @see railo.runtime.type.QueryImpl#getURL(int) 1763 */ 1764 1765 public URL getURL(int columnIndex) throws SQLException { 1766 return res.getURL(columnIndex); 1767 } 1768 1769 /** 1770 * @see railo.runtime.type.QueryImpl#getURL(java.lang.String) 1771 */ 1772 1773 public URL getURL(String columnName) throws SQLException { 1774 return res.getURL(toIndex(columnName)); 1775 } 1776 1777 /** 1778 * @see railo.runtime.type.QueryImpl#getUnicodeStream(int) 1779 */ 1780 1781 public InputStream getUnicodeStream(int columnIndex) throws SQLException { 1782 return res.getUnicodeStream(columnIndex); 1783 } 1784 1785 /** 1786 * @see railo.runtime.type.QueryImpl#getUnicodeStream(java.lang.String) 1787 */ 1788 1789 public InputStream getUnicodeStream(String columnName) throws SQLException { 1790 return res.getUnicodeStream(toIndex(columnName)); 1791 } 1792 1793 /** 1794 * @see railo.runtime.type.QueryImpl#getWarnings() 1795 */ 1796 1797 public SQLWarning getWarnings() throws SQLException { 1798 return res.getWarnings(); 1799 } 1800 1801 /** 1802 * @see railo.runtime.type.QueryImpl#insertRow() 1803 */ 1804 1805 public void insertRow() throws SQLException { 1806 res.insertRow(); 1807 } 1808 1809 /** 1810 * @see railo.runtime.type.QueryImpl#isAfterLast() 1811 */ 1812 1813 public boolean isAfterLast() throws SQLException { 1814 return res.isAfterLast(); 1815 } 1816 1817 /** 1818 * @see railo.runtime.type.QueryImpl#isBeforeFirst() 1819 */ 1820 1821 public boolean isBeforeFirst() throws SQLException { 1822 return res.isBeforeFirst(); 1823 } 1824 1825 /** 1826 * @see railo.runtime.type.QueryImpl#isFirst() 1827 */ 1828 1829 public boolean isFirst() throws SQLException { 1830 return res.isFirst(); 1831 } 1832 1833 /** 1834 * @see railo.runtime.type.QueryImpl#isLast() 1835 */ 1836 1837 public boolean isLast() throws SQLException { 1838 return res.isLast(); 1839 } 1840 1841 /** 1842 * @see railo.runtime.type.QueryImpl#last() 1843 */ 1844 1845 public boolean last() throws SQLException { 1846 return res.last(); 1847 } 1848 1849 /** 1850 * @see railo.runtime.type.QueryImpl#moveToCurrentRow() 1851 */ 1852 1853 public void moveToCurrentRow() throws SQLException { 1854 res.moveToCurrentRow(); 1855 } 1856 1857 /** 1858 * @see railo.runtime.type.QueryImpl#moveToInsertRow() 1859 */ 1860 1861 public void moveToInsertRow() throws SQLException { 1862 res.moveToInsertRow(); 1863 } 1864 1865 /** 1866 * @see railo.runtime.type.QueryImpl#previous() 1867 */ 1868 1869 public boolean previous() { 1870 throw notSupported(); 1871 } 1872 1873 /** 1874 * @see railo.runtime.type.QueryImpl#previous(int) 1875 */ 1876 1877 public boolean previous(int pid) { 1878 throw notSupported(); 1879 } 1880 1881 /** 1882 * @see railo.runtime.type.QueryImpl#refreshRow() 1883 */ 1884 1885 public void refreshRow() throws SQLException { 1886 res.refreshRow(); 1887 } 1888 1889 /** 1890 * @see railo.runtime.type.QueryImpl#relative(int) 1891 */ 1892 1893 public boolean relative(int rows) throws SQLException { 1894 return res.relative(rows); 1895 } 1896 1897 /** 1898 * @see railo.runtime.type.QueryImpl#rowDeleted() 1899 */ 1900 1901 public boolean rowDeleted() throws SQLException { 1902 return res.rowDeleted(); 1903 } 1904 1905 /** 1906 * @see railo.runtime.type.QueryImpl#rowInserted() 1907 */ 1908 1909 public boolean rowInserted() throws SQLException { 1910 return res.rowInserted(); 1911 } 1912 1913 /** 1914 * @see railo.runtime.type.QueryImpl#rowUpdated() 1915 */ 1916 1917 public boolean rowUpdated() throws SQLException { 1918 return res.rowUpdated(); 1919 } 1920 1921 /** 1922 * @see railo.runtime.type.QueryImpl#setFetchDirection(int) 1923 */ 1924 1925 public void setFetchDirection(int direction) throws SQLException { 1926 res.setFetchDirection(direction); 1927 } 1928 1929 /** 1930 * @see railo.runtime.type.QueryImpl#setFetchSize(int) 1931 */ 1932 1933 public void setFetchSize(int rows) throws SQLException { 1934 res.setFetchSize(rows); 1935 } 1936 1937 /** 1938 * @see railo.runtime.type.QueryImpl#updateArray(int, java.sql.Array) 1939 */ 1940 1941 public void updateArray(int columnIndex, Array x) throws SQLException { 1942 res.updateArray(columnIndex, x); 1943 } 1944 1945 /** 1946 * @see railo.runtime.type.QueryImpl#updateArray(java.lang.String, java.sql.Array) 1947 */ 1948 1949 public void updateArray(String columnName, Array x) throws SQLException { 1950 res.updateArray(toIndex(columnName), x); 1951 } 1952 1953 /** 1954 * @see railo.runtime.type.QueryImpl#updateAsciiStream(int, java.io.InputStream, int) 1955 */ 1956 1957 public void updateAsciiStream(int columnIndex, InputStream x, int length) 1958 throws SQLException { 1959 res.updateAsciiStream(columnIndex, x, length); 1960 } 1961 1962 /** 1963 * @see railo.runtime.type.QueryImpl#updateAsciiStream(java.lang.String, java.io.InputStream, int) 1964 */ 1965 1966 public void updateAsciiStream(String columnName, InputStream x, int length) 1967 throws SQLException { 1968 res.updateAsciiStream(toIndex(columnName), x, length); 1969 } 1970 1971 /** 1972 * @see railo.runtime.type.QueryImpl#updateBigDecimal(int, java.math.BigDecimal) 1973 */ 1974 1975 public void updateBigDecimal(int columnIndex, BigDecimal x) 1976 throws SQLException { 1977 res.updateBigDecimal(columnIndex, x); 1978 } 1979 1980 /** 1981 * @see railo.runtime.type.QueryImpl#updateBigDecimal(java.lang.String, java.math.BigDecimal) 1982 */ 1983 1984 public void updateBigDecimal(String columnName, BigDecimal x) 1985 throws SQLException { 1986 res.updateBigDecimal(toIndex(columnName), x); 1987 } 1988 1989 /** 1990 * @see railo.runtime.type.QueryImpl#updateBinaryStream(int, java.io.InputStream, int) 1991 */ 1992 1993 public void updateBinaryStream(int columnIndex, InputStream x, int length) 1994 throws SQLException { 1995 res.updateBinaryStream(columnIndex, x, length); 1996 } 1997 1998 /** 1999 * @see railo.runtime.type.QueryImpl#updateBinaryStream(java.lang.String, java.io.InputStream, int) 2000 */ 2001 2002 public void updateBinaryStream(String columnName, InputStream x, int length) 2003 throws SQLException { 2004 res.updateBinaryStream(toIndex(columnName), x, length); 2005 } 2006 2007 /** 2008 * @see railo.runtime.type.QueryImpl#updateBlob(int, java.sql.Blob) 2009 */ 2010 2011 public void updateBlob(int columnIndex, Blob x) throws SQLException { 2012 res.updateBlob(columnIndex, x); 2013 } 2014 2015 /** 2016 * @see railo.runtime.type.QueryImpl#updateBlob(java.lang.String, java.sql.Blob) 2017 */ 2018 2019 public void updateBlob(String columnName, Blob x) throws SQLException { 2020 res.updateBlob(toIndex(columnName), x); 2021 } 2022 2023 /** 2024 * @see railo.runtime.type.QueryImpl#updateBoolean(int, boolean) 2025 */ 2026 2027 public void updateBoolean(int columnIndex, boolean x) throws SQLException { 2028 res.updateBoolean(columnIndex, x); 2029 } 2030 2031 /** 2032 * @see railo.runtime.type.QueryImpl#updateBoolean(java.lang.String, boolean) 2033 */ 2034 2035 public void updateBoolean(String columnName, boolean x) throws SQLException { 2036 res.updateBoolean(toIndex(columnName), x); 2037 } 2038 2039 /** 2040 * @see railo.runtime.type.QueryImpl#updateByte(int, byte) 2041 */ 2042 2043 public void updateByte(int columnIndex, byte x) throws SQLException { 2044 res.updateByte(columnIndex, x); 2045 } 2046 2047 /** 2048 * @see railo.runtime.type.QueryImpl#updateByte(java.lang.String, byte) 2049 */ 2050 2051 public void updateByte(String columnName, byte x) throws SQLException { 2052 res.updateByte(toIndex(columnName), x); 2053 } 2054 2055 /** 2056 * @see railo.runtime.type.QueryImpl#updateBytes(int, byte[]) 2057 */ 2058 2059 public void updateBytes(int columnIndex, byte[] x) throws SQLException { 2060 res.updateBytes(columnIndex, x); 2061 } 2062 2063 /** 2064 * @see railo.runtime.type.QueryImpl#updateBytes(java.lang.String, byte[]) 2065 */ 2066 2067 public void updateBytes(String columnName, byte[] x) throws SQLException { 2068 res.updateBytes(toIndex(columnName), x); 2069 } 2070 2071 /** 2072 * @see railo.runtime.type.QueryImpl#updateCharacterStream(int, java.io.Reader, int) 2073 */ 2074 2075 public void updateCharacterStream(int columnIndex, Reader reader, int length) 2076 throws SQLException { 2077 res.updateCharacterStream(columnIndex, reader, length); 2078 } 2079 2080 /** 2081 * @see railo.runtime.type.QueryImpl#updateCharacterStream(java.lang.String, java.io.Reader, int) 2082 */ 2083 2084 public void updateCharacterStream(String columnName, Reader reader, 2085 int length) throws SQLException { 2086 res.updateCharacterStream(toIndex(columnName), reader, length); 2087 } 2088 2089 /** 2090 * @see railo.runtime.type.QueryImpl#updateClob(int, java.sql.Clob) 2091 */ 2092 2093 public void updateClob(int columnIndex, Clob x) throws SQLException { 2094 res.updateClob(columnIndex, x); 2095 } 2096 2097 /** 2098 * @see railo.runtime.type.QueryImpl#updateClob(java.lang.String, java.sql.Clob) 2099 */ 2100 2101 public void updateClob(String columnName, Clob x) throws SQLException { 2102 res.updateClob(toIndex(columnName), x); 2103 } 2104 2105 /** 2106 * @see railo.runtime.type.QueryImpl#updateDate(int, java.sql.Date) 2107 */ 2108 2109 public void updateDate(int columnIndex, Date x) throws SQLException { 2110 res.updateDate(columnIndex, x); 2111 } 2112 2113 /** 2114 * @see railo.runtime.type.QueryImpl#updateDate(java.lang.String, java.sql.Date) 2115 */ 2116 2117 public void updateDate(String columnName, Date x) throws SQLException { 2118 res.updateDate(toIndex(columnName), x); 2119 } 2120 2121 /** 2122 * @see railo.runtime.type.QueryImpl#updateDouble(int, double) 2123 */ 2124 2125 public void updateDouble(int columnIndex, double x) throws SQLException { 2126 res.updateDouble(columnIndex, x); 2127 } 2128 2129 /** 2130 * @see railo.runtime.type.QueryImpl#updateDouble(java.lang.String, double) 2131 */ 2132 2133 public void updateDouble(String columnName, double x) throws SQLException { 2134 res.updateDouble(toIndex(columnName), x); 2135 } 2136 2137 /** 2138 * @see railo.runtime.type.QueryImpl#updateFloat(int, float) 2139 */ 2140 2141 public void updateFloat(int columnIndex, float x) throws SQLException { 2142 res.updateFloat(columnIndex, x); 2143 } 2144 2145 /** 2146 * @see railo.runtime.type.QueryImpl#updateFloat(java.lang.String, float) 2147 */ 2148 2149 public void updateFloat(String columnName, float x) throws SQLException { 2150 res.updateFloat(toIndex(columnName), x); 2151 } 2152 2153 /** 2154 * @see railo.runtime.type.QueryImpl#updateInt(int, int) 2155 */ 2156 2157 public void updateInt(int columnIndex, int x) throws SQLException { 2158 res.updateInt(columnIndex, x); 2159 } 2160 2161 /** 2162 * @see railo.runtime.type.QueryImpl#updateInt(java.lang.String, int) 2163 */ 2164 2165 public void updateInt(String columnName, int x) throws SQLException { 2166 res.updateInt(toIndex(columnName), x); 2167 } 2168 2169 /** 2170 * @see railo.runtime.type.QueryImpl#updateLong(int, long) 2171 */ 2172 2173 public void updateLong(int columnIndex, long x) throws SQLException { 2174 res.updateLong(columnIndex, x); 2175 } 2176 2177 /** 2178 * @see railo.runtime.type.QueryImpl#updateLong(java.lang.String, long) 2179 */ 2180 2181 public void updateLong(String columnName, long x) throws SQLException { 2182 res.updateLong(toIndex(columnName), x); 2183 } 2184 2185 /** 2186 * @see railo.runtime.type.QueryImpl#updateNull(int) 2187 */ 2188 2189 public void updateNull(int columnIndex) throws SQLException { 2190 res.updateNull(columnIndex); 2191 } 2192 2193 /** 2194 * @see railo.runtime.type.QueryImpl#updateNull(java.lang.String) 2195 */ 2196 2197 public void updateNull(String columnName) throws SQLException { 2198 res.updateNull(toIndex(columnName)); 2199 } 2200 2201 /** 2202 * @see railo.runtime.type.QueryImpl#updateObject(int, java.lang.Object) 2203 */ 2204 2205 public void updateObject(int columnIndex, Object x) throws SQLException { 2206 res.updateObject(columnIndex, x); 2207 } 2208 2209 /** 2210 * @see railo.runtime.type.QueryImpl#updateObject(java.lang.String, java.lang.Object) 2211 */ 2212 2213 public void updateObject(String columnName, Object x) throws SQLException { 2214 res.updateObject(toIndex(columnName), x); 2215 } 2216 2217 /** 2218 * @see railo.runtime.type.QueryImpl#updateObject(int, java.lang.Object, int) 2219 */ 2220 2221 public void updateObject(int columnIndex, Object x, int scale) 2222 throws SQLException { 2223 res.updateObject(columnIndex, x, scale); 2224 } 2225 2226 /** 2227 * @see railo.runtime.type.QueryImpl#updateObject(java.lang.String, java.lang.Object, int) 2228 */ 2229 2230 public void updateObject(String columnName, Object x, int scale) 2231 throws SQLException { 2232 res.updateObject(toIndex(columnName), x, scale); 2233 } 2234 2235 /** 2236 * @see railo.runtime.type.QueryImpl#updateRef(int, java.sql.Ref) 2237 */ 2238 2239 public void updateRef(int columnIndex, Ref x) throws SQLException { 2240 res.updateRef(columnIndex, x); 2241 } 2242 2243 /** 2244 * @see railo.runtime.type.QueryImpl#updateRef(java.lang.String, java.sql.Ref) 2245 */ 2246 2247 public void updateRef(String columnName, Ref x) throws SQLException { 2248 res.updateRef(toIndex(columnName), x); 2249 } 2250 2251 /** 2252 * @see railo.runtime.type.QueryImpl#updateRow() 2253 */ 2254 2255 public void updateRow() throws SQLException { 2256 res.updateRow(); 2257 } 2258 2259 /** 2260 * @see railo.runtime.type.QueryImpl#updateShort(int, short) 2261 */ 2262 2263 public void updateShort(int columnIndex, short x) throws SQLException { 2264 res.updateShort(columnIndex, x); 2265 } 2266 2267 /** 2268 * @see railo.runtime.type.QueryImpl#updateShort(java.lang.String, short) 2269 */ 2270 2271 public void updateShort(String columnName, short x) throws SQLException { 2272 res.updateShort(toIndex(columnName), x); 2273 } 2274 2275 /** 2276 * @see railo.runtime.type.QueryImpl#updateString(int, java.lang.String) 2277 */ 2278 2279 public void updateString(int columnIndex, String x) throws SQLException { 2280 res.updateString(columnIndex, x); 2281 } 2282 2283 /** 2284 * @see railo.runtime.type.QueryImpl#updateString(java.lang.String, java.lang.String) 2285 */ 2286 2287 public void updateString(String columnName, String x) throws SQLException { 2288 res.updateString(toIndex(columnName), x); 2289 } 2290 2291 /** 2292 * @see railo.runtime.type.QueryImpl#updateTime(int, java.sql.Time) 2293 */ 2294 2295 public void updateTime(int columnIndex, Time x) throws SQLException { 2296 res.updateTime(columnIndex, x); 2297 } 2298 2299 /** 2300 * @see railo.runtime.type.QueryImpl#updateTime(java.lang.String, java.sql.Time) 2301 */ 2302 2303 public void updateTime(String columnName, Time x) throws SQLException { 2304 res.updateTime(toIndex(columnName), x); 2305 } 2306 2307 /** 2308 * @see railo.runtime.type.QueryImpl#updateTimestamp(int, java.sql.Timestamp) 2309 */ 2310 2311 public void updateTimestamp(int columnIndex, Timestamp x) 2312 throws SQLException { 2313 res.updateTimestamp(columnIndex, x); 2314 } 2315 2316 /** 2317 * @see railo.runtime.type.QueryImpl#updateTimestamp(java.lang.String, java.sql.Timestamp) 2318 */ 2319 2320 public void updateTimestamp(String columnName, Timestamp x) 2321 throws SQLException { 2322 res.updateTimestamp(toIndex(columnName), x); 2323 } 2324 2325 /** 2326 * @see railo.runtime.type.QueryImpl#getMetaData() 2327 */ 2328 2329 public ResultSetMetaData getMetaData() throws SQLException { 2330 return res.getMetaData(); 2331 } 2332 2333 /** 2334 * @see railo.runtime.type.Collection#keyIterator() 2335 */ 2336 public Iterator keyIterator() { 2337 return new KeyIterator(keys()); 2338 } 2339 2340 2341 /** 2342 * @see railo.runtime.type.Iteratorable#iterator() 2343 */ 2344 public Iterator iterator() { 2345 return keyIterator(); 2346 } 2347 2348 /** 2349 * @see railo.runtime.type.Iteratorable#valueIterator() 2350 */ 2351 public Iterator valueIterator() { 2352 return new CollectionIterator(keys(),this); 2353 } 2354 2355 /** 2356 * @see railo.runtime.type.QueryImpl#equals(java.lang.Object) 2357 */ 2358 2359 public boolean equals(Object obj) { 2360 return res.equals(obj); 2361 } 2362 2363 /** 2364 * @see railo.runtime.type.QueryImpl#getHoldability() 2365 */ 2366 2367 public int getHoldability() throws SQLException { 2368 return res.getHoldability(); 2369 } 2370 2371 /** 2372 * @see railo.runtime.type.QueryImpl#isClosed() 2373 */ 2374 2375 public boolean isClosed() throws SQLException { 2376 return res.isClosed(); 2377 } 2378 2379 /** 2380 * @see railo.runtime.type.QueryImpl#updateNString(int, java.lang.String) 2381 */ 2382 2383 public void updateNString(int columnIndex, String nString) 2384 throws SQLException { 2385 res.updateNString(columnIndex, nString); 2386 } 2387 2388 /** 2389 * @see railo.runtime.type.QueryImpl#updateNString(java.lang.String, java.lang.String) 2390 */ 2391 2392 public void updateNString(String columnLabel, String nString) 2393 throws SQLException { 2394 res.updateNString(toIndex(columnLabel), nString); 2395 } 2396 2397 /** 2398 * @see railo.runtime.type.QueryImpl#getNString(int) 2399 */ 2400 2401 public String getNString(int columnIndex) throws SQLException { 2402 return res.getNString(columnIndex); 2403 } 2404 2405 /** 2406 * @see railo.runtime.type.QueryImpl#getNString(java.lang.String) 2407 */ 2408 2409 public String getNString(String columnLabel) throws SQLException { 2410 return res.getNString(toIndex(columnLabel)); 2411 } 2412 2413 /** 2414 * @see railo.runtime.type.QueryImpl#getNCharacterStream(int) 2415 */ 2416 2417 public Reader getNCharacterStream(int columnIndex) throws SQLException { 2418 return res.getNCharacterStream(columnIndex); 2419 } 2420 2421 /** 2422 * @see railo.runtime.type.QueryImpl#getNCharacterStream(java.lang.String) 2423 */ 2424 2425 public Reader getNCharacterStream(String columnLabel) throws SQLException { 2426 return res.getNCharacterStream(toIndex(columnLabel)); 2427 } 2428 2429 /** 2430 * @see railo.runtime.type.QueryImpl#updateNCharacterStream(int, java.io.Reader, long) 2431 */ 2432 2433 public void updateNCharacterStream(int columnIndex, Reader x, long length) 2434 throws SQLException { 2435 res.updateNCharacterStream(columnIndex, x, length); 2436 } 2437 2438 /** 2439 * @see railo.runtime.type.QueryImpl#updateNCharacterStream(java.lang.String, java.io.Reader, long) 2440 */ 2441 2442 public void updateNCharacterStream(String columnLabel, Reader reader, 2443 long length) throws SQLException { 2444 res.updateNCharacterStream(toIndex(columnLabel), reader, length); 2445 } 2446 2447 /** 2448 * @see railo.runtime.type.QueryImpl#updateAsciiStream(int, java.io.InputStream, long) 2449 */ 2450 2451 public void updateAsciiStream(int columnIndex, InputStream x, long length) 2452 throws SQLException { 2453 res.updateAsciiStream(columnIndex, x, length); 2454 } 2455 2456 /** 2457 * @see railo.runtime.type.QueryImpl#updateBinaryStream(int, java.io.InputStream, long) 2458 */ 2459 2460 public void updateBinaryStream(int columnIndex, InputStream x, long length) 2461 throws SQLException { 2462 res.updateBinaryStream(columnIndex, x, length); 2463 } 2464 2465 /** 2466 * @see railo.runtime.type.QueryImpl#updateCharacterStream(int, java.io.Reader, long) 2467 */ 2468 2469 public void updateCharacterStream(int columnIndex, Reader x, long length) 2470 throws SQLException { 2471 res.updateCharacterStream(columnIndex, x, length); 2472 } 2473 2474 /** 2475 * @see railo.runtime.type.QueryImpl#updateAsciiStream(java.lang.String, java.io.InputStream, long) 2476 */ 2477 2478 public void updateAsciiStream(String columnLabel, InputStream x, long length) 2479 throws SQLException { 2480 res.updateAsciiStream(toIndex(columnLabel), x, length); 2481 } 2482 2483 /** 2484 * @see railo.runtime.type.QueryImpl#updateBinaryStream(java.lang.String, java.io.InputStream, long) 2485 */ 2486 2487 public void updateBinaryStream(String columnLabel, InputStream x, 2488 long length) throws SQLException { 2489 res.updateBinaryStream(toIndex(columnLabel), x, length); 2490 } 2491 2492 /** 2493 * @see railo.runtime.type.QueryImpl#updateCharacterStream(java.lang.String, java.io.Reader, long) 2494 */ 2495 2496 public void updateCharacterStream(String columnLabel, Reader reader, 2497 long length) throws SQLException { 2498 res.updateCharacterStream(toIndex(columnLabel), reader, length); 2499 } 2500 2501 /** 2502 * @see railo.runtime.type.QueryImpl#updateBlob(int, java.io.InputStream, long) 2503 */ 2504 2505 public void updateBlob(int columnIndex, InputStream inputStream, long length) 2506 throws SQLException { 2507 res.updateBlob(columnIndex, inputStream, length); 2508 } 2509 2510 /** 2511 * @see railo.runtime.type.QueryImpl#updateBlob(java.lang.String, java.io.InputStream, long) 2512 */ 2513 2514 public void updateBlob(String columnLabel, InputStream inputStream, 2515 long length) throws SQLException { 2516 res.updateBlob(toIndex(columnLabel), inputStream, length); 2517 } 2518 2519 /** 2520 * @see railo.runtime.type.QueryImpl#updateClob(int, java.io.Reader, long) 2521 */ 2522 2523 public void updateClob(int columnIndex, Reader reader, long length) 2524 throws SQLException { 2525 res.updateClob(columnIndex, reader, length); 2526 } 2527 2528 /** 2529 * @see railo.runtime.type.QueryImpl#updateClob(java.lang.String, java.io.Reader, long) 2530 */ 2531 2532 public void updateClob(String columnLabel, Reader reader, long length) 2533 throws SQLException { 2534 res.updateClob(toIndex(columnLabel), reader, length); 2535 } 2536 2537 /** 2538 * @see railo.runtime.type.QueryImpl#updateNClob(int, java.io.Reader, long) 2539 */ 2540 2541 public void updateNClob(int columnIndex, Reader reader, long length) 2542 throws SQLException { 2543 res.updateNClob(columnIndex, reader, length); 2544 } 2545 2546 /** 2547 * @see railo.runtime.type.QueryImpl#updateNClob(java.lang.String, java.io.Reader, long) 2548 */ 2549 2550 public void updateNClob(String columnLabel, Reader reader, long length) 2551 throws SQLException { 2552 res.updateNClob(toIndex(columnLabel), reader, length); 2553 } 2554 2555 /** 2556 * @see railo.runtime.type.QueryImpl#updateNCharacterStream(int, java.io.Reader) 2557 */ 2558 2559 public void updateNCharacterStream(int columnIndex, Reader x) 2560 throws SQLException { 2561 res.updateNCharacterStream(columnIndex, x); 2562 } 2563 2564 /** 2565 * @see railo.runtime.type.QueryImpl#updateNCharacterStream(java.lang.String, java.io.Reader) 2566 */ 2567 2568 public void updateNCharacterStream(String columnLabel, Reader reader) 2569 throws SQLException { 2570 res.updateNCharacterStream(toIndex(columnLabel), reader); 2571 } 2572 2573 /** 2574 * @see railo.runtime.type.QueryImpl#updateAsciiStream(int, java.io.InputStream) 2575 */ 2576 2577 public void updateAsciiStream(int columnIndex, InputStream x) 2578 throws SQLException { 2579 res.updateAsciiStream(columnIndex, x); 2580 } 2581 2582 /** 2583 * @see railo.runtime.type.QueryImpl#updateBinaryStream(int, java.io.InputStream) 2584 */ 2585 2586 public void updateBinaryStream(int columnIndex, InputStream x) 2587 throws SQLException { 2588 res.updateBinaryStream(columnIndex, x); 2589 } 2590 2591 /** 2592 * @see railo.runtime.type.QueryImpl#updateCharacterStream(int, java.io.Reader) 2593 */ 2594 2595 public void updateCharacterStream(int columnIndex, Reader x) 2596 throws SQLException { 2597 res.updateCharacterStream(columnIndex, x); 2598 } 2599 2600 /** 2601 * @see railo.runtime.type.QueryImpl#updateAsciiStream(java.lang.String, java.io.InputStream) 2602 */ 2603 2604 public void updateAsciiStream(String columnLabel, InputStream x) 2605 throws SQLException { 2606 res.updateAsciiStream(toIndex(columnLabel), x); 2607 } 2608 2609 /** 2610 * @see railo.runtime.type.QueryImpl#updateBinaryStream(java.lang.String, java.io.InputStream) 2611 */ 2612 2613 public void updateBinaryStream(String columnLabel, InputStream x) 2614 throws SQLException { 2615 res.updateBinaryStream(columnLabel, x); 2616 } 2617 2618 /** 2619 * @see railo.runtime.type.QueryImpl#updateCharacterStream(java.lang.String, java.io.Reader) 2620 */ 2621 2622 public void updateCharacterStream(String columnLabel, Reader reader) 2623 throws SQLException { 2624 res.updateCharacterStream(toIndex(columnLabel), reader); 2625 } 2626 2627 /** 2628 * @see railo.runtime.type.QueryImpl#updateBlob(int, java.io.InputStream) 2629 */ 2630 2631 public void updateBlob(int columnIndex, InputStream inputStream) 2632 throws SQLException { 2633 res.updateBlob(columnIndex, inputStream); 2634 } 2635 2636 /** 2637 * @see railo.runtime.type.QueryImpl#updateBlob(java.lang.String, java.io.InputStream) 2638 */ 2639 2640 public void updateBlob(String columnLabel, InputStream inputStream) 2641 throws SQLException { 2642 res.updateBlob(toIndex(columnLabel), inputStream); 2643 } 2644 2645 /** 2646 * @see railo.runtime.type.QueryImpl#updateClob(int, java.io.Reader) 2647 */ 2648 2649 public void updateClob(int columnIndex, Reader reader) throws SQLException { 2650 res.updateClob(columnIndex, reader); 2651 } 2652 2653 /** 2654 * @see railo.runtime.type.QueryImpl#updateClob(java.lang.String, java.io.Reader) 2655 */ 2656 2657 public void updateClob(String columnLabel, Reader reader) 2658 throws SQLException { 2659 res.updateClob(toIndex(columnLabel), reader); 2660 } 2661 2662 /** 2663 * @see railo.runtime.type.QueryImpl#updateNClob(int, java.io.Reader) 2664 */ 2665 2666 public void updateNClob(int columnIndex, Reader reader) throws SQLException { 2667 res.updateNClob(columnIndex, reader); 2668 } 2669 2670 /** 2671 * @see railo.runtime.type.QueryImpl#updateNClob(java.lang.String, java.io.Reader) 2672 */ 2673 2674 public void updateNClob(String columnLabel, Reader reader) 2675 throws SQLException { 2676 res.updateNClob(toIndex(columnLabel), reader); 2677 } 2678 2679 /** 2680 * @see railo.runtime.type.QueryImpl#unwrap(java.lang.Class) 2681 */ 2682 2683 public <T> T unwrap(Class<T> iface) throws SQLException { 2684 return res.unwrap(iface); 2685 } 2686 2687 /** 2688 * @see railo.runtime.type.QueryImpl#isWrapperFor(java.lang.Class) 2689 */ 2690 2691 public boolean isWrapperFor(Class<?> iface) throws SQLException { 2692 return res.isWrapperFor(iface); 2693 } 2694 2695 /** 2696 * @see railo.runtime.type.QueryImpl#updateNClob(int, java.sql.NClob) 2697 */ 2698 2699 public void updateNClob(int columnIndex, NClob nClob) throws SQLException { 2700 res.updateNClob(columnIndex, nClob); 2701 } 2702 2703 /** 2704 * @see railo.runtime.type.QueryImpl#updateNClob(java.lang.String, java.sql.NClob) 2705 */ 2706 2707 public void updateNClob(String columnLabel, NClob nClob) 2708 throws SQLException { 2709 res.updateNClob(toIndex(columnLabel), nClob); 2710 } 2711 2712 /** 2713 * @see railo.runtime.type.QueryImpl#getNClob(int) 2714 */ 2715 2716 public NClob getNClob(int columnIndex) throws SQLException { 2717 return res.getNClob(columnIndex); 2718 } 2719 2720 /** 2721 * @see railo.runtime.type.QueryImpl#getNClob(java.lang.String) 2722 */ 2723 2724 public NClob getNClob(String columnLabel) throws SQLException { 2725 return res.getNClob(toIndex(columnLabel)); 2726 } 2727 2728 /** 2729 * @see railo.runtime.type.QueryImpl#getSQLXML(int) 2730 */ 2731 2732 public SQLXML getSQLXML(int columnIndex) throws SQLException { 2733 return res.getSQLXML(columnIndex); 2734 } 2735 2736 /** 2737 * @see railo.runtime.type.QueryImpl#getSQLXML(java.lang.String) 2738 */ 2739 2740 public SQLXML getSQLXML(String columnLabel) throws SQLException { 2741 return res.getSQLXML(toIndex(columnLabel)); 2742 } 2743 2744 /** 2745 * @see railo.runtime.type.QueryImpl#updateSQLXML(int, java.sql.SQLXML) 2746 */ 2747 2748 public void updateSQLXML(int columnIndex, SQLXML xmlObject) 2749 throws SQLException { 2750 res.updateSQLXML(columnIndex, xmlObject); 2751 } 2752 2753 /** 2754 * @see railo.runtime.type.QueryImpl#updateSQLXML(java.lang.String, java.sql.SQLXML) 2755 */ 2756 2757 public void updateSQLXML(String columnLabel, SQLXML xmlObject) 2758 throws SQLException { 2759 res.updateSQLXML(toIndex(columnLabel), xmlObject); 2760 } 2761 2762 /** 2763 * @see railo.runtime.type.QueryImpl#getRowId(int) 2764 */ 2765 2766 public RowId getRowId(int columnIndex) throws SQLException { 2767 return res.getRowId(columnIndex); 2768 } 2769 2770 /** 2771 * @see railo.runtime.type.QueryImpl#getRowId(java.lang.String) 2772 */ 2773 2774 public RowId getRowId(String columnLabel) throws SQLException { 2775 return res.getRowId(toIndex(columnLabel)); 2776 } 2777 2778 /** 2779 * @see railo.runtime.type.QueryImpl#updateRowId(int, java.sql.RowId) 2780 */ 2781 2782 public void updateRowId(int columnIndex, RowId x) throws SQLException { 2783 res.updateRowId(columnIndex, x); 2784 } 2785 2786 /** 2787 * @see railo.runtime.type.QueryImpl#updateRowId(java.lang.String, java.sql.RowId) 2788 */ 2789 2790 public void updateRowId(String columnLabel, RowId x) throws SQLException { 2791 res.updateRowId(toIndex(columnLabel), x); 2792 } 2793 2794 /** 2795 * @see railo.runtime.type.QueryImpl#enableShowQueryUsage() 2796 */ 2797 2798 public synchronized void enableShowQueryUsage() { 2799 throw notSupported(); 2800 } 2801 2802 2803 2804 public static PageRuntimeException notSupported() { 2805 return new PageRuntimeException(new ApplicationException("not supported")); 2806 } 2807 2808 public static PageRuntimeException toRuntimeExc(Throwable t) { 2809 return new PageRuntimeException(Caster.toPageException(t)); 2810 } 2811 2812 public static PageException toPageExc(Throwable t) { 2813 return Caster.toPageException(t); 2814 } 2815 2816 private int toIndex(String columnName) throws SQLException { 2817 SimpleQueryColumn col = columns.get(columnName.toLowerCase()); 2818 if(col==null) throw new SQLException("There is no column with name ["+columnName+"], available columns are ["+getColumnlist()+"]"); 2819 return col.getIndex(); 2820 } 2821 2822 int getPid() { 2823 2824 PageContext pc = ThreadLocalPageContext.get(); 2825 if(pc==null) { 2826 pc=CFMLEngineFactory.getInstance().getThreadPageContext(); 2827 if(pc==null)throw new RuntimeException("cannot get pid for current thread"); 2828 } 2829 return pc.getId(); 2830 } 2831 2832 @Override 2833 public Query getGeneratedKeys() { 2834 return null; 2835 } 2836 2837 @Override 2838 public SQL getSql() { 2839 return sql; 2840 } 2841 2842 @Override 2843 public String getTemplate() { 2844 return template; 2845 } 2846 2847 @Override 2848 public long getExecutionTime() { 2849 return exeTime; 2850 } 2851 2852 }