To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=69979
Issue #|69979
Summary|Dispose locks database (bug or feature)
Component|Database access
Version|OOo 2.0.4
Platform|All
URL|
OS/Version|All
Status|UNCONFIRMED
Status whiteboard|
Keywords|
Resolution|
Issue type|DEFECT
Priority|P4
Subcomponent|none
Assigned to|dbaneedsconfirm
Reported by|knobo
------- Additional comments from [EMAIL PROTECTED] Fri Sep 29 06:41:40 -0700
2006 -------
The following script can only be run once. After that the it crashes on
oDbContext.hasByName(sDbName), and the "data source" windows is unaccesseble.
After restarting OOo, the script can be run (once) again.
Tried on Linux and Windows, with same result.
Removing the line: oDbContext.dispose() fixes the problem
REM ***** BASIC *****
Option Explicit
Sub Main
DbTest("/home/knobo/csv/", "foo", "foo")
End Sub
Function DbTest(sDbDir ,sCsvFile, sDbName) As Boolean
On Error Goto ErrorHandler
Dim oDbContext As Object
Dim oDbInstance As Object
Dim mDbProp(6)
oDbContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")
If oDbContext.hasByName(sDbName) Then
oDbContext.revokeObject(sDbName)
End If
oDbInstance = oDbContext.createInstance ()
oDbInstance.DatabaseDocument.storeAsURL( convertToURL( sDbDir + sDbName +
".odb" ), Array())
oDbInstance.URL = "sdbc:flat:" + convertToURL( sDbDir )
mDbProp(0) = MakePropertyValue( "Charset", "iso-8859-1" )
mDbProp(1) = MakePropertyValue( "DecimalDelimiter", "," )
mDbProp(2) = MakePropertyValue( "FieldDelimiter", Chr(9) ) ' => \t
mDbProp(3) = MakePropertyValue( "Extension", "csv" )
mDbProp(4) = MakePropertyValue( "HeaderLine", True )
mDbProp(5) = MakePropertyValue( "StringDelimiter", """" ) ' => "
mDbProp(6) = MakePropertyValue( "ThousandDelimiter", "" )
Dim oDbConnection As Object
oDbInstance.Info = mDbProp
oDbContext.registerObject( sDbName, oDbInstance )
oDbConnection = oDbInstance.getConnection( "", "" )
REM
REM Do some funny db functions here
REM
CleanUp:
On Error Resume Next
if not isNull (oDbConnection) Then
oDbConnection.close()
oDbConnection.dispose()
End If
if Not IsNull (oDbInstance) Then
oDbInstance.DatabaseDocument.close (True)
oDbInstance.dispose()
End If
oDbContext.revokeObject(sDbName)
oDbContext.dispose() 'Remove me?
Exit Function
ErrorHandler:
MsgBox "DbTest error [line: " + Erl + "] error [" + Err + "]: " + Error$
Goto Cleanup
End Function
Function MakePropertyValue( Optional cName As String, Optional uValue ) As
com.sun.star.beans.PropertyValue
Dim oPropertyValue As New com.sun.star.beans.PropertyValue
If Not IsMissing( cName ) Then
oPropertyValue.Name = cName
EndIf
If Not IsMissing( uValue ) Then
oPropertyValue.Value = uValue
EndIf
MakePropertyValue() = oPropertyValue
End Function
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]