Accessing PostgresSQL time interval data

조회 수: 3 (최근 30일)
Bryan
Bryan 2013년 7월 31일
When I fetch a table that contains a column of time intervals using the database toolbox I get a cursor object and can view and manipulate most of the data using commands like those below.
a = fetch(curs);
plot(cell2mat(a.Data(:,45)))
But, the time intervals are in an object class "org.postgresql.util.PGInterval"
x = a.Data(1,12);
>> class(x{1,1})
ans =
org.postgresql.util.PGInterval
>> a.Data{1,12}
ans =
0 years 0 mons 1 days 13 hours 18 mins 53.00 secs
How to I access and work with the data in these?

답변 (1개)

the cyclist
the cyclist 2013년 7월 31일
편집: the cyclist 2013년 7월 31일
The closest equivalent I have done is getting an object of type
org.postgresql.jdbc4.Jdbc4Array
For that, I was able to extract using
data{1}.getArray
I think the general idea is that you have a class that you need to apply the appropriate Java method to. For me, that was "getArray", but for you it is presumably different.
This page looks like it has methods that you may be able to implement: http://jdbc.postgresql.org/development/privateapi/org/postgresql/util/PGInterval.html
Maybe that will aim you in the right direction.

카테고리

Help CenterFile Exchange에서 Database Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by