use of io.questdb.cairo.sql.InsertMethod in project questdb by bluestreak01.
the class ImportIODispatcherTest method testImportMisDetectsTimestampColumn.
private void testImportMisDetectsTimestampColumn(HttpServerConfigurationBuilder serverConfigBuilder, int rowCount) throws Exception {
new HttpQueryTestBuilder().withTempFolder(temp).withWorkerCount(1).withHttpServerConfigBuilder(serverConfigBuilder).withTelemetry(false).run((engine) -> {
setupSql(engine);
compiler.compile("create table trips(" + "timestamp TIMESTAMP," + "str STRING," + "i STRING" + ") timestamp(timestamp)", sqlExecutionContext);
String request = PostHeader.replace("name=trips", "name=trips&skipLev=true") + Request1DataHeader + generateImportCsv(0, rowCount, "aaaaaaaaaaaaaaaaa,22222222222222222222,33333333333333333") + Request1SchemaPart;
new SendAndReceiveRequestBuilder().withExpectSendDisconnect(true).execute(request, "HTTP/1.1 200 OK\r\n" + "Server: questDB/1.0\r\n" + "Date: Thu, 1 Jan 1970 00:00:00 GMT\r\n" + "Transfer-Encoding: chunked\r\n" + "Content-Type: text/plain; charset=utf-8\r\n" + "\r\n" + "12\r\n" + "not a timestamp ''\r\n" + "00\r\n" + "\r\n");
CompiledQuery compiledQuery = compiler.compile("insert into trips values (" + "'2021-07-20T00:01:00', 'ABC', 'DEF'" + ")", sqlExecutionContext);
final InsertStatement insertStatement = compiledQuery.getInsertStatement();
try (InsertMethod insertMethod = insertStatement.createMethod(sqlExecutionContext)) {
insertMethod.execute();
insertMethod.commit();
}
compiler.close();
});
}
Aggregations