https://bugs.documentfoundation.org/show_bug.cgi?id=83737
Lionel Elie Mamane <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |NOTABUG
--- Comment #6 from Lionel Elie Mamane <[email protected]> ---
There is no SQL command that LibreOffice can issue to the database that does
what you want in a sane way.
The sane version of what you want is "please insert a row with all values being
the default". So we have to give a SQL INSERT command without giving any value.
This is not allowed by SQL:
# INSERT INTO "Table1" ( ) VALUES ( );
ERROR: syntax error at or near ")"
LINE 1: INSERT INTO "Table1" ( ) VALUES ( );
^
1: Unexpected token: ) in statement [INSERT INTO "Table1" ()]
So yes, you need to provide a value, even an explicit NULL or empty string or
whatever. Which would translate to:
# INSERT INTO "Table1" ( "text" ) VALUES ( NULL );
INSERT 0 1
2: Command successfully executed.
Now, I admit that just setting an explicit NULL won't work in LibreOffice, you
need to set a string and then set NULL again. Yes, this is imperfect.
Why can't we just put an explicit NULL to make the command "pass"? Well, that's
because then we override any default value. And we definitely don't want to do
that. Theoretically we could set the default value explicitly, but this
requires knowing what the default value is, which is very db-specific (need to
parse the default value...) and another can of worms.
So, sorry, but add before the insertRow() something like:
parentFrm.updateString(2, "")
parentFrm.updateNull(2)
--
You are receiving this mail because:
You are the assignee for the bug._______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs