protected AvaticaResultSet execute2(Cursor cursor, List<ColumnMetaData> columnMetaDataList) { this.cursor = cursor; this.accessorList = cursor.createAccessors(columnMetaDataList, localCalendar, this); this.row = -1; this.afterLast = false; return this; }
public boolean next() throws SQLException { // TODO: for timeout, see IteratorResultSet.next if (isClosed()) { throw new SQLException("next() called on closed cursor"); } if (cursor.next()) { ++row; return true; } else { afterLast = true; return false; } }
public void close() { closed = true; final Cursor cursor = this.cursor; if (cursor != null) { this.cursor = null; cursor.close(); } statement.onResultSetClose(this); }
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(arrayMetaData), Unsafe.localCalendar(), factory); assertEquals(1, accessors.size()); Accessor accessor = accessors.get(0); assertTrue(cursor.next()); Array actualArray = accessor.getArray(); assertFalse(actualArrayResultSet.next()); assertTrue(cursor.next()); actualArray = accessor.getArray(); actualArrayResultSet = actualArray.getResultSet(); assertFalse(actualArrayResultSet.next()); assertTrue(cursor.next()); actualArray = accessor.getArray(); actualArrayResultSet = actualArray.getResultSet(); assertFalse(actualArrayResultSet.next()); assertFalse(cursor.next());
public boolean wasNull() throws SQLException { return cursor.wasNull(); }
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(arrayMetaData), Unsafe.localCalendar(), factory); assertEquals(1, accessors.size()); Accessor accessor = accessors.get(0); assertTrue(cursor.next()); Array actualArray = accessor.getArray(); assertFalse(actualArrayResultSet.next()); assertTrue(cursor.next()); actualArray = accessor.getArray(); actualArrayResultSet = actualArray.getResultSet(); assertFalse(actualArrayResultSet.next()); assertTrue(cursor.next()); actualArray = accessor.getArray(); actualArrayResultSet = actualArray.getResultSet(); assertFalse(actualArrayResultSet.next()); assertFalse(cursor.next());
public boolean wasNull() throws SQLException { checkOpen(); return cursor.wasNull(); }
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(structMetaData), Unsafe.localCalendar(), null); assertEquals(1, accessors.size()); Accessor accessor = accessors.get(0); assertTrue(cursor.next()); Struct s = accessor.getObject(Struct.class); Object[] structData = s.getAttributes(); assertEquals("one", structData[1]); assertTrue(cursor.next()); s = accessor.getObject(Struct.class); structData = s.getAttributes(); assertEquals("two", structData[1]); assertTrue(cursor.next()); s = accessor.getObject(Struct.class); structData = s.getAttributes(); assertEquals(3, structData[0]); assertTrue(cursor.next()); s = accessor.getObject(Struct.class); structData = s.getAttributes();
public AvaticaResultSet execute2(Cursor cursor, List<ColumnMetaData> columnMetaDataList) { this.cursor = cursor; this.accessorList = cursor.createAccessors(columnMetaDataList, localCalendar, this); this.row = 0; this.beforeFirst = true; this.afterLast = false; return this; }
public boolean next() throws SQLException { // TODO: for timeout, see IteratorResultSet.next checkOpen(); if (null != statement && statement.cancelFlag.get()) { throw AvaticaConnection.HELPER.createException("Statement canceled"); } if (cursor.next()) { ++row; beforeFirst = false; return true; } else { row = 0; afterLast = true; return false; } }
public boolean wasNull() throws SQLException { checkOpen(); return cursor.wasNull(); }
public void close() { closed = true; final Cursor cursor = this.cursor; if (cursor != null) { this.cursor = null; cursor.close(); } statement.onResultSetClose(this); }
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(structMetaData), Unsafe.localCalendar(), null); assertEquals(1, accessors.size()); Accessor accessor = accessors.get(0); assertTrue(cursor.next()); Struct s = accessor.getObject(Struct.class); Object[] structData = s.getAttributes(); assertEquals("one", structData[1]); assertTrue(cursor.next()); s = accessor.getObject(Struct.class); structData = s.getAttributes(); assertEquals("two", structData[1]); assertTrue(cursor.next()); s = accessor.getObject(Struct.class); structData = s.getAttributes(); assertEquals(3, structData[0]); assertTrue(cursor.next()); s = accessor.getObject(Struct.class); structData = s.getAttributes();
public AvaticaResultSet execute2(Cursor cursor, List<ColumnMetaData> columnMetaDataList) { this.cursor = cursor; this.accessorList = cursor.createAccessors(columnMetaDataList, localCalendar, this); this.row = 0; this.beforeFirst = true; this.afterLast = false; return this; }
public boolean next() throws SQLException { // TODO: for timeout, see IteratorResultSet.next checkOpen(); if (null != statement && statement.cancelFlag.get()) { throw AvaticaConnection.HELPER.createException("Statement canceled"); } if (cursor.next()) { ++row; beforeFirst = false; return true; } else { row = 0; afterLast = true; return false; } }
public void close() { closed = true; final Cursor cursor = this.cursor; if (cursor != null) { this.cursor = null; cursor.close(); } statement.onResultSetClose(this); // TODO: for timeout, see IteratorResultSet.close /* if (timeoutCursor != null) { final long noTimeout = 0; timeoutCursor.close(noTimeout); timeoutCursor = null; } */ }
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(arrayMetaData), Unsafe.localCalendar(), factory); assertEquals(1, accessors.size()); Accessor accessor = accessors.get(0); assertTrue(cursor.next()); Array actualArray = accessor.getArray(); assertEquals("two", o[1]); assertTrue(cursor.next()); actualArray = accessor.getArray(); arrayData = (Object[]) actualArray.getArray();
/** * Executes this result set. (Not a JDBC method.) * * <p>Note that execute cannot occur in the constructor, because the * constructor occurs while the statement is locked, to make sure that * execute/cancel don't happen at the same time.</p> * * @see org.apache.calcite.avatica.AvaticaConnection.Trojan#execute(AvaticaResultSet) * * @throws SQLException if execute fails for some reason. */ protected AvaticaResultSet execute() throws SQLException { final Iterable<Object> iterable1 = statement.connection.meta.createIterable(statement.handle, state, signature, Collections.<TypedValue>emptyList(), firstFrame); this.cursor = MetaImpl.createCursor(signature.cursorFactory, iterable1); this.accessorList = cursor.createAccessors(columnMetaDataList, localCalendar, this); this.row = 0; this.beforeFirst = true; this.afterLast = false; return this; }
List<Accessor> accessors = cursor.createAccessors(Collections.singletonList(arrayMetaData), Unsafe.localCalendar(), factory); assertEquals(1, accessors.size()); Accessor accessor = accessors.get(0); assertTrue(cursor.next()); Array actualArray = accessor.getArray(); assertEquals("two", o[1]); assertTrue(cursor.next()); actualArray = accessor.getArray(); arrayData = (Object[]) actualArray.getArray();
/** * Executes this result set. (Not a JDBC method.) * * <p>Note that execute cannot occur in the constructor, because the * constructor occurs while the statement is locked, to make sure that * execute/cancel don't happen at the same time.</p> * * @see org.apache.calcite.avatica.AvaticaConnection.Trojan#execute(AvaticaResultSet) * * @throws SQLException if execute fails for some reason. */ protected AvaticaResultSet execute() throws SQLException { final Iterable<Object> iterable1 = statement.connection.meta.createIterable(statement.handle, state, signature, Collections.<TypedValue>emptyList(), firstFrame); this.cursor = MetaImpl.createCursor(signature.cursorFactory, iterable1); this.accessorList = cursor.createAccessors(columnMetaDataList, localCalendar, this); this.row = 0; this.beforeFirst = true; this.afterLast = false; return this; }