Search in sources :

Example 6 with SqlServiceImpl

use of com.hazelcast.sql.impl.SqlServiceImpl in project hazelcast by hazelcast.

the class SqlExecuteMessageTask method encodeResponse.

@Override
protected ClientMessage encodeResponse(Object response) {
    AbstractSqlResult result = (AbstractSqlResult) response;
    if (result.updateCount() >= 0) {
        return SqlExecuteCodec.encodeResponse(null, null, result.updateCount(), null);
    } else {
        SqlServiceImpl sqlService = nodeEngine.getSqlService();
        SqlPage page = sqlService.getInternalService().getClientStateRegistry().registerAndFetch(endpoint.getUuid(), result, parameters.cursorBufferSize, serializationService);
        return SqlExecuteCodec.encodeResponse(result.getRowMetadata().getColumns(), page, -1, null);
    }
}
Also used : SqlServiceImpl(com.hazelcast.sql.impl.SqlServiceImpl) AbstractSqlResult(com.hazelcast.sql.impl.AbstractSqlResult)

Example 7 with SqlServiceImpl

use of com.hazelcast.sql.impl.SqlServiceImpl in project hazelcast by hazelcast.

the class PhoneHomeTest method testSqlQueriesSubmitted.

@Test
public void testSqlQueriesSubmitted() {
    Map<String, String> parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.SQL_QUERIES_SUBMITTED.getRequestParameterName()), "0");
    SqlServiceImpl sqlService = node.getNodeEngine().getSqlService();
    try {
        sqlService.execute("SELECT * FROM map");
    } catch (Exception e) {
        ignore(e);
    }
    parameters = phoneHome.phoneHome(true);
    assertEquals(parameters.get(PhoneHomeMetrics.SQL_QUERIES_SUBMITTED.getRequestParameterName()), "1");
}
Also used : SqlServiceImpl(com.hazelcast.sql.impl.SqlServiceImpl) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

SqlServiceImpl (com.hazelcast.sql.impl.SqlServiceImpl)7 SqlStatement (com.hazelcast.sql.SqlStatement)3 Test (org.junit.Test)2 Data (com.hazelcast.internal.serialization.Data)1 MapPermission (com.hazelcast.security.permission.MapPermission)1 SqlResult (com.hazelcast.sql.SqlResult)1 SqlRow (com.hazelcast.sql.SqlRow)1 AbstractSqlResult (com.hazelcast.sql.impl.AbstractSqlResult)1 SqlInternalService (com.hazelcast.sql.impl.SqlInternalService)1 SqlOptimizer (com.hazelcast.sql.impl.optimizer.SqlOptimizer)1 NoOpSqlSecurityContext (com.hazelcast.sql.impl.security.NoOpSqlSecurityContext)1 SqlSecurityContext (com.hazelcast.sql.impl.security.SqlSecurityContext)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 ArrayList (java.util.ArrayList)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 Collectors.toList (java.util.stream.Collectors.toList)1