[V4MD] pointer at the same table by binary_link
Ruslan Zasukhin
sunshine at public.kherson.ua
Sat Sep 17 12:06:43 CDT 2005
On 9/16/05 9:50 PM, "Sims, John" <ayu8 at cdc.gov> wrote:
Hi John
> Hi Ruslan,
>
> I do understand your point, but I believe we are talking about Mantis
> item #754? I thought we had resolved this before. I guess I just don't
> consider the process of trying to link 2 records that are already linked
> as an "error" as long as Valentina isn't creating duplicate links. To
> examine further, let me take your examples...
John, Ivan already have correct engine + all plugins to this behavior:
* LinkRecordsd -- returns nothing
* it can throw 2 errors:
- Records already linked
- Record not found (if you try link not existed record of table).
We have discuss this here and we believe this is CORRECT behavior and this
provide consistency with all our other methods.
> On some OS's, I can open the same document more than once. The problems
> that will occur will happen if I try to modify the document in one open
> copy while the other is still open.
This is not good example I think.
You talk here about USER - level behavior.
I have give you example of OS API behavior (low level).
> This, of course, could cause
> corruption. In the case of Links, I don't see where Valentina ignoring
> a request to link 2 records that are already linked or unlinking 2
> records that were never linked would cause any issues like this.
Look. In the version 1 of Valentina all my C++ classes e.g. FileOs
Did allow open already opened file, for example. Or Close already closed.
This did work...
When we have develop v2, I have decide go by OS way -- be strict.
And can you image?! I have start found many logical mistakes in my v1 code.
So again and again:
if you try link already linked records -- you have NOT accurate code!
> As for 2 people getting married, people renew their vows all of the
> time. It doesn't matter to anyone that they are already married. No
> one throws up a red flag saying "wait a minute, you're already married".
> :-)
I believe this is not true :-)
Does in USA government give document to married people?
I do not think government will give you second document,
as well as second passport.
> As for...
>
> try
> If myLink.LinkExists(a,b) Then
> msgBox("Link Exists")
> Else
> myLink.LinkRecords(a,b)
> End if
> catch
> ...
> End
>
> This makes perfect sense, of course, but if I'm checking to see that the
> link exists first, I should never get the error you are talking about
> raising.
Right, although note: exists second possible error:
"Record Not exists"
You can be careful and make sure this also not happens,
Then note, you still can get some NOT-EXPECTED exception, e.g.
"Index corrupted"...
May be future in multi-user environment will be added some more errors.
Who know.
Important point is:
above code with try-catch it safe ALWAYS and for FUTURE !!!
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> So, now I have added 4+ lines of code that are really
> un-needed. Unless there is some more serious error, the above code
> and...
>
> If myLink.LinkExists(a,b) Then
> msgBox("Link Exists")
> Else
> myLink.LinkRecords(a,b)
> End if
>
> Would be equivalent.
Then let me remind you one more rule how exceptions work.
You do not want here try-catch. Great! No problems,
Important is that you have try-catch on some TOP function,
So IF e.g. Index corruption thrown, you still catch this and workout
somehow.
> Now, if we consider my personal viewpoint of "if the records are already
> linked, great!!! We have accomplished our task, let's move on" then my 1
> line of code...
>
> myLink.LinkRecords(a,b)
>
> Becomes 3 lines of code...
>
> If myLink.LinkExists(a,b) = False then
> myLink.LinkRecords(a,b)
> End if
>
> To protect against an exception being raised.
>
> Shoot, I read through all of this and I just sound like a big whiner. I
> hate when that happens. Sorry. I can/will certainly work within
> whichever decision you make regarding this matter. I just wanted to
> share my viewpoint.
Truth is born in discussion!
So this is good!
We self start better understand issue after such discussions! :-)
> Thanks, as always, for listening to us!
Finally.
I think in most case you can write code as
Func()
If myLink.LinkExists(a,b) = False then
myLink.LinkRecords(a,b)
End if
end
This will work in 99.9% of cases
Only I worry about unexpected failures.
You can have top function
App.open
Func()
On exception
... // catch here everything, so app not crashes
end
Then you are safe from crash of app.
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list