Accessing PostgresSQL time interval data

7 visualizaciones (últimos 30 días)
Bryan
Bryan el 31 de Jul. de 2013
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?

Respuestas (1)

the cyclist
the cyclist el 31 de Jul. de 2013
Editada: the cyclist el 31 de Jul. de 2013
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.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by