Issue 86855 - embedded database forms opened from macro, when ODB file is not open on desktop DO NOT write data to disk
Summary: embedded database forms opened from macro, when ODB file is not open on deskt...
Status: CONFIRMED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 2.4 RC4
Hardware: All Windows XP
: P3 Trivial (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2008-03-10 04:17 UTC by drewjensen.inbox
Modified: 2013-01-29 21:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
example database (9.97 KB, application/vnd.sun.xml.base)
2008-04-08 03:07 UTC, drewjensen.inbox
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description drewjensen.inbox 2008-03-10 04:17:27 UTC
See related issue 86854

Tested under XP, RC3 and M_10, Linux 32bit RC3, Linux 64bit m_10

Create a macro that opens an embedded database form directly - such that the odb
file is not opened on the desktop. 

Make changes to the data - the changes appear to be written properly - now close
the form and exit OpenOffice.org completely. Open the database file and check
the tables. None of the changes where written to disk. If the odb file is opened
on the desktop when the macro is called, opening the form, then that data is
written to disk when the odb file is closed.
Comment 1 Frank Schönheit 2008-03-17 12:04:06 UTC
> Create a macro that opens an embedded database form directly

Since we both know this is a non-trivial piece of macro code - care to attach a
sample here, so all involved parties can easily reproduce the issue without
re-inventing the wheel every time?
Comment 2 drewjensen.inbox 2008-04-08 03:07:52 UTC
Created attachment 52637 [details]
example database
Comment 3 drewjensen.inbox 2008-04-08 03:17:41 UTC
Well, it is my fault for not getting back on this then..

To reproduce under XP:

Download the attached ODB file.
Register it as "i86855"
Copy this basic procedure, slightly modifiied from a post reporting the problem on the forum, to any 
library ( Standard? ).

Function OpenForm 
Dim Context As Object
Dim DB As Object
Dim Conn As Object
Dim FormDoc As Object
Dim Form AS Object
Dim Args(1) As New com.sun.star.beans.PropertyValue
Context=CreateUnoService("com.sun.star.sdb.DatabaseContext")
DB=Context.getByName("i86855")
Database=DB.getConnection("","")
Args(0).Name="ActiveConnection"
Args(0).Value=Database
Args(1).Name="OpenMode"
Args(1).Value="open"
FormDoc=DB.DatabaseDocument.FormDocuments.loadComponentFromURL 
("Contacts","_blank",0,Args() )
End Function

Make sure quickstarter is running. ( not needed totally, but shows the full problem, IMO )
*without* having opened the ODB file interactively, run that macro.
Add some data to the table using the form and close the form.
Completely exit OOo ( including quickstarter )

Open the ODB file and look at the table - no data was saved.

FYI - as long quickstarter is running you can open that form multiple times with the macro and the data 
will be retained - you can add more, or edit it, each time the edits are displayed in the form when it is 
opened. As soon as OOo is actually closed ( quickstarter is closed ) then all changes are lost.

Comment 4 christoph.lukasiak 2008-06-18 15:14:49 UTC
clu->atjensen: please check if still occur in current version & send further to fs
Comment 5 Frank Schönheit 2008-06-20 09:38:56 UTC
> please check if still occur in current version & send further to fs
fs->clu: In this case please do not yet a) assign it to me and b) target it.
Comment 6 drewjensen.inbox 2008-06-21 02:30:13 UTC
using OO.o 3.0 m_20, XP yes it still is true.

When you run this basic macro what happens is the odb file is loaded into
memory, when the form is closed the odb is still in memory. At this point the
only way to get it out of memory is to explicitly load it and close it.

When you exit OpenOffice.org the odb file is left in memory.

Perhaps opening a form this way is considered invalid.
Comment 7 drewjensen.inbox 2008-06-23 04:38:16 UTC
Well - as I don't know really know whether opening a form this way was supposed
to be supported or not I can't say whether this is basic code is INVALID or not.

I suppose it is.

The reason I say that is because even if you close the connection explicitly
when the last for opened is closed the data is not written, and I can't see how
one can get to the Base file in memory to close it.

However if in the Basic code you use stardestkop.loadComponentFromURL to load
the Base file AND IF hidden then insure that the connection ( created using the
datasource of the opened Base file) is explicitly closed the data will be
written when OO.o finally exits completely. Meaning that if quickstarter is
running the write does not happen, it appears, until quickstarter is also
closed. ( But that is a different issue )
Comment 8 christoph.lukasiak 2008-09-23 16:08:29 UTC
clu->fs: as drew is oo qa member and his issues goes strongly into development
direction, the easiest way is, to let him check this issue and close it, if it
does not occur anymore, or send it further to dev (you) .. this are the new
expanded rights for oo qa members

clu->drew: is this issue still valid?

if not sure, please discuss in corresponding mailing list etc. .. you know the
procedure ;)

thx