To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=56643
                  Issue #:|56643
                  Summary:|setBinaryStream fails for a prepared statement.
                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] Tue Oct 25 11:17:05 -0700 
2005 -------
I thought that this was already created as an issue, but I can not find it when
I search on setbinaryStream. Most unusual. 

Well, I can get an Image from a database using something like the following:
    oBinStream = oResultSet.getBinaryStream(lImage)
    If oResultSet.wasNull() Then
      Print "The image was NULL"
    Else
      sURL = "file:///c:/" & sName
      oSimpleFileAccess.writeFile(sURL, oBinStream)
    End If

I can not, however, set the Binary Stream. Something like this:

oStatement = oCon.PrepareStatement( "insert into IMAGE (COMMENT, IMAGE, NAME)
values (?, ?, ?)") 
oStatement.SetString( 1, "This is empty")
oStatement.SetString( 3, "blah2.png")

REM Fails for a DataInputStream.
oStatement.setBinaryStream(2, oStream, oStream.getInputStream().getLength())

REM Fails for an input stream
oStatement.setBinaryStream(2, oStream, oStream.getLength())

The error is something about a NULL stream. If, however, I read the data into a
byte array, then I can use setBytes()

  oStream = oSimpleFileAccess.openFileRead(sURL)
  Dim oData()
  Dim lLen As Long
  lLen = oStream.getLength()
  
  ReDim oData(0 To lLen-1)
  oStream.readBytes(oData(), lLen)
  oStatement.setBytes(2, oData(), lLen)

---------------------------------------------------------------------
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