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)
@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 ?
This could possibly be a dupe of bug 70425, where only characters can be inserted, and not integers, from within the app.
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.
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) ...
I will retest when GSOC is over.
(In reply to Gerhard Schaber from comment #5) > I will retest when GSOC is over. Any news?
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)
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.
Let's put this one to FIXED then but with target 5.3.0