Issue 101987 - XBatchExecution broken for internal database
Summary: XBatchExecution broken for internal database
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: PC All
: P2 Trivial
Target Milestone: ---
Assignee: Frank Schönheit
QA Contact: issues@api
URL:
Keywords: crash
Depends on:
Blocks:
 
Reported: 2009-05-16 14:21 UTC by ms7777
Modified: 2013-02-24 21:09 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ms7777 2009-05-16 14:21:46 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
Comment 1 jsc 2009-05-18 07:51:00 UTC
jsc -> fs: seems to be one for you or oj
Comment 2 Frank Schönheit 2009-05-20 08:29:34 UTC
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.
Comment 3 ocke.janssen 2009-05-26 12:34:43 UTC
Fixed in cws dba32c
Comment 4 ocke.janssen 2009-06-15 10:21:19 UTC
Please verify. Thanks.
Comment 5 Frank Schönheit 2009-06-15 12:30:16 UTC
looks good in CWS dba32c
Comment 6 drewjensen.inbox 2009-07-24 14:52:01 UTC
checked w/ DEV300m_53, XP

Closing