public List < SQLResultSet > executeNativeSQLSynchronized ( NativeSQLQuery nativeSQLQueryParam ) { if ( nativeSQLQueryParam == null ) { return null ; } if ( nativeSQLQueryParam . getDatasourceName ( ) == null || nativeSQLQueryParam . getDatasourceName ( ) . isEmpty ( ) ) { throw new FluidClientException ( "No data-source name provided. Not allowed." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } //No query to execute... if ( ( nativeSQLQueryParam . getQuery ( ) == null || nativeSQLQueryParam . getQuery ( ) . isEmpty ( ) ) && ( nativeSQLQueryParam . getStoredProcedure ( ) == null || nativeSQLQueryParam . getStoredProcedure ( ) . isEmpty ( ) ) ) { return null ; } //Validate the echo... this . setEchoIfNotSet ( nativeSQLQueryParam ) ; //Start a new request... String uniqueReqId = this . initNewRequest ( ) ; //Send the actual message... this . sendMessage ( nativeSQLQueryParam , uniqueReqId ) ; try { List < SQLResultSet > returnValue = this . getHandler ( uniqueReqId ) . getCF ( ) . get ( this . getTimeoutInMillis ( ) , TimeUnit . MILLISECONDS ) ; //Connection was closed.. this is a problem.... if ( this . getHandler ( uniqueReqId ) . isConnectionClosed ( ) ) { throw new FluidClientException ( "SQLUtil-WebSocket-ExecuteNativeSQL: " + "The connection was closed by the server prior to the response received." , FluidClientException . ErrorCode . IO_ERROR ) ; } return returnValue ; } //Interrupted... catch ( InterruptedException exceptParam ) { throw new FluidClientException ( "SQLUtil-WebSocket-ExecuteNativeSQL: " + exceptParam . getMessage ( ) , exceptParam , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } //Error on the web-socket... catch ( ExecutionException executeProblem ) { Throwable cause = executeProblem . getCause ( ) ; //Fluid client exception... if ( cause instanceof FluidClientException ) { throw ( FluidClientException ) cause ; } else { throw new FluidClientException ( "SQLUtil-WebSocket-ExecuteNativeSQL: " + cause . getMessage ( ) , cause , FluidClientException . ErrorCode . STATEMENT_EXECUTION_ERROR ) ; } } //Timeout... catch ( TimeoutException eParam ) { throw new FluidClientException ( "SQLUtil-WebSocket-ExecuteNativeSQL: Timeout while waiting for all return data. There were '" + this . getHandler ( uniqueReqId ) . getReturnValue ( ) . size ( ) + "' items after a Timeout of " + ( TimeUnit . MILLISECONDS . toSeconds ( this . getTimeoutInMillis ( ) ) ) + " seconds." , FluidClientException . ErrorCode . IO_ERROR ) ; } finally { this . removeHandler ( uniqueReqId ) ; } }
Executes a native SQL query on the remote Fluid instance .