Skip to content

Commit

Permalink
Split indexed and named statement preparation
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasHafner committed Aug 14, 2024
1 parent 97b81a2 commit 9724e45
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/main/java/org/polypheny/jdbc/multimodel/PolyStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class PolyStatement {

public PolyStatement( PolyConnection polyConnection ) {
this.connection = polyConnection;
this.streamingIndex = new StreamingIndex(getPrismInterfaceClient());
this.streamingIndex = new StreamingIndex( getPrismInterfaceClient() );
}


Expand Down Expand Up @@ -134,23 +134,23 @@ public List<Long> execute( String namespaceName, String languageName, List<Strin
}


public void prepare( String namespaceName, String languageName, String statement ) throws PrismInterfaceServiceException {
public void prepareIndexed( String namespaceName, String languageName, String statement ) throws PrismInterfaceServiceException {
int timeout = connection.getTimeout();
if ( statement.contains( "?" ) ) {
PreparedStatementSignature signature = getPrismInterfaceClient().prepareIndexedStatement( namespaceName, languageName, statement, timeout );
statementId = signature.getStatementId();
streamingIndex.update( statementId );
isPrepared = true;
return;
}
if ( statement.contains( ":" ) ) {
org.polypheny.prism.PreparedStatementSignature signature = connection.getPrismInterfaceClient().prepareNamedStatement( namespaceName, languageName, statement, timeout );
statementId = signature.getStatementId();
streamingIndex.update( statementId );
isPrepared = true;
return;
}
throw new PrismInterfaceServiceException( PrismInterfaceErrors.VALUE_ILLEGAL, "Statement must be either of the indexed or named parameterized kind." );

PreparedStatementSignature signature = getPrismInterfaceClient().prepareIndexedStatement( namespaceName, languageName, statement, timeout );
statementId = signature.getStatementId();
streamingIndex.update( statementId );
isPrepared = true;
}


public void prepareNamed( String namespaceName, String languageName, String statement ) throws PrismInterfaceServiceException {
int timeout = connection.getTimeout();

org.polypheny.prism.PreparedStatementSignature signature = connection.getPrismInterfaceClient().prepareNamedStatement( namespaceName, languageName, statement, timeout );
statementId = signature.getStatementId();
streamingIndex.update( statementId );
isPrepared = true;
}


Expand Down

0 comments on commit 9724e45

Please sign in to comment.