Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2022-06

no array support in sqldb/sqldbrestbridge?

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

llo,

since I'm going to need arrays in a postgresql database to expose via a rest api, I did a simple test with sqldbrestbridge.

I created a simple table:

create table prueba (x integer not null, y integer[]);
insert into prueba values (1, '{2,3}');

then I exposed it with sqlrestdb:

FDisp:=TSQLDBRestDispatcher.Create(Self)
FDisp.ExposeDatabase('postgresql','host','database','user','password');
FDisp.Active:=true;

and when I browse the database I only see the x field:

{
"metaData" : {
"fields" : [
{
"name" : "x",
"type" : "int"
}
]
},
"data" : [
{
"x" : 1
}
]
}

So, is there no array field support in sqldb and/or in sqldbrestbridge?

I dropped a TSQLQuery on a form and I could define both fields, but "y" was just a plain TField (i.e. it was not mapped to an array field, in fact I could not find definitions of array fields in DB.pas, apart from the ftArray constant in TFieldType).

Bye

Luca

Reply by email

Luca Olivetti
to LacaK

El 7/6/22 a les 14:15, LacaK via fpc-pascal ha escrit:

Show quoted text 11 lines
Hi, > So, is there no array field support in sqldb and/or in sqldbrestbridge? > there was added into DB.pas : TObjectField and TArrayField https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fcl-db/src/base/db.pas but implementation is incomplete. Methods in fields.inc are empty. Also in TSQLConnection descendants (like TPQConnection) there is no support.

Oh, well, in the meantime I discovered postgREST so that's not an issue anymore.

Bye

Luca

Reply by email