fix: Updating the MS-SQL select query template to use TOP instead of LIMIT since LIMIT is not supported in the same. (#9082)
This commit is contained in:
parent
4e1e531a24
commit
94f312726b
|
|
@ -1 +1 @@
|
|||
SELECT * FROM users where role = {{ roleDropdown.selectedOptionValue }} ORDER BY id LIMIT 10;
|
||||
SELECT TOP 10 * FROM users where role = {{ roleDropdown.selectedOptionValue }} ORDER BY id;
|
||||
|
|
@ -590,4 +590,32 @@ public class MssqlPluginTest {
|
|||
})
|
||||
.verifyComplete();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLimitQuery() {
|
||||
DatasourceConfiguration dsConfig = createDatasourceConfiguration();
|
||||
|
||||
ActionConfiguration actionConfiguration = new ActionConfiguration();
|
||||
// First test with the binding not surrounded with quotes
|
||||
actionConfiguration.setBody("SELECT TOP 10 * FROM users ORDER BY id;");
|
||||
|
||||
List<Property> pluginSpecifiedTemplates = new ArrayList<>();
|
||||
pluginSpecifiedTemplates.add(new Property("preparedStatement", "true"));
|
||||
actionConfiguration.setPluginSpecifiedTemplates(pluginSpecifiedTemplates);
|
||||
|
||||
ExecuteActionDTO executeActionDTO = new ExecuteActionDTO();
|
||||
List<Param> params = new ArrayList<>();
|
||||
executeActionDTO.setParams(params);
|
||||
|
||||
Mono<Connection> connectionCreateMono = pluginExecutor.datasourceCreate(dsConfig).cache();
|
||||
|
||||
Mono<ActionExecutionResult> resultMono = connectionCreateMono
|
||||
.flatMap(pool -> pluginExecutor.executeParameterized(pool, executeActionDTO, dsConfig, actionConfiguration));
|
||||
|
||||
StepVerifier.create(resultMono)
|
||||
.assertNext(result -> {
|
||||
assertTrue(result.getIsExecutionSuccess());
|
||||
})
|
||||
.verifyComplete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user