Thanks .
I am reading the xml by 128 bytes of buffer and by this way even a small xml
gets some time to be read. Also after reading, it is loaded
By XmlDocument and loaded into a custom object which takes around a second.I
think that it should have entered the async mode.
I am about to give up about it :( .

Anyway thanks for answering :).


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of J. Merrill
Sent: 11 Mart 2004 Persembe 23:23
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Asynchronous OracleLob.BeginRead()

I don't know if OracleLob.BeginRead supports asynch operations, but the docn
for IAsyncResult.CompletedSynchronously says that it can return true "for an
asynchronous I/O operation if the I/O request was small."  So unless you're
actually reading data for a relatively large bit of XML, I don't think you
can tell whether you're getting any advantage from being asynchronous.

At 04:54 AM 3/11/2004, Devrim Baris Acar wrote
>Hi,
>I have some code that reads some xml data from clob columns of an
>Oracle table synchronously.
>However in order to maximize CPU throughput(I guess it will), I changed
>the code to async. version.To my surprise it still works synchronously.
>I have crawled through documentation and read that BeginRead works
>async only if it is supported.
>
>Does OracleLob.BeginRead() support asyncronous operations?
>
>Thanks in advance.
>
>PS.Sorry for those who have read this same message on DOTNET-CLR a
>couple of days ago.But I hada no replies there.
>
>
>Here is the code that works syncronously and in callback shows
>IAsyncResult.CompletedSynchronously as true.
>-----------------------------------
>try
>{
>        OracleConnection conn=ConnectionPool.GetConnection();
>        OracleCommand cmd=conn.CreateCommand();
>        cmd.CommandText="select xml from xmltable where id in
>(19785,23930, 4884, 5966, 5918, 7068, 7069, 3072,21615, 6034, 6038, 7071,
7070, 5151)";
>        OracleDataReader reader=null;
>        reader=cmd.ExecuteReader();
>        while(reader.Read())
>        {
>                Console.WriteLine("Bringing...");
>                AsyncCallback readImageCallback = new
>AsyncCallback(ReadInImageCallback);
>                OracleLob NCLOB = reader.GetOracleLob(0);
>                StateObject so=new StateObject();
>                so.lob=NCLOB;
>                so.bytes=new byte[NCLOB.Length * 2];
>
>NCLOB.BeginRead(so.bytes,0,int.Parse((NCLOB.Length*2).ToString()),readI
>mageC
>allback,so);
>        }
>}
>catch(Exception byexc)
>{
>        CustomEvent.ShowException(byexc); }
>-----------------------------------------------
>
>public void ReadInImageCallback(IAsyncResult asyncResult) {
>        StateObject so= (StateObject) asyncResult.AsyncState;
>        Console.WriteLine("Syncly:"+asyncResult.CompletedSynchronously);
>        OracleLob NCLOB=so.lob;
>        nt bytesRead = NCLOB.EndRead(asyncResult);
>        string tablo=Encoding.Unicode.GetString(so.bytes);
>        NCLOB.Close();
>}
>-----------------------------------
>public class StateObject
>{
>        public byte[] bytes;
>        public int imageNum;
>        public OracleLob lob;
>}


J. Merrill / Analytical Software Corp

===================================
This list is hosted by DevelopMentor.  http://www.develop.com Some .NET
courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to