WriteValue Function replacement

32 views
Skip to first unread message

Ronit

unread,
Jul 11, 2022, 2:39:28 PMJul 11
to H2 Database
Hello ,

I am trying to migrate my code from H2 1.3.176(Older version)  from  H2 2.1.214(Latest version). In the Older version in org.h2.store.Data.java class there used to be a 
void writeValue(Value v) {
function which does not exist in the latest version.
I wanted to know if there is a replacement for that function in the latest version ?

Thanks

Evgenij Ryazanov

unread,
Jul 12, 2022, 1:56:33 AMJul 12
to H2 Database
Hello.

No, there are no direct replacements. You cannot rely on internals of H2, they aren't expected to be used by applications.

This method was used internally by removed PageStore backend. MVStore backend uses ValueDataType instead (and it also isn't a part of API). ValueDataType uses different encoding, so it cannot read or write values in format used by PageStore.

Ronit

unread,
Jul 12, 2022, 2:05:50 AMJul 12
to H2 Database
Appreciate your response ,

The thing is my code used to use Data.java  by extending it. I used the WriteValue and putting the customized values into the database.
So I am still looking the way to replicate it in this new library .

So is there a way to replicate it ?

Thanks.

Evgenij Ryazanov

unread,
Jul 12, 2022, 2:35:10 AMJul 12
to H2 Database
New versions of H2 don't have custom data types, they had significant design flaws, security problems, missing basic functionality, and it wasn't possible to maintain any stable API for them.

New versions of H2 support standard ROW value data type and standard ARRAY data type. It is possible to define complex data types with them:
CREATE DOMAIN MY_TYPE AS ROW(NAME CHARACTER VARYING(100), POINTS ROW(X INTEGER, Y INTEGER) ARRAY[1000]);
You can also use the non-standard JSON data type.
Reply all
Reply to author
Forward
0 new messages