public Array toSqlArray ( final Connection connection, final Event event ) throws SQLException
{
final DateFormat isoDateFormat = new SimpleDateFormat ( isoDatePatterrn );
final String[] fields;
// array must be large enough to hold all attributes plus id and both time stamps
fields = new String[ ( event.getAttributes ().size () + 3 ) * 2];
// now populate values
fields[0] = "id";
fields[1] = event.getId ().toString ();
fields[2] = "sourceTimestamp";
fields[3] = isoDateFormat.format ( event.getSourceTimestamp () );
fields[4] = "entryTimestamp";
fields[5] = isoDateFormat.format ( event.getEntryTimestamp () );
int i = 6;
for ( final Entry<String, Variant> entry : event.getAttributes ().entrySet () )
{
fields[i] = entry.getKey ();
fields[i + 1] = entry.getValue ().toString ();
i += 2;
}
return connection.createArrayOf ( "text", fields );
}
EventConverter.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:neoscada
作者:
评论列表
文章目录