Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@

package com.badlogic.gdx.sqlite.desktop;

import javax.sql.rowset.CachedRowSet;
import javax.sql.rowset.RowSetFactory;
import javax.sql.rowset.RowSetProvider;
import java.sql.Blob;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.sun.rowset.CachedRowSetImpl;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.sqlite.DatabaseCursor;
Expand All @@ -16,11 +18,21 @@
* @author M Rafay Aleem */
public class DesktopCursor implements DatabaseCursor {

private static final RowSetFactory provider;

static {
try {
provider = RowSetProvider.newFactory();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}

/**
* Reference of {@code CachedRowSetImpl} Class Type created for both forward, backward, and random traversing the records, as for ResultSet Class Type
* Reference of {@code CachedRowSet} Class Type created for both forward, backward, and random traversing the records, as for ResultSet Class Type
* sqlite does not support other than forward traversing
*/
private CachedRowSetImpl resultSet = null;
private CachedRowSet resultSet = null;

@Override
public byte[] getBlob (int columnIndex) {
Expand Down Expand Up @@ -165,7 +177,7 @@ private int getRowCount (ResultSet resultSet) {

public void setNativeCursor (ResultSet resultSetRef) {
try {
resultSet = new CachedRowSetImpl();
resultSet = provider.createCachedRowSet();
resultSet.populate (resultSetRef);
} catch (SQLException e) {
// TODO Auto-generated catch block
Expand Down