Bug 101399 - Embedded Firebird - DisposedException
Summary: Embedded Firebird - DisposedException
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.1.5.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.3.0
Keywords:
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2016-08-08 21:21 UTC by Gerhard Schaber
Modified: 2016-11-14 09:51 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gerhard Schaber 2016-08-08 21:21:42 UTC
The following sequence of commands causes a DisposedException for some reason. This does not happen with the HSQLDB.

oDBSource = ThisComponent.DataSource
oConn = oDBSource.getConnection( "" , "" )
oStatement = oConn.createStatement()
sql = "CREATE TABLE " & DBQuoteName("testtable", oConn) & " (id int not null primary key, txt varchar(50))"
oResult = oStatement.executeQuery(sql)
'sql = "COMMIT"
'oResult = oStatement.executeQuery(sql)
sql = "INSERT INTO TABLE " &  DBQuoteName("testtable", oConn) & " (1, 'test')"
oStatement.executeQuery(sql)
Comment 1 Alex Thurgood 2016-08-09 07:06:17 UTC
@Gerhard : can you break this down into creating the database, and inserting the first tuple ?

In other words, where does your macro fail, at the table creation stage, or on attempted insertion of data ?
Comment 2 Alex Thurgood 2016-08-09 07:11:17 UTC
This could possibly be a dupe of bug 70425, where only characters can be inserted, and not integers, from within the app.
Comment 3 Alex Thurgood 2016-08-09 07:20:14 UTC
However, given that this report is about a macro, it could also be a duplicate of bug 80084 (sdbc connection to file driver), but in relation to the Firebird sdbc driver. As the dev on that issue commented, the changes would need to be made for all drivers, and no doubt this wasn't done with regard to Firebird.


As an aside comment, also note that Firebird 3 integration is currently underway (GSOC), so this bug might no longer exist in the future implementation when the version has been integrated.
Comment 4 Gerhard Schaber 2016-08-09 07:28:36 UTC
To be more precise. When I create a statement before each executeQuery, it works. Otherwise it does not.

Works:
oDBSource = ThisComponent.DataSource
oConn = oDBSource.getConnection( "" , "" )
oStatement = oConn.createStatement()
sql = "CREATE TABLE " & DBQuoteName("testtable", oConn) & " (id int not null primary key, txt varchar(50))"
oResult = oStatement.executeQuery(sql)
oStatement = oConn.createStatement()
sql = "INSERT INTO " &  DBQuoteName("testtable", oConn) & " values (1, 'test')"
oStatement.executeQuery(sql)
...

Does not work:
oDBSource = ThisComponent.DataSource
oConn = oDBSource.getConnection( "" , "" )
oStatement = oConn.createStatement()
sql = "CREATE TABLE " & DBQuoteName("testtable", oConn) & " (id int not null primary key, txt varchar(50))"
oResult = oStatement.executeQuery(sql)
'oStatement = oConn.createStatement()
sql = "INSERT INTO " &  DBQuoteName("testtable", oConn) & " values (1, 'test')"
oStatement.executeQuery(sql)
...
Comment 5 Gerhard Schaber 2016-08-09 11:51:56 UTC
I will retest when GSOC is over.
Comment 6 Buovjaga 2016-11-10 12:13:20 UTC
(In reply to Gerhard Schaber from comment #5)
> I will retest when GSOC is over.

Any news?
Comment 7 Gerhard Schaber 2016-11-10 12:40:01 UTC
It seems to work now with 5.3.0.0.alpha0+.

Test macro:
Sub Main
oDBSource = ThisComponent.DataSource
oConn = oDBSource.getConnection( "" , "" )
oStatement = oConn.createStatement()
sql = "CREATE TABLE ""testtable"" (id int not null primary key, txt varchar(50))"
oResult = oStatement.executeQuery(sql)
'sql = "COMMIT"
'oResult = oStatement.executeQuery(sql)
sql = "INSERT INTO ""testtable"" values (1, 'test')"
oStatement.executeQuery(sql)
End Sub

Quick question, are transactions are supposed to work?
sql = "begin tran"
oResult = oStatement.executeQuery(sql)
sql = "INSERT INTO ""testtable"" values (1, 'test')"
oStatement.executeQuery(sql)
sql = "COMMIT tran"
oResult = oStatement.executeQuery(sql)
Comment 8 Buovjaga 2016-11-10 12:45:12 UTC
Great news. Let's close.

(In reply to Gerhard Schaber from comment #7)
> Quick question, are transactions are supposed to work?
> sql = "begin tran"
> oResult = oStatement.executeQuery(sql)
> sql = "INSERT INTO ""testtable"" values (1, 'test')"
> oStatement.executeQuery(sql)
> sql = "COMMIT tran"
> oResult = oStatement.executeQuery(sql)

Someone else can reply to that.
Comment 9 Julien Nabet 2016-11-10 12:45:13 UTC
Let's put this one to FIXED then but with target 5.3.0