There is a composite type in postgresql:
Create type CompLaLaLa AS ( Name character varying, Count numeric ); And the table:
CREATE TABLE "LaLaLa" ( "ID" serial NOT NULL, "Сomposition" CompLaLaLa[] NOT NULL, CONSTRAINT LaLaLa_pk PRIMARY KEY ("ID") ); I connected the database to OpenOffice and when sampling:
select "Сomposition" from "LaLaLa" Displays empty cells. If to_json ("Composition"), then just the type of Object displays. How to read this type in OpenOffice?
The request itself in the macro:
sub main Dim db as Object db = connect_to_database("postgre") SelectPrixod(db,30) disconnect_from_database(db) end sub Sub SelectPrixod(dbName as Object,ID as integer) Dim pSql as String Dim i as Integer Dim oRowSet as Object Dim oResult as String oSql = " SELECT ""Composition"" FROM ""LaLaLa"" Where ""ID""=ID; " oRowSet = createUnoService("com.sun.star.sdb.RowSet") oRowSet.activeConnection = dbName 'Активное подключение oRowSet.Command = oSql 'Запрос oRowSet.execute 'вызов запроса while oRowSet.Next 'бежим oResult = oResult & capitalize (oRowSet.getString(1)) & " " & chr(13) wend msgbox oResult End Sub Function capitalize (iName as String) as String Dim wordStart as String Dim wordEnd as String wordStart = UCase (Mid (iName, 1, 1)) wordEnd = LCase (Mid (iName, 2)) capitalize = wordStart & wordEnd End Function Function connect_to_database (dbName as String) as Object Dim dbContext As Object Dim oDataSource As Object dbContext = createUnoService("com.sun.star.sdb.DatabaseContext") oDataSource = dbContext.getByName(dbName) connect_to_database = oDataSource.GetConnection("admin", "Oma") 'подключение к ДБ End Function Sub disconnect_from_database (db as Object) db.close db.dispose() End Sub Displays emptiness