1 2 12 package com.versant.core.jdbc.ejbql; 13 14 import com.versant.core.jdbc.JdbcQueryResult; 15 import com.versant.core.jdbc.JdbcStorageManager; 16 import com.versant.core.jdbc.fetch.FetchResult; 17 import com.versant.core.jdbc.fetch.FetchSpec; 18 import com.versant.core.jdbc.query.JdbcCompiledQuery; 19 import com.versant.core.jdo.QueryDetails; 20 import com.versant.core.common.BindingSupportImpl; 21 import com.versant.core.common.OID; 22 import com.versant.core.common.State; 23 import com.versant.core.server.StateContainer; 24 25 30 public class JdbcQueryResultEJBQL extends JdbcQueryResult { 31 32 private FetchResult res; 33 private Object [] row; 34 35 public JdbcQueryResultEJBQL(JdbcStorageManager sm, JdbcCompiledQuery cq, 36 Object [] params, boolean cachable) { 37 super(sm, cq, params, cachable); 38 } 39 40 public boolean isEJBQLHack() { 41 return true; 42 } 43 44 public FetchSpec getFetchSpec() { 45 return ((JdbcCompiledQueryEJBQL)cq).getFetchSpec(); 46 } 47 48 public void executePrepareHack(Object [] params) { 49 FetchSpec spec = getFetchSpec(); 50 QueryDetails q = getQueryDetails(); 51 res = spec.createFetchResult(sm, sm.con(), params, false, 52 false, -1, -1, q.getResultBatchSize(), q.isRandomAccess()); 53 ps = res.getPreparedStatement(); 54 } 55 56 public void executeActualHack() { 57 res.execute(); 58 } 59 60 public boolean next(int skip) { 61 if (skip > 0) { 62 BindingSupportImpl.getInstance().internal("skip > 0 not supported: " + 63 skip); 64 } 65 return res.hasNext(); 66 } 67 68 public OID getResultOID() { 69 row = (Object [])res.next(); 70 return (OID)row[0]; 71 } 72 73 public State getResultState(boolean forUpdate, StateContainer container) { 74 return (State)row[1]; 75 } 76 77 public void cancel() { 78 res.cancel(); 79 } 80 81 public boolean isClosed() { 82 return res.isClosed(); 83 } 84 85 public void closeImp() { 86 res.close(); 87 } 88 } 89 90 | Popular Tags |