Search in sources :

Example 1 with PostgreArrayValueHandler

use of org.jkiss.dbeaver.ext.postgresql.model.data.PostgreArrayValueHandler in project dbeaver by serge-rider.

the class PostgreValueParserTest method convertArrayToString.

@Test
public void convertArrayToString() {
    PostgreArrayValueHandler arrayVH = new PostgreArrayValueHandler();
    String[] stringItems = new String[] { "one", "two", " four with spaces ", "f{i,v}e" };
    JDBCCollection array = new JDBCCollection(stringItemType, arrayVH, stringItems);
    JDBCCollection array3D = new JDBCCollection(stringItemType, arrayVH, new Object[] { array, array });
    String arrayString = arrayVH.getValueDisplayString(arrayStringItemType, array, DBDDisplayFormat.NATIVE);
    Assert.assertEquals("'{\"one\",\"two\",\" four with spaces \",\"f{i,v}e\"}'", arrayString);
    String arrayString3D = arrayVH.getValueDisplayString(arrayStringItemType, array3D, DBDDisplayFormat.NATIVE);
    Assert.assertEquals("'{{\"one\",\"two\",\" four with spaces \",\"f{i,v}e\"},{\"one\",\"two\",\" four with spaces \",\"f{i,v}e\"}}'", arrayString3D);
}
Also used : JDBCCollection(org.jkiss.dbeaver.model.impl.jdbc.data.JDBCCollection) PostgreArrayValueHandler(org.jkiss.dbeaver.ext.postgresql.model.data.PostgreArrayValueHandler) Test(org.junit.Test)

Aggregations

PostgreArrayValueHandler (org.jkiss.dbeaver.ext.postgresql.model.data.PostgreArrayValueHandler)1 JDBCCollection (org.jkiss.dbeaver.model.impl.jdbc.data.JDBCCollection)1 Test (org.junit.Test)1