To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=55743
                  Issue #:|55743
                  Summary:|RowSet crashes when obtaining a Time or TimeStamp
                          |field.
                Component:|Database access
                  Version:|OOo 2.0
                 Platform:|All
                      URL:|
               OS/Version:|All
                   Status:|NEW
        Status whiteboard:|
                 Keywords:|
               Resolution:|
               Issue type:|DEFECT
                 Priority:|P3
             Subcomponent:|none
              Assigned to:|dbaneedsconfirm
              Reported by:|pitonyak





------- Additional comments from [EMAIL PROTECTED] Mon Oct 10 14:14:53 -0700 
2005 -------
So, you want to Crash OOo version 2.0 RC 2? I mean, a complete and total crash!

I created a simple database containing a Time and a TimeStamp field. I noticed
that when I obtain a TimeStamp object using a ResultSet, the TimeStamp field
does NOT contain the milliseconds. If I obtain the column as a string, however,
then it does. (I have NOT filed an issue against this problem).

This is how I set the values and then decided that I could NOT obtain the
milliseconds.

'Set dbFileName as the registered name or the URL to the file.
Sub UseSQL(dbFileName As String)
  Dim oStatement
  Dim oResultSet
  Dim oBaseContext
  Dim oDataBase
  Dim oTables
  Dim oBaseNames
  Dim oCols
  Dim oCol
  Dim oTable
  Dim oCon
  Dim oDoc
  Dim s$

  '**** Set up things here ****
  Const dbUser as String = ""
  Const dbPass as String = ""

  oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext")

  oDataBase = oBaseContext.getByName(dbFileName)
  oCon = oDataBase.getConnection(dbUser, dbPass)
  oTables = oCon.getTables()

  'some error handling
  On Error Goto ErrorHandler

  oStatement = oCon.createStatement()
  oResultSet = oStatement.executeQuery("update NUM Set TS='1965-03-13
01:02:03.123456789' Where ID=0")
  oResultSet = oStatement.executeQuery("update NUM Set T='03:04:05' Where ID=0")
  oResultSet = oStatement.executeQuery("select TS, T from NUM Where ID=0")

  Dim oTS
  Dim oTime

  If Not IsNull(oResultSet) Then
    oResultSet.next
    oTS = oResultSet.getTimestamp(1)
    oTime = oResultSet.getTime(2)

    s = "Time1 " & oTime.Hours & ":" & oTime.Minutes & ":" & _
                  oTime.Seconds & "." & oTime.HundredthSeconds & CHR$(10) & _
        "Time2 " & oResultSet.getString(2) & chr$(10) & chr$(10)

    s = s & "TS1 = " & oTS.Year & "-" & oTS.Month & "-" & oTS.Day & " " & _
                  oTS.Hours & ":" & oTS.Minutes & ":" & _
                  oTS.Seconds & "." & oTS.HundredthSeconds & CHR$(10) & _
            "TS2 = " & oResultSet.getString(1) & CHR$(10)
  End If
  Msgbox s
  oCon.close()

  Exit Sub

  ErrorHandler:
  MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13)
+ Now , 16 ,"An Error Occurred"
  oCon.close()
End Sub

I decided to check using a RowSet. OOo CRASHES completely when I do this.

Sub UseRowSet(sName$)
  Dim oRowSet As Variant
  Dim sSql$
  Dim n%
  Dim oTS
  Dim oTime
  Dim s$
   
  oRowSet = createUnoService("com.sun.star.sdb.RowSet")
  oRowSet.setPropertyValue("DataSourceName", sName)
  oRowSet.CommandType = com.sun.star.sdb.CommandType.COMMAND
  'oRowSet.CommandType = com.sun.star.sdb.CommandType.QUERY 
   
  sSQL = "SELECT * from `NUM` Where ID=0"
  oRowSet.setPropertyValue("Command", sSQL)
  oRowSet.execute()
  n = oRowSet.getPropertyValue("RowCount")
  If n > 0 Then
    MsgBox "with data"
    Dim l1 As Long
    Dim l2 As Long
    l1 = oRowSet.findColumn("TS")
    l2 = oRowSet.findColumn("T")
    Print l1
    Print l2
    oTS = oRowSet.getTimestamp(l1)
    oTime = oRowSet.getTime(l2)
    s = "Time1 " & oTime.Hours & ":" & oTime.Minutes & ":" & _
                   oTime.Seconds & "." & oTime.HundredthSeconds & CHR$(10) & _
        "Time2 " & oRowSet.getString(l2) & chr$(10) & chr$(10)
    s = s & "TS1 = " & oTS.Year & "-" & oTS.Month & "-" & oTS.Day & " " & _
                       oTS.Hours & ":" & oTS.Minutes & ":" & _
                       oTS.Seconds & "." & oTS.HundredthSeconds & CHR$(10) & _
            "TS2 = " & oRowSet.getString(l1) & CHR$(10)
    Msgbox s
  Else   
    MsgBox "without data"
  Endif 
  'Inspect(oRowSet)
  oRowSet.dispose()
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to