Skip to content
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: polypheny-jar
path: dbms/build/libs/dbms-0.10.0-SNAPSHOT.jar
path: dbms/build/libs/dbms-0.10.1-SNAPSHOT.jar

build:
needs: build-polypheny
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
uses: polypheny/GitHub-Action-Run-Polypheny@dev
with:
cmd: ./gradlew build -PdisableToolchain=true
jar: dbms-0.10.0-SNAPSHOT.jar
jar: dbms-0.10.1-SNAPSHOT.jar
java: ${{ env.JAVA_HOME_17_X64 || env.JAVA_HOME_17_ARM64 }}/bin/java

build-windows:
Expand Down Expand Up @@ -91,15 +91,15 @@ jobs:
uses: polypheny/GitHub-Action-Run-Polypheny@v0.2.0
with:
cmd: gradlew.bat build -PdisableToolchain=true
jar: dbms-0.10.0-SNAPSHOT.jar
jar: dbms-0.10.1-SNAPSHOT.jar
java: ${{ env.JAVA_HOME_17_X64 }}\bin\java

test-stores:
needs: build-polypheny
strategy:
fail-fast: false
matrix:
adapter: [ mongodb, hsqldb, monetdb, postgresql, file, cottontail, neo4j ]
adapter: [ mongodb, hsqldb, monetdb, postgresql, file, neo4j ]
timeout-minutes: 10
runs-on: ubuntu-latest
name: Test on ${{ matrix.adapter }}
Expand All @@ -118,5 +118,5 @@ jobs:
uses: polypheny/GitHub-Action-Run-Polypheny@v0.2.0
with:
cmd: ./gradlew build -PdisableToolchain=true
jar: dbms-0.10.0-SNAPSHOT.jar
jar: dbms-0.10.1-SNAPSHOT.jar
default-store: ${{ matrix.adapter }}
12 changes: 9 additions & 3 deletions src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@

public class PolyStatement {

private static final long SCALAR_NOT_SET = -1;
private static final int NO_STATEMENT_ID = -1;

@Getter
private PolyConnection connection;
private final PolyConnection connection;
@Getter
private int statementId;


private void resetStatement() {
statementId = NO_STATEMENT_ID;
if ( statementId != NO_STATEMENT_ID ) {
try {
getPrismInterfaceClient().closeStatement( statementId, 0 );
} catch ( PrismInterfaceServiceException e ) {
// Ignore cleanup errors
}
statementId = NO_STATEMENT_ID;
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void fetchMore() throws PrismInterfaceServiceException {
int id = polyStatement.getStatementId();
int timeout = getPolyphenyConnection().getTimeout();
Frame frame = getPrismInterfaceClient().fetchResult( id, timeout, PropertyUtils.getDEFAULT_FETCH_SIZE() );
if ( frame.getResultCase() != ResultCase.DOCUMENT_FRAME ) {
if ( frame.getResultCase() != ResultCase.RELATIONAL_FRAME ) {
throw new PrismInterfaceServiceException(
PrismInterfaceErrors.RESULT_TYPE_INVALID,
"Statement returned a result of illegal type " + frame.getResultCase()
Expand Down Expand Up @@ -105,7 +105,7 @@ public boolean hasNext() {
@Override
public PolyRow next() {
if ( !hasNext() ) {
throw new NoSuchElementException( "There are no more documents" );
throw new NoSuchElementException( "There are no more rows" );
}
return rows.get( ++index );
}
Expand Down
25 changes: 25 additions & 0 deletions src/test/java/org/polypheny/jdbc/QueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.polypheny.jdbc.multimodel.DocumentResult;
import org.polypheny.jdbc.multimodel.PolyRow;
import org.polypheny.jdbc.multimodel.PolyStatement;
import org.polypheny.jdbc.multimodel.RelationalResult;
import org.polypheny.jdbc.multimodel.Result;
import org.polypheny.jdbc.multimodel.Result.ResultType;
import org.polypheny.jdbc.types.PolyDocument;
Expand Down Expand Up @@ -73,6 +75,29 @@ public void simpleRelationalTest() {
}


@Test
public void largeRelationalTest() {
try ( Connection connection = TestHelper.getConnection() ) {
if ( !connection.isWrapperFor( PolyConnection.class ) ) {
fail( "Driver must support unwrapping to PolyphenyConnection" );
}
PolyStatement polyStatement = connection.unwrap( PolyConnection.class ).createPolyStatement();
polyStatement.execute( "public", "sql", "DROP TABLE IF EXISTS ids" );
polyStatement.execute( "public", "sql", "CREATE TABLE ids(id INTEGER PRIMARY KEY)" );
for ( int i = 0; i < 1000; i++ ) {
polyStatement.execute( "public", "sql", "INSERT INTO ids(id) VALUES(" + i + ")" );
}
Result result = polyStatement.execute( "public", "sql", "SELECT * FROM ids" );
assertEquals( ResultType.RELATIONAL, result.getResultType() );
RelationalResult r = result.unwrap( RelationalResult.class );
for ( PolyRow polyRow : r ) {
}
} catch ( SQLException e ) {
throw new RuntimeException( e );
}
}


@Test
public void simpleMqlTest() {
try ( Connection connection = TestHelper.getConnection() ) {
Expand Down