Search in sources :

Example 6 with H2SqlEntity

use of org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity in project incubator-skywalking by apache.

the class AbstractPersistenceH2DAO method prepareBatchInsert.

@Override
public final H2SqlEntity prepareBatchInsert(STREAM_DATA streamData) {
    Map<String, Object> source = streamDataToH2Data(streamData);
    source.put(CommonTable.COLUMN_ID, streamData.getId());
    H2SqlEntity entity = new H2SqlEntity();
    String sql = SqlBuilder.buildBatchInsertSql(tableName(), source.keySet());
    entity.setSql(sql);
    entity.setParams(source.values().toArray(new Object[0]));
    return entity;
}
Also used : H2SqlEntity(org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity)

Example 7 with H2SqlEntity

use of org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity in project incubator-skywalking by apache.

the class AbstractPersistenceH2DAO method prepareBatchUpdate.

@Override
public final H2SqlEntity prepareBatchUpdate(STREAM_DATA streamData) {
    Map<String, Object> source = streamDataToH2Data(streamData);
    H2SqlEntity entity = new H2SqlEntity();
    String sql = SqlBuilder.buildBatchUpdateSql(tableName(), source.keySet(), CommonTable.COLUMN_ID);
    entity.setSql(sql);
    List<Object> values = new ArrayList<>(source.values());
    values.add(streamData.getId());
    entity.setParams(values.toArray(new Object[0]));
    return entity;
}
Also used : H2SqlEntity(org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity) ArrayList(java.util.ArrayList)

Aggregations

H2SqlEntity (org.apache.skywalking.apm.collector.storage.h2.base.define.H2SqlEntity)7 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)2 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 SQLException (java.sql.SQLException)1 H2ClientException (org.apache.skywalking.apm.collector.client.h2.H2ClientException)1