Apache OpenOffice (AOO) Bugzilla – Issue 101987
XBatchExecution broken for internal database
Last modified: 2013-02-24 21:09:48 UTC
It seems that XBatchExecution is broken using the built in database. The following code fails in the addBatch line and kills OO. In order to run it, you must create and register an (empty) database named "playground": Sub Main oDBCntxt = CreateUnoService("com.sun.star.sdb.DatabaseContext") oDBSrc = oDBCntxt.getByName( "playground" ) oConnection = oDBSrc.getConnection("","") msgbox "supportsBatchDataUpdates: " & oConnection.Metadata.supportsBatchUpdates() oStatement = oConnection.CreateStatement sSQL = "drop table TESTTABLE if exists; " sSQL = sSQL & "create table TESTTABLE (ID int IDENTITY, WKN char(20) );" oStatement.execute( sSQL) sSQL = "insert into TESTTABLE ( WKN ) values( 'abcWKN' );" oStatement.addBatch( sSQL) 'here it dies oStatement.executeBatch( sSQL) End Sub The following codes wrok fine, however: (i) 'normal' execute Sub Main oDBCntxt = CreateUnoService("com.sun.star.sdb.DatabaseContext") oDBSrc = oDBCntxt.getByName( "playground" ) oConnection = oDBSrc.getConnection("","") msgbox "supportsBatchDataUpdates: " & oConnection.Metadata.supportsBatchUpdates() oStatement = oConnection.CreateStatement sSQL = "drop table TESTTABLE if exists; " sSQL = sSQL & "create table TESTTABLE (ID int IDENTITY, WKN char(20) );" oStatement.execute( sSQL) sSQL = "insert into TESTTABLE ( WKN ) values( 'abcWKN' );" oStatement.execute( sSQL) End Sub and (ii) prepared statement in batch mode Sub Main oDBCntxt = CreateUnoService("com.sun.star.sdb.DatabaseContext") oDBSrc = oDBCntxt.getByName( "playground" ) oConnection = oDBSrc.getConnection("","") msgbox "supportsBatchDataUpdates: " & oConnection.Metadata.supportsBatchUpdates() oStatement = oConnection.CreateStatement sSQL = "drop table TESTTABLE if exists; " sSQL = sSQL & "create table TESTTABLE (ID int IDENTITY, WKN char(20) );" oStatement.execute( sSQL) oPrepStmt = oConnection.prepareStatement("insert into TESTTABLE ( WKN ) values( ? );") oPrepStmt.setString(1, "abcWKN") oPrepStmt.addBatch( ) oPrepStmt.executeBatch() End Sub
jsc -> fs: seems to be one for you or oj
fs->oj: the JDBC bridge implementation claims to support batch updates, but the respective statement classes do not implement XPreparedBatchExecution, thus making dbaccess'es OStatementBase::clearBatch crash.
Fixed in cws dba32c
Please verify. Thanks.
looks good in CWS dba32c
checked w/ DEV300m_53, XP Closing