Click here to Skip to main content
15,899,935 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 3:56
mveRichard Deeming23-Jul-15 3:56 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Aaron Rosenthal23-Jul-15 4:24
Aaron Rosenthal23-Jul-15 4:24 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 4:51
mveRichard Deeming23-Jul-15 4:51 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Aaron Rosenthal23-Jul-15 6:11
Aaron Rosenthal23-Jul-15 6:11 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 6:20
mveRichard Deeming23-Jul-15 6:20 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Aaron Rosenthal23-Jul-15 6:24
Aaron Rosenthal23-Jul-15 6:24 
SuggestionRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 6:25
mveRichard Deeming23-Jul-15 6:25 
AnswerRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 6:37
mveRichard Deeming23-Jul-15 6:37 
OK, one more suggestion! Smile | :)

Try using the GetOracleLob method[^] instead. This will return an OracleLob object[^] which you can use to read the value.
VB.NET
Using lob As OracleLob = reader.GetOracleLob(0)
    Using sr As New StreamReader(lob, Text.Encoding.Unicode) ' <-- You might need to adjust this
        retval = sr.Read(outChar, 0, bufferSize)
        Do Until retval = 0
            myxml.WriteRaw(outChar, 0, retval)
            myxml.Flush()
            
            Array.Clear(outChar, 0, retval)
            retval = sr.Read(outChar, 0, bufferSize)
        Loop
    End Using
End Using

You might need to adjust the encoding passed to the StreamReader constructor. The GetChars method uses Unicode by default, but I suspect your string might be in a different encoding.


EDIT: Looking at the code in dotPeek, this will be much more efficient than calling GetChars:
  1. The GetChars method creates a new OracleLob on each call, and reads its Value property.
  2. The Value property reads the entire string into memory on each call.
  3. The GetChars method then copies the string to a Char array.
  4. The GetChars method then copies the specified section of the array to the buffer you've passed in.

This is horrendously inefficient, and it's no surprise that your code is running slowly! OMG | :OMG:



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer



modified 23-Jul-15 12:50pm.

GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Aaron Rosenthal23-Jul-15 8:02
Aaron Rosenthal23-Jul-15 8:02 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Eddy Vluggen23-Jul-15 9:19
professionalEddy Vluggen23-Jul-15 9:19 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 9:50
mveRichard Deeming23-Jul-15 9:50 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Eddy Vluggen23-Jul-15 10:27
professionalEddy Vluggen23-Jul-15 10:27 
QuestionHow to rename texts in a Standart Browse File / Browse Folder Dialog Pin
satc22-Jul-15 4:14
satc22-Jul-15 4:14 
AnswerRe: How to rename texts in a Standart Browse File / Browse Folder Dialog Pin
Eddy Vluggen22-Jul-15 4:38
professionalEddy Vluggen22-Jul-15 4:38 
GeneralRe: How to rename texts in a Standart Browse File / Browse Folder Dialog Pin
satc22-Jul-15 20:02
satc22-Jul-15 20:02 
GeneralRe: How to rename texts in a Standart Browse File / Browse Folder Dialog Pin
Eddy Vluggen22-Jul-15 21:40
professionalEddy Vluggen22-Jul-15 21:40 
QuestionA validation information inside a zip file Pin
satc22-Jul-15 2:43
satc22-Jul-15 2:43 
AnswerRe: A validation information inside a zip file Pin
Eddy Vluggen22-Jul-15 3:51
professionalEddy Vluggen22-Jul-15 3:51 
AnswerRe: A validation information inside a zip file Pin
Dave Kreskowiak22-Jul-15 3:53
mveDave Kreskowiak22-Jul-15 3:53 
GeneralRe: A validation information inside a zip file Pin
satc26-Jul-15 0:11
satc26-Jul-15 0:11 
GeneralRe: A validation information inside a zip file Pin
Dave Kreskowiak26-Jul-15 3:39
mveDave Kreskowiak26-Jul-15 3:39 
QuestionHelp with datetime Pin
jkirkerx21-Jul-15 10:58
professionaljkirkerx21-Jul-15 10:58 
AnswerRe: Help with datetime Pin
Dave Kreskowiak21-Jul-15 11:56
mveDave Kreskowiak21-Jul-15 11:56 
GeneralRe: Help with datetime Pin
jkirkerx21-Jul-15 13:05
professionaljkirkerx21-Jul-15 13:05 
SuggestionRe: Help with datetime Pin
Ralf Meier21-Jul-15 21:28
mveRalf Meier21-Jul-15 21:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.