I have a firebird database (LO 6.1.2.1) with n:m connections.
When adding records in a macro, in order to maintain the n:m table I need to know the ID (=autovalue primary key) of the record I just inserted.
Adding a record works fine vial SQL:
Connection = ThisDatabaseDocument.DataSource.getConnection("","")
Statement = Connection.createStatement()
SQL = "INSERT INTO ""Sections"" (""Section"") VALUES ('ABC')"
ResultSet = Statement.executeQuery(SQL)
The Firebird documentation says that the most recent ID can be retrieved by adding the RETURNING command:
SQL = "INSERT INTO ""Sections"" (""Section"") VALUES ('Anita') RETURNING ""ID"""
The problem is: this does add the data, but it does not return the ID (at least I can not find in in the returned ResultSet).