0 Replies Latest reply: Jun 20, 2011 6:21 PM by 102986 RSS

    RAW problem with OO4O and VB6.

    102986
      Hello!

      Env: W2K3 SBS R2, O11gR2, OO4O, VB6 and problem from a "heritage" project ;-).

      /* Create a small Test table */
      Create Table ORAWTEST
      ( oid Number(10),
      bflags Raw(4)
      ) Tablespace USERDATA Storage(Initial 32K Next 32K);

      ' ** A small VB6 app. **
      Dim osess As OraSessionClass, odb As OraDatabase, ors As OraDynaset
      Private Sub Form_Load()
      Set osess = CreateObject("OracleInProcServer.XOraSession")
      Set odb = osess.OpenDatabase("orcl", "uid/pw", ORADB_ORAMODE)
      End Sub
      Private Sub Form_Unload()
      odb.Close: Set osess = Nothing
      End Sub

      Private Sub Command1_Click()
      ' Insert 3 rows with different values Into Test table using Addnew() method.
      Dim ws As String
      Set ors = odb.CreateDynaset("Select * From ORAWTEST", ORADYN_ORAMODE)
      ws = Chr$(0) & Chr$(0) & Chr$(32) & Chr$(0)
      ors.AddNew: ors("oid") = 1: ors("bflags") = ws: ors.Update
      ws = Chr$(0) & Chr$(0) & Chr$(0) & Chr$(32) ' <-- !!! This is the problem.
      ors.AddNew: ors("oid") = 2: ors("bflags") = ws: ors.Update
      ws = Chr$(0) & Chr$(0) & Chr$(0) & Chr$(64)
      ors.AddNew: ors("oid") = 3: ors("bflags") = ws: ors.Update
      ors.Close
      End Sub

      ... and now the surprise:

      SQL> Select oid, RawToHex(bflags) From ORAWTEST;

      OID RAWTOHEX(BFLAGS)
      ---------------------- ----------------
      1 00002000
      *2 000000*
      3 00000040

      Row 2 bflags column last byte is missing (in case of x'20' value).
      Is it a bug, or whatever? Thanks for any idea in advance.
      Leslie