To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=101987
                 Issue #|101987
                 Summary|XBatchExecution broken for internal database
               Component|api
                 Version|OOo 3.1
                Platform|PC
                     URL|
              OS/Version|All
                  Status|UNCONFIRMED
       Status whiteboard|
                Keywords|
              Resolution|
              Issue type|DEFECT
                Priority|P2
            Subcomponent|code
             Assigned to|jsc
             Reported by|ms7777





------- Additional comments from ms7...@openoffice.org Sat May 16 13:21:46 
+0000 2009 -------
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

---------------------------------------------------------------------
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: issues-unsubscr...@api.openoffice.org
For additional commands, e-mail: issues-h...@api.openoffice.org


---------------------------------------------------------------------
To unsubscribe, e-mail: allbugs-unsubscr...@openoffice.org
For additional commands, e-mail: allbugs-h...@openoffice.org

Reply via email to