|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Arrays support for object viewsHello,
Thanks for the nice project. I encountered some traces of efforts to use arrays from within pljava but could not find a working example. I'm trying to create a function that would return a setof complex objects where some fields of the object are plain old dataype arrays. i.e.: CREATE TYPE tsTest2 AS ( id bigint , tsType integer , residuals boolean , length integer, obs float8[] ) ; then I create a mapping function: CREATE or replace FUNCTION tt2(integer ,float8 , float8 , float8 ) RETURNS SETOF tstest2 AS 'gaia.cu7.omimpl.TimeSeriesImplSQL.timeseriesReturn' IMMUTABLE LANGUAGE javaU; then, whatever I try to do in a java code for assignRowValues fails: i.e.: receiver.updateString(6, "{1.0,2.0,3.0}"); would result in: -- Executing query: select tt2(0,0.0,0.0,0.0); ERROR: java.sql.SQLException: Cannot derive a value of class [Ljava.lang.Double; from an object of class java.lang.String you do have updateArray but could not spot any usage example with it. Please help, otherwise we will have to drop pljava from the project which has a chance to impact astronomy community thus leverage pljava. Best regards, Krzysztof _______________________________________________ Pljava-dev mailing list Pljava-dev@... http://pgfoundry.org/mailman/listinfo/pljava-dev |
|
|
Re: Arrays support for object viewsHello,
By using simply: receiver.updateObject(5, new Double[]{1.0,2.0,3.0}); I finally don't get any errors but the values are not related to the array set and always stay the same. Seems they are not initialized properly even. --wrapper with dummy parameters select * from tt2(0,0.0,0.0,0.0); gives: 1000;1;f;10;"{-1.06280184473225e-250,2.47032822920623e-323,0}";"";"" 1000;1;f;10;"{-1.06291373259335e-250,2.47032822920623e-323,0}";"";"" 1000;1;f;10;"{-1.06302562045446e-250,2.47032822920623e-323,0}";"";"" 1000;1;f;10;"{-1.06313750831557e-250,2.47032822920623e-323,0}";"";"" 1000;1;f;10;"{-1.06324939617667e-250,2.47032822920623e-323,0}";"";"" The good thing is the size of an array is reflected properly, so if I change the size of an array in java it gets reflected on sql side. Also, if arrays passed are constant - i.e. values of Integer arrays are still wrong but stay the same between the calls. I implemented java.sql.Array but got similaar exception: STATEMENT: select vals,vali from tt3(1,10000.0,0.0,0.0); java.sql.SQLException: Cannot derive a value of class [Ljava.lang.Double; from an object of class mySqlArrayImpl at org.postgresql.pljava.jdbc.SPIConnection.basicCoersion(SPIConnection.java:718) at org.postgresql.pljava.jdbc.SingleRowWriter.updateObject(SingleRowWriter.java:82) at org.postgresql.pljava.jdbc.ObjectResultSet.updateArray(ObjectResultSet.java:264) at gaia.cu7.omimpl.TimeSeriesImplSQL.assignRowValues(TimeSeriesImplSQL.java:329) ERROR: java.sql.SQLException: Cannot derive a value of class [Ljava.lang.Double; from an object of class mySqlArrayImpl Could you please comment?
2008/9/23 Krzysztof Nienartowicz <yazuna@...>
_______________________________________________ Pljava-dev mailing list Pljava-dev@... http://pgfoundry.org/mailman/listinfo/pljava-dev |
|
|
Re: Arrays support for object viewsOn Fri, 26 Sep 2008, Krzysztof Nienartowicz wrote: > > By using simply: > receiver.updateObject(5, new Double[]{1.0,2.0,3.0}); > I finally don't get any errors but the values are not related to the array > set and always stay the same. Seems they are not initialized properly even. When I test the same here, I get a crash. Pljava is trying to read the Double[] as if it was a double[] and that's blowing up. If I change the array to Datum conversion code to expect Double[] it works, but naturally other places that are now passing double[] blow up. Pljava has some smarts about how double and Double are interchangeable, but I'm guessing that hasn't propagated all the way through the array code. I don't really understand how the whole type system is supposed to work, so it's difficult to figure out how to fix this. Kris Jurka _______________________________________________ Pljava-dev mailing list Pljava-dev@... http://pgfoundry.org/mailman/listinfo/pljava-dev |
| Free embeddable forum powered by Nabble | Forum Help |