Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #1444 > unrolled thread

Is it Faster to check first ?

Started by"richard.townsendrose" <richard.townsendrose@gmail.com>
First post2011-06-19 04:51 -0700
Last post2011-06-30 01:39 -0700
Articles 10 — 5 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Is it Faster to check first ? "richard.townsendrose" <richard.townsendrose@gmail.com> - 2011-06-19 04:51 -0700
    Re: Is it Faster to check first ? "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-06-20 02:00 +1000
    Re: Is it Faster to check first ? "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-06-20 22:15 +0000
      Re: Is it Faster to check first ? "richard.townsendrose" <richard.townsendrose@gmail.com> - 2011-06-21 02:31 -0700
        Re: Is it Faster to check first ? "Willie Moore" <williem@wmconsulting.com> - 2011-06-21 07:21 -0500
        Re: Is it Faster to check first ? "Stephen Quinn" <stevejqNO@bigpondSPAM.net.au> - 2011-06-21 23:47 +1000
          Re: Is it Faster to check first ? "richard.townsendrose" <richard.townsendrose@gmail.com> - 2011-06-22 02:36 -0700
        Re: Is it Faster to check first ? "Geoff Schaller" <geoffx@softwarexobjectives.com.au> - 2011-06-22 22:26 +0000
          Re: Is it Faster to check first ? Mike Pitcher <mike_no_spam_please_@pamuk.demon.co.uk> - 2011-06-23 08:54 -0700
            Re: Is it Faster to check first ? "richard.townsendrose" <richard.townsendrose@gmail.com> - 2011-06-30 01:39 -0700

#1444 — Is it Faster to check first ?

From"richard.townsendrose" <richard.townsendrose@gmail.com>
Date2011-06-19 04:51 -0700
SubjectIs it Faster to check first ?
Message-ID<bfac7000-4dee-4585-b7c9-bacc882538b6@g12g2000yqd.googlegroups.com>
hi

is it faster to see if the InUse record flag is set ... 9999 out of a
10000 times it will already be set.

FUNCTION V4MarkGroup(oLockedADServer, cGroupRef) AS LOGIC STRICT
	LOCAL lOk := FALSE AS LOGIC
	LOCAL dwAtRec AS DWORD

	dwAtRec:=oLockedADServer:Recno
		IF oLockedADServer:Seek(PadR(cGroupRef,8))
			IF oLockedADServer:FIELDGET(#INUSE)           // rgtr 190611
<<<<<<<<<<<<<<<
				oLockedADServer:FIELDPUT(#INUSE,TRUE)     // rgrr 070501
				oLockedADServer:Commit()
    		              ENDIF
    	                            lOk:=TRUE
	              ENDIF
	oLockedADServer:Goto(dwAtRec)

RETURN lOk

regards

richard

[toc] | [next] | [standalone]


#1446

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-06-20 02:00 +1000
Message-ID<S6pLp.6999$CS3.5224@viwinnwfe01.internal.bigpond.com>
In reply to#1444
Richard

I see no point in the code though
    - why test for TRUE and then write TRUE in the field??
    - can it ever be FALSE??

Your don't seem to be going to do anything with whatever record your looking 
up as you put the record pointer back to the record where you started from 
no matter what the #INUSE setting is.

CYA
Steve 

[toc] | [prev] | [next] | [standalone]


#1461

From"Geoff Schaller" <geoffx@softwarexobjectives.com.au>
Date2011-06-20 22:15 +0000
Message-ID<4dffc689$0$57114$c30e37c6@exi-reader.telstra.net>
In reply to#1444
Richard,

LOCAL lOk := FALSE AS Logic
...is utterly redundant

LOCAL lOK AS LOGIC
...is all you need. It is false by default

Now to your question. Unfortunately your question is also redundant 
because you should be creating an index with a condition. The seek side 
is irrelevant. Set a condition based on the logic flag and you're done. 
And like Steve says, why set something you've found!

Geoff



"richard.townsendrose" <richard.townsendrose@gmail.com> wrote in message 
news:bfac7000-4dee-4585-b7c9-bacc882538b6@g12g2000yqd.googlegroups.com:

> hi
>
> is it faster to see if the InUse record flag is set ... 9999 out of a
> 10000 times it will already be set.
>
> FUNCTION V4MarkGroup(oLockedADServer, cGroupRef) AS LOGIC STRICT
> LOCAL lOk := FALSE AS LOGIC
> LOCAL dwAtRec AS DWORD
>
> dwAtRec:=oLockedADServer:Recno
> IF oLockedADServer:Seek(PadR(cGroupRef,8))
> IF oLockedADServer:FIELDGET(#INUSE)           // rgtr 190611
> <<<<<<<<<<<<<<<
> oLockedADServer:FIELDPUT(#INUSE,TRUE)     // rgrr 070501
> oLockedADServer:Commit()
>                    ENDIF
>                                  lOk:=TRUE
>               ENDIF
> oLockedADServer:Goto(dwAtRec)
>
> RETURN lOk
>
> regards
>
> richard

[toc] | [prev] | [next] | [standalone]


#1466

From"richard.townsendrose" <richard.townsendrose@gmail.com>
Date2011-06-21 02:31 -0700
Message-ID<cb68c2a1-2f55-4c05-b7b1-f05c6fbd75c8@f7g2000yqf.googlegroups.com>
In reply to#1461
Guys

In each of our tables defining people, jobs, groups, subjects, etc we
have a flag defining whether that entity has been referenced
elsewhere, and thus to retain referential integrity MUST not be
deleted.

So we have an "InUse" flag.

This means that whenever say a letter is written then must mark the
sender, receiver, job, subject, group etc as being used to prevent it
being deleted elsewhere by another user. we allow deletion and display
the status so users can see whats what. aty the start of a job, very
often several hundred likely people are added to the database, but as
the job progress's many of these are removed. hence the need for a
deletion utility, and that needs an "In Use" flag. indeed when a
database is setup, an option exists to import a previous projects
names [e.g. previously used sub-contractors etc], groups [viz standard
work packages etc], and subjects [viz standard filing system].

However, I like the idea of a conditional "Unused" index. it would be
a very small overhead for a compound index.

I must stress that we have never had any save speed complaints, but
now that we have a user running over a "slow connection" viz using the
web to connect we are looking at anything that might speed things up.

so the question is whether its quicker to test for whether the flag is
set, or just bash it in regardless.
to combine both validity and setting at the same time would be good.
it CAN happen that one  user deletes a person just as another start to
save it - so the validity checks then get invalidated - we had it once
on a hospital project some years ago.

what does everyone else do to preserve relational integrity ?

richard

[toc] | [prev] | [next] | [standalone]


#1468

From"Willie Moore" <williem@wmconsulting.com>
Date2011-06-21 07:21 -0500
Message-ID<itq2d3$rv1$1@speranza.aioe.org>
In reply to#1466
Richard,

I use SQL server. I define my schema and SQL server enforces the referential 
integrity.

Regards,
Willie

"richard.townsendrose"  wrote in message 
news:cb68c2a1-2f55-4c05-b7b1-f05c6fbd75c8@f7g2000yqf.googlegroups.com...

Guys

In each of our tables defining people, jobs, groups, subjects, etc we
have a flag defining whether that entity has been referenced
elsewhere, and thus to retain referential integrity MUST not be
deleted.

So we have an "InUse" flag.

This means that whenever say a letter is written then must mark the
sender, receiver, job, subject, group etc as being used to prevent it
being deleted elsewhere by another user. we allow deletion and display
the status so users can see whats what. aty the start of a job, very
often several hundred likely people are added to the database, but as
the job progress's many of these are removed. hence the need for a
deletion utility, and that needs an "In Use" flag. indeed when a
database is setup, an option exists to import a previous projects
names [e.g. previously used sub-contractors etc], groups [viz standard
work packages etc], and subjects [viz standard filing system].

However, I like the idea of a conditional "Unused" index. it would be
a very small overhead for a compound index.

I must stress that we have never had any save speed complaints, but
now that we have a user running over a "slow connection" viz using the
web to connect we are looking at anything that might speed things up.

so the question is whether its quicker to test for whether the flag is
set, or just bash it in regardless.
to combine both validity and setting at the same time would be good.
it CAN happen that one  user deletes a person just as another start to
save it - so the validity checks then get invalidated - we had it once
on a hospital project some years ago.

what does everyone else do to preserve relational integrity ?

richard 

[toc] | [prev] | [next] | [standalone]


#1471

From"Stephen Quinn" <stevejqNO@bigpondSPAM.net.au>
Date2011-06-21 23:47 +1000
Message-ID<Ah1Mp.7079$aH5.2160@viwinnwfe02.internal.bigpond.com>
In reply to#1466
Richard

If your going to write regardless - then don't test.

CYA
Steve 

[toc] | [prev] | [next] | [standalone]


#1489

From"richard.townsendrose" <richard.townsendrose@gmail.com>
Date2011-06-22 02:36 -0700
Message-ID<28e45723-594e-4557-ac8c-549efb6f9a61@l6g2000vbn.googlegroups.com>
In reply to#1471
Willie

Problem is when one is using ADS Local there is no ability to set the
rules.

Steve

agreed ... have done some tests, and it is just as quick simply to do
the write

Richard

[toc] | [prev] | [next] | [standalone]


#1509

From"Geoff Schaller" <geoffx@softwarexobjectives.com.au>
Date2011-06-22 22:26 +0000
Message-ID<4e026c20$0$57116$c30e37c6@exi-reader.telstra.net>
In reply to#1466
Of course if you migrated yourself to MS SQL Server you can have 
automatic referential integrity. No need to maintain such status flags 
and no possibility of accidental deletion.

Geoff



"richard.townsendrose" <richard.townsendrose@gmail.com> wrote in message 
news:cb68c2a1-2f55-4c05-b7b1-f05c6fbd75c8@f7g2000yqf.googlegroups.com:

> Guys
>
> In each of our tables defining people, jobs, groups, subjects, etc we
> have a flag defining whether that entity has been referenced
> elsewhere, and thus to retain referential integrity MUST not be
> deleted.
>
> So we have an "InUse" flag.

[toc] | [prev] | [next] | [standalone]


#1521

FromMike Pitcher <mike_no_spam_please_@pamuk.demon.co.uk>
Date2011-06-23 08:54 -0700
Message-ID<68e9beb1-b4b7-4cb0-b0bd-e84a29982742@v11g2000prk.googlegroups.com>
In reply to#1509
Richard ... I agree with Geoff and Willie. The work that you can get
SQL Server to do for you "under the covers" is awesome. Add to that
the abstraction possible with Entity Framework and Code First and
you'll wonder why you ever bothered with anything else.

Mike Pitcher

On Jun 22, 11:26 pm, "Geoff Schaller"
<geo...@softwarexobjectives.com.au> wrote:
> Of course if you migrated yourself to MS SQL Server you can have
> automatic referential integrity. No need to maintain such status flags
> and no possibility of accidental deletion.
>
> Geoff
>
> "richard.townsendrose" <richard.townsendr...@gmail.com> wrote in message
>
> news:cb68c2a1-2f55-4c05-b7b1-f05c6fbd75c8@f7g2000yqf.googlegroups.com:
>
>
>
> > Guys
>
> > In each of our tables defining people, jobs, groups, subjects, etc we
> > have a flag defining whether that entity has been referenced
> > elsewhere, and thus to retain referential integrity MUST not be
> > deleted.
>
> > So we have an "InUse" flag.- Hide quoted text -
>
> - Show quoted text -

[toc] | [prev] | [next] | [standalone]


#1572

From"richard.townsendrose" <richard.townsendrose@gmail.com>
Date2011-06-30 01:39 -0700
Message-ID<3407ebac-cd53-4a6c-9225-abb85e3bff18@v11g2000prn.googlegroups.com>
In reply to#1521
Mike

I dont disagree ..

Its just that with ADS Local which all but three of TDOC users use you
cannot. and setting up sql server to run on the same pc as tdoc which
in all but one case is XP - and some times even SP2 makes a different
requirement to meet.

TDOC is generally sold to very small firms these days.

I am in fact, as I approach retirement, considering to make it
available free - charging only for support ... and thats if they want
it. we have loads of old [ballast wiltshire, laing, and balfour
beatty] dongles floating around which people still use ... small firms
of one man band project managers ... mostly using tdoc ver 4  .... ver
5 needs a special code out into the dongles.

richard

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web