Jiri Cincura wrote:
> 
>> One more little question, also about this Exceptions. What do you think
>> about throwing localized messages? (I mean storing once (new
>> DBConcurrencyException()).Message, (new DataException()).Message and so
>> on
>> somewhere in local dictionary, and using them instead of English string
>> variables? IMHO it might be useful when you have
> 
> Why? Exception text should be help for developer. The error message
> for user shoudl be handled on application side.
> 
Of course, you are right but: imagine that i have ContinueUpdateOnError =
true, and update 5 rows. 2 of them ok, 2 fail because of concurrency
problem, 1 failed because of pk constraint (it's imaginable testcase just
for understanding). I get no exception, but i know that 3 rows have errors
(HasErrors=true, RowError has some text, but for now only english one). The
problem is, i don't know exactly, which error do i have. But different
errors should be handled differently. If there are only concurrency errors,
i can show dialog for solving a conflict, if other errors - do something
else. And now i would like to know what kind of Exceptions i would have got
if i had ContinueUpdateOnError=false. For this purpose i have only
Row.RowError text, i could match it against (new
DBConcurrencyException()).Message, or some other DataException to know, what
error i have. But it won't work, because in german version of windows (or
whatever) i would get "DB-Paralelitätverletzung" message, that doesn't 
coincide with your "An attempt to execute an INSERT, UPDATE, or DELETE
statement resulted in zero records affected." Of course i can match against
your message and hope, that it never will be changed :). Of course it is not
so important, just for your consideration. Giving localized messages
wouldn't be so bad idea anyway, how do you think? 



Jiri Cincura wrote:
> 
>> DbDataAdapter.ContinueOnError set to true, you get Rows with RowError
>> texts,
>> but you cannot find out then, which exception this row raises. And one
>> more
>> :) (the last question) about it. If you have this
>> DbDataAdapter.ContinueOnError = true, and the row has an error, is it
>> defined by standard, that row should call AcceptChanges anyway, again
>> IMHO
>> it might be useful that erroneous rows preserve their RowVersions, so
>> that
>> the user can repeat action after error correction . If AcceptChanges is
>> called, i don't know anymore, if a row was meant to be
>> updated/inserted/deleted and cannot repeat operation.
> 
> Where did you find this?
> So, if I understand this, if we have ContinueOnError = true and we're
> throwing DBConcurrencyException, we should call AcceptChanges *and*
> preserve RowState?
> 
No Jiri, i mean, when we have ContinueOnError = true , and if we throw any
exception or not, doesn't matter, we should call AcceptChanges (of course if
AcceptChangesDuringUpdate = true) only for those rows, that have no error.
As i said, imagine you have ContinueOnError=true and 2 rows violate
concurrency condition, after calling Update you will know, that 2 rows have
errors (they will have HasError=true) but you won't be able to let the user
correct situation, because you don't know anymore, where those 2 rows
supposed to be updated or deleted when they caused concurrency violation -
cause they have RowVersion = Unchanged...Actually when i think about it...it
is not big problem either, because concurrency exception is important only
for updates (where user can insist on own changes or refresh own data with
changes committed to database before him). If you get concurrency exception
on delete statement you cannot do anything anymore (but may be you can :) )
. Anyway, i think it might be useful to have the rowversion preserved for
erroneous rows, what the point of calling acceptchanges for rows that have
errors and won't be committed in present state to database? What i'm talkin
about actually this line of code

if (this.AcceptChangesDuringUpdate)
{
     row.AcceptChanges();
}

i personally would prefer to have 

if (!row.HasErrors && this.AcceptChangesDuringUpdate)
{
     row.AcceptChanges();
}

But i'm not so skilled and experienced as you are, that's why i ask what do
you think about this damn concurrency :)


P.S. Jiri, can you tell me, why do i get 
Error: PROPFIND request failed on '/viewvc/firebird/NETProvider/trunk'  
Error: PROPFIND of '/viewvc/firebird/NETProvider/trunk': 301 Moved
Permanently (http://firebird.svn.sourceforge.net)  
every time i try to check out from
http://firebird.svn.sourceforge.net/viewvc/firebird/NETProvider/trunk/. i
tried it from several places (with or without proxy) - hopeless :(


-- 
View this message in context: 
http://www.nabble.com/DBConcurrencyException-tf4731950.html#a13543515
Sent from the firebird-net-provider mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to