Search in sources :

Example 1 with MongoTimestampRecord

use of com.torodb.backend.udt.record.MongoTimestampRecord in project torodb by torodb.

the class MongoTimestampRecordSqlBinding method get.

@Override
public MongoTimestampRecord get(ResultSet resultSet, int columnIndex) throws SQLException {
    PGobject pgObject = (PGobject) resultSet.getObject(columnIndex);
    if (pgObject == null) {
        return null;
    }
    String value = pgObject.getValue();
    int indexOfComma = value.indexOf(',');
    Integer secs = Integer.parseInt(value.substring(1, indexOfComma));
    Integer count = Integer.parseInt(value.substring(indexOfComma + 1, value.length() - 1));
    return new MongoTimestampRecord(secs, count);
}
Also used : MongoTimestampRecord(com.torodb.backend.udt.record.MongoTimestampRecord) PGobject(org.postgresql.util.PGobject)

Aggregations

MongoTimestampRecord (com.torodb.backend.udt.record.MongoTimestampRecord)1 PGobject (org.postgresql.util.PGobject)1