Le 08/09/2017 à 14:07, Albrecht Dreß a écrit :
Hi Albrecht,
I have a PostgreSQL data base and want to use LibreOffice Base as nice frontend for adding and
modifying data. The Postgres tables contain data arrays, like
CREATE TABLE contact (
[...]
email text[]
)
How are you connecting to your pg database ?
Via a JDBC driver or using the native postgres driver provided within
LibreOffice ?
Depending on which one you are using, support for a given data type, in
this case, an array, might be different (I don't know off-hand, I
haven't tested).
My problem: how can I create a form to fill in such arrays? A simple (multiline) text field will
try to insert its content as text, of course leading to a SQL error.
A simple solution would be using the Postgres function string_to_array() or
regexp_split_to_array() (or even a more sophisticated Stored Procedure) in the INSERT statement,
splitting the multiline text into array items. However, I didn't find a way to tweak the SQL
statement like this. If this even possible?
Using a macro that takes your form control text and inserts it into a
preparedStatement object, it would/should probably be possible. I doubt
that the Form GUI supports this kind of thing directly though (but I'm
far from being an expert with postgres data type support in LibreOffice).
As you mention, it might be more efficient to do this via a stored
procedure in the backend rather than fudging something in the frontend.
Or is there an other "standard" way for dealing with array data types?
Not without using macros, that I know of, but I would love to be proven
wrong.
Alex
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.