Dave - who is this Peter who suggested SQL Insert? I didn't see a Peter in
this Thread! Unless, of course, the thread petered out...

:-)
-K-

-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Dave
Crozier
Sent: Friday, February 22, 2013 11:00 AM

The only successful way to use "append blank" is to immediately add in the
Primary Key and write it back, thus forcing the record to flush to disk (you
can use the flush) command for this to force a write even though it isn't
compulsory, personally I do a goto recno() which forces the write to disk. 

After that you can do as many replaces as you want without problem.

Append blank sets a lock on the file header and "sometimes" this isn't
respected by others if the lock is held for a long time and it has bitten me
in all versions of VFP since V6 in various degrees of severity, normally
when lots of people are doing the same "append" process.

I do agree with Peter though, the "SQL Insert into" I have never known to
fail.

Dave


-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Jeff Johnson
Sent: 22 February 2013 15:40
To: [email protected]
Subject: Re: Weird Problem Adding Records to a Table

The code isn't really too bad.  The programmers son did the code I sent you.
They also went from a physical server to a virtual server at about this
time.  So it really points to timing.  Is there any chance that gathering
memo fields with slashes in them could be even a tiny bit slower than memo
fields without them?


Jeff

---------------

Jeff Johnson
[email protected]
(623) 582-0323

www.san-dc.com
www.arelationshipmanager.com

On 02/22/2013 08:16 AM, Kurt wrote:
> Hey Jeff: Jeff, was that a Stutter?   :-)
>
> Bummer to have to take over a system that's got some Nasty Arse 
> Convoluted CODING! Dang...
>
> Maybe use the Code References tool to search all Code/Project for a "/"
> going into a Memo field. Just a thought. Seems like it would have to 
> get programmed in.
>
> -K-
>
> -----Original Message-----
> From: ProfoxTech [mailto:[email protected]] On Behalf Of 
> Jeff Johnson
> Sent: Friday, February 22, 2013 9:59 AM To:[email protected]
> Subject: Re: Weird Problem Adding Records to a Table
>
> Kurt:  Kurt, that is correct I did not write this application but I 
> was called in to figure out what is happening and fix it.  The 
> developers are long gone and the system works great for them except for
this problem.
>
> I noticed just prior to the start of this they were having a 
> uniqueness problem with their invoice numbers.  They wrote a program 
> to correct this.  They executed this code on the order table:
>
> <code>
>       WAIT WINDOW "Updating ... please wait" NOWAIT
>       * Save all entries except the PK field
>       SET SAFETY OFF
>       * COPY FIELDS EXCEPT invoice TO tmporders
>       DELETE TAG ALL
>       * "this is me talking" tmporders has the same structure with the 
> order number removed.  Yikes!
>       COPY TO TMPORDERS
>       ZAP
>       APPEND FROM tmporders
>       ON ERROR WAIT WINDOW NOWAIT "Finishing up .."
>       DO index_table
>       * "me again" I did not know that adding a primary key would 
> generate unique keys.  But I would never do anything like this anyway.
>       ALTER TABLE order ADD PRIMARY KEY invoice TAG invoice
>       ON ERROR
>       MESSAGEBOX('All Key fields are now UNIQUE!',0+64,'Finished') 
> </code>
>
> When I look at the file now the invoice field is no longer a primary 
> key field.  The table has 125,000 records and the application is 
> running on a virtual server.  I would think that appending a record 
> and then gathering it in this environment - especially with every 
> field indexed - would be a problem.
>
> It does seem to happen during periods of high traffic.  But that is an 
> observation only.  Some days there are 50 or 60 right in a row and 
> other days there are none.
>
> There seems to be a solid correlation between a "/" in one of the memo 
> fields and this problem.  You can find a record that was created with 
> a "/" in the memo field and it will start generating phantom records 
> until a good order is saved.  Then it stops.  That is my next test.  Find
"/"
> in memo fields and see if it is followed by phantom orders.
>
> I know...  You think you've seen it all until the next time.
>
> TIA
>
>
>
> Jeff
>
> ---------------
>
> Jeff Johnson
> [email protected]
> (623) 582-0323
>
> www.san-dc.com
> www.arelationshipmanager.com
>
>
> On 02/22/2013 07:33 AM, Kurt wrote:
>> Jeff - from you desc. Below when you mentioned: "...only thing that I
> found
>> that is unusual is that the order table was indexed on every 
>> field..." - makes it sound to me like you have a System you now 
>> support - but, that
> you
>> didn't build. Am I right?
>>
>> Also - I'm curious about something. You mentioned the problem started 
>> last June - and you now have 100 users. Was there a bust in Co. 
>> growth last
> year
>> - prior to that June creation of Blank orders??? I suspect that this 
>> MAY
> be
>> the case - and that Increase of Users MAY have initiated the problem 
>> -
> users
>> fighting over records. Its as though there is a problem with your 
>> system
> in
>> adding the new orders - that one user adds a blank record - but, then
> maybe
>> the system tries to lock it - and can't - since maybe another user 
>> conflicted on the lock. Something strange like that.
>>
>> My suggestion - KILL that Append/Gather - and replace that code with 
>> an
> SQL
>> Insert! Its what I have done in the past in some problem areas of 
>> systems
> -
>> and its done Wonders!!!
>>
>> HTH,
>> -K-
>>
>> -----Original Message-----
>> From: ProfoxTech [mailto:[email protected]] On Behalf Of 
>> Jeff Johnson
>> Sent: Friday, February 22, 2013 9:21 AM To:[email protected]
>> Subject: Weird Problem Adding Records to a Table
>>
>> I have a very strange problem.  It is an application that uses append 
>> and gather.  June of last year their system started creating orders 
>> with blank information in them.  Mainly dispatcher.  They call them 
>> phantom orders.  There is no rhyme or reason for them to appear, but 
>> 40% of their overall orders since then.  They wrote a routine to zero 
>> out the numbers and delete them but it is annoying because they show 
>> up and then the purge routine removes them and the users see this.  
>> There are about
>> 100 users.
>>
>> The only thing that I found that is unusual is that the order table 
>> was indexed on every field with the invoice field descending.  Could 
>> this cause problems when adding new records?
>>
>> Thanks in advance,
>>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/B19F8DF7AFE742059E7FE7B95A07E31A@Programming2
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to