Issue 117279 - doImport function cause OpenOffice to crash
Summary: doImport function cause OpenOffice to crash
Status: UNCONFIRMED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 3.3
Hardware: All Linux, all
: P3 Normal (vote)
Target Milestone: OOo 3.3
Assignee: AOO issues mailing list
QA Contact: RottenEogat@gmail.com
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 10:58 UTC by h0l0fernes
Modified: 2013-05-27 02:27 UTC (History)
1 user (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 h0l0fernes 2011-03-08 10:58:08 UTC
Using OpenOffice to connect to Postgresql Database with PostgreSQL SDBC
driver.

Calc document have written macro which connect to Postgres, and throw data into
spreadsheet.
Step by step inspection of macro showed that OpenOffice crash on line:
"oSheet.getcellbyposition(0,3+j).doImport(vAttrib)"

Suspected that the problem is caused by Java version, but it happened on all
Javas I have tested:
- Sun Microsystems 1.6.0_13
- Sun Microsystems 1.6.0_20 with acceasability support
- Sun Microsystems 1.6.0_24
- Free Software Foundation 1.5.0

The best results were with - Sun Microsystems 1.6.0_20 with acceasability
support.
For the moment before the OpenOffice crashed I could see that doImport pasted
data into spreadsheet.
OpenOffice don't throw anything on the console, which could help to backtrace.

The doImport function is very useful one, and I guess that many users are using
(or will be) using it.

Below the code which cause crash.


sub hall_insert
    Dim DatabaseContext As Object
    Dim DataSource As Object
    Dim Connection As Object
    Dim InteractionHandler as Object
    Dim Statement As Object
    Dim ResultSet As Object
    Dim oSheet as Object
    sTemp$ = "Temperatura, K"

    baza="baza_mocvd" 
    oSheet=thiscomponent.sheets.getbyName("Hall")


    oCellRange = oSheet.getCellRangeByName("A5:I50")
    oCellRange.clearContents(com.sun.star.sheet.CellFlags.VALUE)
    oCellRange.clearContents(com.sun.star.sheet.CellFlags.STRING)
    'oCellRange.clearContents(com.sun.star.sheet.CellFlags.FORMULA)

    DatabaseContext = createUnoService("com.sun.star.sdb.DatabaseContext")
    DataSource = DatabaseContext.getByName(baza)

    If Not DataSource.IsPasswordRequired Then
      Connection = DataSource.GetConnection("","")
    Else
      InteractionHandler =
createUnoService("com.sun.star.sdb.InteractionHandler")
      Connection = DataSource.ConnectWithCompletion(InteractionHandler)
    End If

    If oSheet.getCellByPosition(1,0).getString() = "" then
oSheet.getCellByPosition(1,0).setValue(0)
    process_list = oSheet.getCellByPosition(1,0).getString()

    Statement = Connection.createStatement()
    ResultSet = Statement.executeQuery("SELECT hall_id,process_id, temperature
FROM erp.hall where process_id in(" +process_list+ ") order by temperature
DESC, process_id DESC,thickness ASC" )




        If Not IsNull(ResultSet) Then

            ResultSet.last   'Move to the LAST record, to determine the Record
Count
            j = ResultSet.Row   'Added a variable with the number of records
returned 
            ResultSet.beforeFirst()
            While ResultSet.next

                hall_id=ResultSet.getString(1)
                process_id=ResultSet.getString(2)
                temperature=ResultSet.getString(3)

                    sSQL= "SELECT process_id,temperature, depth, rsq, uh,
ns/thickness*10000 AS ""nh, cm-3"", thickness, remarks, surveyor FROM erp.hall
AS h WHERE process_id=" + process_id + "AND temperature="+temperature
                    ' I am using MakeProperty function written by DannyB,
available in thousand references over this site, mean and clean. ;)
                    vAttrib=Array(MakePropertyValue("DatabaseName", baza),
MakePropertyValue( "SourceType", "SQL" ), MakePropertyValue( "SourceObject",
sSQL))

                    'Now the import, quick and nice. ;)
                    oSheet.getcellbyposition(0,3+j).doImport(vAttrib)
                    j=j-1
            Wend
        End If
    ResultSet.dispose()
    Connection.close()

end sub
'by DannyB
Function MakePropertyValue( Optional cName As String, Optional uValue ) As
com.sun.star.beans.PropertyValue
   Dim oPropertyValue As New com.sun.star.beans.PropertyValue
   If Not IsMissing( cName ) Then
      oPropertyValue.Name = cName
   EndIf
   If Not IsMissing( uValue ) Then
      oPropertyValue.Value = uValue
   EndIf
   MakePropertyValue() = oPropertyValue
End Function
Comment 1 Oliver-Rainer Wittmann 2012-06-13 12:23:47 UTC
getting rid of value "enhancement" for field "severity".
For enhancement the field "issue type" shall be used.