[Mono-devel-list] Reworked Patch of Timer

2005-06-24 Thread S Umadevi
Hey Ben
Thanks for your comments.  Find the diff attached..

Can this be commited now?

Regards
uma
Index: Timer.cs
===
--- Timer.cs(revision 46470)
+++ Timer.cs(working copy)
@@ -29,122 +29,79 @@
 //
 
 using System.Runtime.InteropServices;
+using System.Collections;
 
 namespace System.Threading
 {
+
 #if NET_2_0
[ComVisible (true)]
 #endif
public sealed class Timer : MarshalByRefObject, IDisposable
{
-   sealed class Runner : MarshalByRefObject
-   {
-   ManualResetEvent wait;
-   AutoResetEvent start_event;
-   TimerCallback callback;
-   object state;
-   int dueTime;
-   int period;
-   bool disposed;
-   bool aborted;
 
-   public Runner (TimerCallback callback, object state, 
AutoResetEvent start_event)
-   {
-   this.callback = callback;
-   this.state = state;
-   this.start_event = start_event;
-   this.wait = new ManualResetEvent (false);
-   }
 
-   public int DueTime {
-   get { return dueTime; }
-   set { dueTime = value; }
-   }
+internal class TimerTask
+ {
+internal TimerCallback timerCallback;
+internal object state;
+internal int dueTime;
+internal int period;
+internal DateTime lastSignalledTime;
+internal Timer timer;
+   internal bool triggered; 
+   
 
+   
 
+   
 
+public TimerTask(TimerCallback timercallback, object 
state, int dueTime, int period, Timer timer)
+{
+   
 
+this.timerCallback = timercallback;
+this.state = state;
+this.dueTime = dueTime;
+this.period = period;
+this.timer = timer;
+   this.lastSignalledTime = DateTime.UtcNow; //we 
are storing now, even   
   
+
+   // though we have never 
signalled this :)
+   this.triggered = false;
+}
 
-   public int Period {
-   get { return period; }
-   set { period = value == 0 ? Timeout.Infinite : 
value; }
-   }
 
-   bool WaitForDueTime ()
+   internal void Callback()
{
-   if (dueTime  0) {
-   bool signaled;
-   do {
-   wait.Reset ();
-   signaled = wait.WaitOne 
(dueTime, false);
-   } while (signaled == true  !disposed 
 !aborted);
-
-   if (!signaled)
-   callback (state);
-
-   if (disposed)
-   return false;
-   }
-   else
-   callback (state);
-
-   return true;
-   }
-
-   public void Abort ()
+   this.lastSignalledTime = DateTime.UtcNow;
+   timerCallback(state);
+   }   
+ 
+   internal bool IsDue()
{
-   lock (this) {
-   aborted = true;
-   wait.Set ();
-   }
-   }
-   
-   public void Dispose ()
-   {
-  

Re: [Mono-devel-list] Reworked Patch of Timer

2005-06-24 Thread S Umadevi
New patch.
1. used a foreach instead of a for.
2. Will not compute the waittime, unless there is a change to the
timers arraylist(Thanks to Hari for pointing this out)

Regards
uma

 Thomas Harning Jr. [EMAIL PROTECTED] 06/24/05 12:16 PM 
S Umadevi wrote:

 Hey Ben
 Thanks for your comments.  Find the diff attached..

 Can this be commited now?

 Regards
 uma


Looking over this patch, it looks like there could be some good use
of foreach for looping over things.  It would tighten the code up
readability-wise.
The performance of the foreach loop 'should' be = the for loop, but
I haven't looked at how Mono optimizes foreach really.

--
Thomas Harning Jr.
Index: Timer.cs
===
--- Timer.cs(revision 46470)
+++ Timer.cs(working copy)
@@ -29,121 +29,83 @@
 //
 
 using System.Runtime.InteropServices;
+using System.Collections;
 
 namespace System.Threading
 {
+
 #if NET_2_0
[ComVisible (true)]
 #endif
public sealed class Timer : MarshalByRefObject, IDisposable
{
-   sealed class Runner : MarshalByRefObject
-   {
-   ManualResetEvent wait;
-   AutoResetEvent start_event;
-   TimerCallback callback;
-   object state;
-   int dueTime;
-   int period;
-   bool disposed;
-   bool aborted;
 
-   public Runner (TimerCallback callback, object state, 
AutoResetEvent start_event)
-   {
-   this.callback = callback;
-   this.state = state;
-   this.start_event = start_event;
-   this.wait = new ManualResetEvent (false);
-   }
 
-   public int DueTime {
-   get { return dueTime; }
-   set { dueTime = value; }
-   }
+internal class TimerTask
+ {
+internal TimerCallback timerCallback;
+internal object state;
+internal int dueTime;
+internal int period;
+internal DateTime lastSignalledTime;
+internal Timer timer;
+   internal bool triggered; 
+   
 
+   
 
+   
 
+public TimerTask(TimerCallback timercallback, object 
state, int dueTime, int period, Timer timer)
+{
+   
 
+this.timerCallback = timercallback;
+this.state = state;
+this.dueTime = dueTime;
+this.period = period;
+this.timer = timer;
+   this.lastSignalledTime = DateTime.UtcNow; //we 
are storing now, even   
   
+
+   // though we have never 
signalled this :)
+   this.triggered = false;
+}
 
-   public int Period {
-   get { return period; }
-   set { period = value == 0 ? Timeout.Infinite : 
value; }
-   }
 
-   bool WaitForDueTime ()
+   internal void Callback()
{
-   if (dueTime  0) {
-   bool signaled;
-   do {
-   wait.Reset ();
-   signaled = wait.WaitOne 
(dueTime, false);
-   } while (signaled == true  !disposed 
 !aborted);
-
-   if (!signaled)
-   callback (state);
-
-   if (disposed)
-   return false;
-   }
-   else
-   callback (state);
-
-   return true;
-   }
-
-   public void Abort ()
+   this.lastSignalledTime

[Mono-devel-list] Find Object instance that called a method..

2005-06-21 Thread S Umadevi
Hi,
 Is there a mechanism to figure out the object instance that called a
method..
Ex.
class A {

public  void m1()
{
  //some code..
}

}

Class B {

  private m2()
{
   A aa = new A();
aa.m1();

}
}

From method m1 in class A is it possible for me to figure out the
object instance aa?

Regards
uma
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] Patch for Review - System.threading.Timerr

2005-06-14 Thread S Umadevi
Index: Timer.cs
===
--- Timer.cs(revision 45932)
+++ Timer.cs(working copy)
@@ -29,26 +29,31 @@
 //
 
 using System.Runtime.InteropServices;
+using System.Collections;
 
 namespace System.Threading
 {
+
+public delegate void RunnerCallback(object state);
+
 #if NET_2_0
[ComVisible (true)]
 #endif
public sealed class Timer : MarshalByRefObject, IDisposable
{
+   
sealed class Runner : MarshalByRefObject
{
ManualResetEvent wait;
AutoResetEvent start_event;
-   TimerCallback callback;
+   RunnerCallback callback;
object state;
int dueTime;
int period;
bool disposed;
bool aborted;
 
-   public Runner (TimerCallback callback, object state, 
AutoResetEvent start_event)
+   public Runner (RunnerCallback callback, object state, 
AutoResetEvent start_event)
{
this.callback = callback;
this.state = state;
@@ -141,10 +146,48 @@
}
}
 
-   Runner runner;
-   AutoResetEvent start_event;
-   Thread t;
+internal struct TimerObject
+ {
+internal TimerCallback timerCallback;
+internal object state;
+internal int dueTime;
+internal int period;
+internal DateTime lastSignalledTime;
+internal int uniqueid; //timer hashcode (of the 
mytimer class)
+   
 
+   
 
+   
 
+public TimerObject(TimerCallback timercallback, object 
state, int dueTime, int period, int id)
+{
+   
 
+this.timerCallback = timercallback;
+this.state = state;
+this.dueTime = dueTime;
+this.period = period;
+this.uniqueid = id;
+this.lastSignalledTime = DateTime.Now; // we 
are storing now, even   
   
+   // 
though we have never signalled this :)
+}
+   
 
+}
 
+
+
+   private static Mutex mut = new Mutex();
+private static ArrayList timers = null;
+private bool initialized = false;
+private static bool triggeredOnce = false;
+private int minDueTime = 0;
+private int minPeriod = 0;
+private int minDueTimeUniqueid;
+private int minPeriodUniqueid;
+private AutoResetEvent start_event  ;
+private Runner runner;
+private Thread t;
+
+
+
+
public Timer (TimerCallback callback, object state, int 
dueTime, int period)
{
if (dueTime  -1)
@@ -153,7 +196,11 @@
if (period  -1)
throw new ArgumentOutOfRangeException 
(period);
 
-   Init (callback, state, dueTime, period);
+if (initialized)
+
Add(callback,state,dueTime,period,this.GetHashCode());
+ else
+Initialize(callback,state,dueTime,period);
+
}
 
public Timer (TimerCallback callback, object state, long 
dueTime, long period)
@@ -164,7 +211,11 @@
if (period  -1)
throw new ArgumentOutOfRangeException 
(period);
 
-   Init (callback, state, (int) dueTime, (int) period);
+   if (initialized)
+
Add(callback,state,(int)dueTime,(int)period,this.GetHashCode());
+ else
+
Initialize(callback,state,(int)dueTime,(int)period);
+
}
 
public Timer (TimerCallback callback, object 

Re: [Mono-devel-list] Patch for Review - System.threading.Timerr

2005-06-14 Thread S Umadevi
Hey Ben
  I guess the indentation got off becos I was partially writing the
code on a windows box and did some copy paste stuff..
Thanks for your comments..I will look into them.

Regards
uma

 Ben Maurer [EMAIL PROTECTED] 06/14/05 9:11 PM 
Hey,

First of all, the indentation on this file got out of whack. It's half
spaces and half tabs. Can you fix it up to use tabs (as it was
before).


 + int hashCode =
this.GetHashCode(); 
 + for (int i=0;itimers.Count;i++)
 + {
 + //find my timer.
 + TimerObject timerObject =
(TimerObject)timers[i];
 + if (timerObject.uniqueid == hashCode)

Hashcodes for objects could collide (exceedingly unlikely, but
technically possible).


 static void RunnerCallback(object o)
 + {
 + mut.WaitOne();
 +
 + triggeredOnce = true;
 + for (int i=0;itimers.Count;i++)
 + {
 + TimerObject timerObject =
(TimerObject)timers[i];
 + int diff = (int)(DateTime.Now.Ticks -
timerObject.lastSignalledTime.Ticks);
 + if ( diff  timerObject.dueTime)
 + {

+   
timerObject.timerCallback(timerObject.state);
 + timerObject.lastSignalledTime =
DateTime.Now;
 + }
 + 
 + }
 + mut.ReleaseMutex();
 + }

The user's callback is called within the runtime's lock. Imagine
somebody had code that did this:

Main thread:
while (true) {
lock (myObj) {
// Create new timer
}
}

Timer callback:
lock (myObj) {
// Do something
}

The user's code would deadlock.


 +  internal struct TimerObject

I don't think this should be a struct. You are just going to end up
getting boxing. Also, we don't need value type stuff here. It should
also be renamed `TimerObject' means nothing.


 + int diff = (int)(DateTime.Now.Ticks -
timerObject.lastSignalledTime.Ticks);

How does this handle spring forward / fall back (daylight's savings
time
changes)? Also, what if the user changes their time zone (just got off
an airplane)?


 + private static Mutex mut = new Mutex();
 +private AutoResetEvent start_event  

We should avoid using mutexes and *Events. C# has more native locking
in
the Monitor class. Those two classes are really interop helpers for
the
io-layer. The c# stuff is cleaner -- for example, by doing lock (blah)
it does try...finally which means that stuff is handled in the case of
exceptions.


 +
 +  public delegate void RunnerCallback(object state);
 +

You can't add public types...


   sealed class Runner : MarshalByRefObject
   {

The new design should probably get rid of this as it is just something
from the old one. Your design seems to try to put a new layer on top
of
the old one, rather than just do a single threaded design from the
start.


 + // i am the last timer to be disposed.
 + if (t != null  t.IsAlive) 
 + {
 + if (t != Thread.CurrentThread)
 + t.Abort ();
 + t = null;

Abort is really unreliable, it can cause some nasty deadlocks. It
should
really be avoided.


I think you should try rewriting the timers to do the folloing

static void TimerLoop ()
{
while (true) {
ArrayList ar = new ArrayList ();
lock (lockObj) {
int t = GetTimeToNextEvent ()
if (t == -1)
return; // all timers are gone
// NOTE: make sure there are no races 
// between this and creating another
// event. Also may want to sleep for
// a bit to try and get another timer
// to avoid creating and destroying
// thread rapidly

Monitor.Wait (lockObj, t);

foreach (Task t in alltasks)
if (t.IsDue)
ar.Add (t);
}

foreach (Task t in ar)
t.Callback ();

ar.Clear ();
}
}

Then, every time you change allTasks, you .Pulse the monitor.

-- Ben

___

Re: [Mono-devel-list] Patch for System.Data.Common and System.Data.ProviderBase

2005-05-24 Thread S Umadevi
Hi Boris.
  Nice to see that we are trying to get the providebase completed. 
I saw Suresh's reply to the DbParameter.cs class. I guess most of the
comments hold for the DbParameterCollection.cs class also..
If we are writing up code separately and then merging them, I think we
need to be more careful. Even in the previous index redesign checkin we
had many such scenarios(Suresh's comments)  in files. But since we were
merging lot of code we didnt want to burden you guys with additionally
redoing only what is required..

In future, is it possible that mainsoft has the same code as SVN? This
way we would avoid the merge, and the problems emerging out of it..

Also in most parts of the code, you would have noticed that we stick to
guidelines or whatever is used in the file is very close the
guidelines Given that we have many people contributing to it, it is
easier to maintain the code if we leave the code style and convention 
in every file the way it is, unless it very bad..
Also note, most of the mono class libraries doesnot use the  _
convention for private variables..

Regards
Uma



 Boris Kirzner [EMAIL PROTECTED] 05/23/05 9:41 PM 
Hello all
Attached is a proposed patch for ProviderBase that implements some 
additional functionality for provider base classes. It also required me

to made a slight changes in System.Data.Common.
Additional change is adding ExcptionHelper class.

This work done towards move of Mainsoft codebase to SVN.

Please respond with your comments before this patch is committed.

Boris

-- 
Boris Kirzner
Mainsoft Corporation
http://www.mainsoft.com 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-devel-list] [Fwd: Re: Review of system.data]

2005-05-11 Thread S Umadevi
Summary of IRC discussion.

1.AbstractDataContainer and related classes - are really provider
implemenation, was later on moved to provider namespace. The code drop
that we got had it in the common namespace.
2. IsafeRecord interface - to take care of conversion. can be
implemented by any provider.
There is a mail on this from mainsoft to the mailing list. Interesting
if we can use it in the base class rather than with the provider
3. the numeric.cs - tosametype returns dbnull and in every expression
evaluation we are having a default of dbnull. is there a better way to
deal with this?
5. catching base exception lots of places , will be difficult to figure
out the exact exception if we just catch the base exception. Should try
and catch only the specific exceptions. Debugging code will be very
difficult because we will not be able to even catch code errors.
6. object obj1 = expr1.Eval (row);

if (obj1 == DBNull.Value)

return obj1;
This code is all around the place in mono.data.sqlexpression. will need
to put it in some base class /common place.
7. internal classes having public methods, we will need to change
them..
8. Array for indices
  Relocation of the elements will be costly. Even though array seems to
be a good enuf datastructure, the relocations may prove costly. Since
there can be multiple dataviews on the same datatable , we can end up
potentially doing many relocations.
9. in future we will look at removing the rowcache from the dataview
totally..since the index cache and the related classes almost serve the
same purpose.
10. synchronizing while doing relocations on the array holding the
indices. While operating from different views, it is possible that we
are relocating the indices in the array from different threads, and
hence there could be potential issues.


11. merging the code - will compile with 2.0 profile and resolve any
errors.
12. connected mode testing - will make it work with sqlclient. incase
there are bugs with sqlclient  then we fix it..
13. will make test cases nunit style. have a script that can be run on
the database for setup..

9,11 are issues, but the design seems to be flexible to accomodate any
datastructure with minimal effort, so incase any of us have a solution
we wil change it then..

Please add/modify incase I have missed anything..


Regards
uma

 Konstantin Triger [EMAIL PROTECTED] 04/27/05 6:36 PM 

Hello Uma,

I'm CCing mono-devel-list to this email, so anyone who wants to review

the code can find it at 
svn://mono.myrealbox.com/source/branches/Mainsoft.System.Data/mcs/class/System.Data

1. There are 2 efforts made in the code: design improvements related to

indices and bug fixes. Attached a brief design document of the indices

redesign (questions are welcome). Regarding the bug fixes, I will
create 
a relevant changelog.
2. The testsuite we have sent is nunit compatible. To run it, one need

to enter the System.Data/Test/System.Data.Tests.Mainsoft directory and

issue make command. After this, the following command should be
issued 
(from the System.Data root):
MONO_PATH=../../class/lib/default;;$MONO_PATH mono  --debug 
../../class/lib/default/nunit-console.exe   
/output:TestResult-Mainsoft.log 
/exclude:NotWorking,ValueAdd,CAS,InetAccess 
/xml:TestResult-Mainsoft.xml  
../../class/lib/default/System.Data.Tests.Mainsoft.dll

Currently there are 36 failures in the HEAD branch and 7 failures in
the 
Mainsoft branch.
 From the other side there are 4 regressions running the standard mono

testsuite in the Mainsoft branch.

I'm analysing all this now and will provide resolution/explanation for

each one of the above.

3. Will send later today.

Regards,
Konstantin Triger



S Umadevi wrote:

Hi 
  We see that you have checked in the code in SVN under a different
branch. You had agreed to send us the following (around 2 weeks
back)so
that the code can be reviewed effectively.
1. Design document explaining the changes and why the changes are
done.
2. Testcases that are failing and what are the testcases that pass
with
the new code. The testcases that you have sent us are the complete
set
and as I had mentioned in my previous mails, the testcases that are
new
in your set needs to be identified to us.(since many  are already
existing in nunit style)
3. Since we have implemented the indices using arrays there would be
some amount of performance degradation. In your mail, you had agreed
to
share the performance data/tests with us.. Please can you send them..

We have been spending lot of time trying to review/understand the new
code, since we will have to take it forward from here for the .net
2.0
features, the above would be very useful..

Also there have been code fixes after you had branched out, we would
need to merge them too..along with merging the testcases to nunit
style
testing


Thanks  Regards
Uma




  



-- 
Regards,
Konstantin Triger

___
Mono-devel

Re: [Mono-list] mono app receives SIGSEGV after running for 20 hours!!

2005-05-10 Thread S Umadevi
Hi Gonzalo
 Had a look at the code, There was a while true loop where the listener
callback object was getting created and the socket usage in the callback
was not correct. Once these are corrected, I guess we will not see the
issue anymore..

Regards
uma




 

 [EMAIL PROTECTED] 05/11/05 7:26 AM 
On Tue, 2005-05-10 at 18:50 +0530, Kala B wrote:
 Hi,
 I have a C# application running on mono/Suse Linux. Its basically a
 Unix Domain Socket server ( uses Mono.Posix for the socket APIs). 
The
 code runs perfectly for almost 20 hours. When there is just no
 activity ( the application is just listening and there are no
clients
 connecting to it), the application receives a SIGSEGV. It just
 receives a Segmentation fault.
 My code does not have any P/Invoke calls. 
 
 Could you please guide me as to how to go about resolving this issue?

 
 I can think of the following possibilities : 
 
 1. Memory leak in my application - but memory is completely managed
by
 the run-time, so could this be really an issue with my application?

You might still have a leak by keeping references to objects around.

 2. Some problem with Mono.Posix ( because of some P/Invoke?? ) 

mod-mono-server (xsp module in svn) does exactly that. I've never
tried
running it for 24 hours with no clients, but with clients, it works
fine.

 3. Peridically I have a thread which wakes up, checks something and
 sleeps again. It uses a mutex. Could that be some issue?

No. mod-mono-server does much more than that and no problems at all.

 
 How do I detect if it is a mono run-time/mono package issue or an
 issue with my code?
 The mono version I use is 1.0.4, but the same problem was detected
in
 mono 1.1.4 too.
 Could you please guide me?

I'd recommend using 1.1.7 instead.

-Gonzalo


___
Mono-list maillist  -  Mono-list@lists.ximian.com 
http://lists.ximian.com/mailman/listinfo/mono-list
___
Mono-list maillist  -  Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] Patch for mono-1-0 - Mono.Data

2004-11-02 Thread S Umadevi
Hi Daniel
  Please go ahead and commit it.

Thanks
uma

 T Sureshkumar [EMAIL PROTECTED] 11/02/04 11:09 AM 
patch looks ok. 

suresh.

 Daniel Morgan [EMAIL PROTECTED] 10/31/04 9:49 AM 
Lupus, Miguel, or Uma:

Can someone approve this patch please?

I ran this to get the diff:
cvs -z3 diff -uN -r mono-1-0  diff.txt

I had used this to checkout:
cvs checkout -r mono-1-0 mono mcs

Here is the ChangeLog entry:

2004-10-30  Daniel Morgan [EMAIL PROTECTED]

Retrofit changes from HEAD to mono-1-0 release

2004-10-22  Daniel Morgan [EMAIL PROTECTED]

* Mono.Data/.cvsignore
* Mono.Data/AssemblyInfo.cs
* Mono.Data/Makefile
* Mono.Data/Mono.Data.dll.sources: added files 
for build of Mono.Data.dll   
This assembly includes the ProviderFactory

* Makefile: added Mono.Data.dll to the build
* Mono.Data/app.config: added providers and 
removed obsolete providers to app settings xml file




___
Mono-list maillist  -  [EMAIL PROTECTED] 
http://lists.ximian.com/mailman/listinfo/mono-list
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


RE: [Mono-list] SqlConnection in Mac OS X

2004-08-25 Thread S Umadevi
Hi
   Can you please go ahead and commit the patch after ensuring that the
existing windows, linux testcases dont break.
 SqlClient testcases can be run using MSSqlTestBed.cs (please read the
header of this file for instructions on how to run the testcases..)

Regards
uma

 Daniel Morgan [EMAIL PROTECTED] 8/25/2004 4:09:01 AM

If your patch to SqlClient works on Mac OS X, and it does not break
anything on Windows nor Linux.  Then please go ahead and commit it.

Unless, Tim has any objections.

-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Andy Satori
Sent: Tuesday, August 24, 2004 3:05 PM
To: Jonel Rienton
Cc: [EMAIL PROTECTED] 
Subject: Re: [Mono-list] SqlConnection in Mac OS X


There is, as well as a proposed patch to Mono.Tds (which underlies 
this).  There is a ByteOrder problem with the SqlConnection.

Andy

bugzilla bugid= 62948
-
[EMAIL PROTECTED] - druware software designs http://www.druware.com On
Aug
24, 2004, at 2:50 PM, Jonel Rienton wrote:

 hi guys, I was doing some testing in the System.Data namespace in my

 mac and I got stuck to something. whenever i call the Open method of
a

 SqlConnection object, the cpu goes up high and the application just 
 sits there with no messages.

 the same code compiled in my linux box works beautifully (thanks!)

 mac box: Mac OS X Panther in a PowerBook
 linux box: RedHat 9 in an AMD 350 box

 Is there any bug open about this?

 regards,
 --j
 ___
 Mono-list maillist  -  [EMAIL PROTECTED] 
 http://lists.ximian.com/mailman/listinfo/mono-list 


___
Mono-list maillist  -  [EMAIL PROTECTED] 
http://lists.ximian.com/mailman/listinfo/mono-list 

___
Mono-list maillist  -  [EMAIL PROTECTED] 
http://lists.ximian.com/mailman/listinfo/mono-list
___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list


Re: [Mono-list] anyone got bDataAdapter.Fill Method work?

2004-07-12 Thread S Umadevi
Hi Denis/Igor
Does Test2 and Test3 below work?
Also can you send me the the database table schema ( for the table you
are querying), along with the values in the  first row.

Would also be useful if you can send the enitre stack trace of the
exception below..

Regards
Uma

 Dennis Boylan [EMAIL PROTECTED] 7/13/2004 2:52:28 AM 
I'm trying to chase this down myself.  I've got a .NET application
which
runs fine under the Microsoft runtime, but I get a:

System.Data.SqlClient.SqlException: Error converting data type nvarchar
to tinyint.

while trying to run the same application under mono.

I thought it was fill as well because the traceback looks like this:

in 0x00058 (wrapper remoting-invoke-with-check)
System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable)
in [0x00092] (at /home/dennis/Dev/new/DbLayer/Network.cs:1070)
IA.DbLayer.DBNetwork:GetDTNetwork (int)

Where GetDTNetwork is trying to fill a DataTable with the values from
a
MS SQL database on a remote machine.  It is the last part of my
application
code before it gets lost in the weeds.

I thought it might be because the table was empty, so I wrote a little
standalone app to test it.  The standalone app works.

My first test was trying it without using my stored procedure.  It was
called test2.  The second uses a stored procedure like the application
normally does.  It was called test3.

These were my best approximations of what the code at the location was
trying to do.  The real code hides the type of database, so direct
examples
would not be all that useful.

Now, mind you, I'm trying this on the bleeding edge.
[EMAIL PROTECTED] test]$ mono -V
Mono JIT compiler version 1.0.20040712, (C) 2002-2004 Novell, Inc and
Contributors. www.go-mono.com 
TLS:   __thread
GC:Included Boehm (with typed GC)
SIGSEGV  : normal
Globalization: ICU

- Dennis

-- test2.cs --

 using System;
 using System.Data;
 using System.Data.Common;
 using System.Data.SqlClient;

 public class Test
 {
 public static void Main(string[] args)
 {
string connectionString =
  Address=hp,1434; +
  Database=Linux; +
  User ID=test; +
  Password=test;;
IDbConnection dbcon;
dbcon = new SqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string sql = SELECT Name, Parent  +
 FROM Network;
dbcmd.CommandText = sql;
DataTable dtNtwk = new DataTable(Network);
DbDataAdapter dbAdptr = new SqlDataAdapter((SqlCommand)dbcmd);
int iRows = dbAdptr.Fill(dtNtwk);
Console.WriteLine (Returned  + iRows +  rows);
dbcon.Close();
dbcon = null;
}
}

-- test3.cs --
 using System;
 using System.Data;
 using System.Data.Common;
 using System.Data.SqlClient;

 public class Test
 {
 public static void Main(string[] args)
 {
string connectionString =
  Address=hp,1434; +
  Database=Linux; +
  User ID=test; +
  Password=test;;
IDbConnection dbcon;
dbcon = new SqlConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = new SqlCommand(GetNtwkNEType,
(SqlConnection)dbcon);
dbcmd.CommandType = CommandType.StoredProcedure;
IDataParameter param =
((SqlCommand)dbcmd).Parameters.Add(@AddrType, SqlDbType.TinyInt);
param.Direction = ParameterDirection.Input;
param.Value = 0;
DataTable dtNtwk = new DataTable(Network);
DbDataAdapter dbAdptr = new SqlDataAdapter((SqlCommand)dbcmd);
int iRows = dbAdptr.Fill(dtNtwk);
Console.WriteLine (Returned  + iRows +  rows);
dbcon.Close();
dbcon = null;
}
}


On Mon, Jul 12, 2004 at 08:40:05PM +0300, Igor Georgiev wrote:
 anyone got DbDataAdapter.Fill Method work?
 I need to deploy working .NET web application to apache/xsp/mono,
 but unfortunately i always get an empty dataset :((
 
 ExecuteScalar  ExecuteReader works for me,  so as a last resort
 i'll rewrite the data access components to fill dataset by hand :(((
 
 
 I think it's a bug so i submit a report,
 but i'm very intersted does anyone get it work?
 If yes pls notify me urgent because i have a deadline to do the work
.
 
 - here is the copy of my bug report 
 odbcDataAdapter.Fill(DataSet) doesn't work for me
 
 Steps to reproduce the problem:
 1. create odbcDataAdapter that select something from database
 2. generate named/typed dataset /i'm using VS2003.NET /
 3. fill dataset
 
 Actual Results:
 dataset is empty
 
 Expected Results:
 Data in the dataset
 
 How often does this happen? 
 Always
 
 Additional Information:
 Code work fine in .NET framework
 -
 also i try public int Fill( DataTable dataTable); - same result :(((
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.718 / Virus 

[Mono-list] Clear in ConstraintCollection and KeyRestrictions in DbDataPermissionAttribute

2004-03-11 Thread S Umadevi
Hi
  I need help /thoughts on implementing the above.

1. KeyRestriction in DbDataPermissionAttribute : The MSDN Documentation
says.

Value
One or more connection string parameters that are allowed or
disallowed.
Remarks
Connection string parameters are identified in the form parameter
name=. Multiple parameters can be specified, delimited using a
semi-colon (;). The connection string parameters listed may be
identified as either the only additional parameters allowed or
additional parameters that are not allowed using the
KeyRestrictionBehavior property.

If no key restrictions are specified, and the KeyRestrictionBehavior
property is set to AllowOnly, then no additional connection string
parameters are allowed.

If no key restrictions are specified, and the KeyRestrictionBehavior
property is set to PreventUsage, then additional connection string
parameters are allowed. If more than one rule is set for the same
connection string, the more restrictive rule is selected during the
permission check.

When are these restrictions applied to the connection string for
additional parameters ?. Since the connectionstring is a string how do
we enforce  any additional parameters to it?  Or is that we dont want to
allow additional agruements?


Incase there are any examples of this usage please let me know..

2. Clear method  in ConstraintCollection :
The code has the following comment
//LAMESPEC: MSFT implementation allows this
 //even when a ForeignKeyConstraint exist for a UniqueConstraint
 //thus violating the CanRemove logic
But the MSDN documentation asks the user to check using  CanRemove. Now
if we go by the assumption that the user will first check and then
remove using clear method it seems to be fine..  But if we want to
change this to check and remove only if there is no foreignkeyconstraint
then, how do we indicate to the user that the clear didnt succeed ? The
method does not throw any exception or return any value..

Hence I feel we can stay with the existing implemenation.. Any other
thoughts ?


regards
uma





___
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list