FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Append Blank question
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Append Blank question
Posted: Mon Oct 27, 2008 08:46 PM

I have a client with a large volume of new records daily. We are starting to have problems where a newly appended record is disappearing. What is the best way to handle append blank in a network environment. Currently, we have been using the sample below without a problem, but my client may have many instances where users are requesting APPEND BLANK at the same time.

SELECT tools
APPEND BLANK

Thank you in advance for your assistance.

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Append Blank question
Posted: Mon Oct 27, 2008 09:09 PM

cdmmaui

There are two things you can do :

1) dbCommit()
2) GoTo recno()

dbCommit is supposed to do a 'hard disk' write .. however it is un-acceptibly slow if you are appending lots of records in a loop.. If you are just adding one record at a time dbCommit is your answer. If you are appending lots of records in a loop .. I use GoTo Recno() after you append the last field .. then at the end of the loop .. a dbCommit()

Rick Lipkin

Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Append Blank question
Posted: Mon Oct 27, 2008 09:14 PM

Hi Rick,

Thank You

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com
Posts: 312
Joined: Sat Oct 08, 2005 09:12 AM
Append Blank question
Posted: Tue Oct 28, 2008 09:20 AM
cdmmaui,

in a network environment it is dangerous not to check for neterr().
Here a module i use for append in networks.

example:

#define WAIT_SECONDS 2

   if lNetAddRec( "tools" )
      ? "New record was appended."
   else
      ? "Network error! No record appended."
   endif


/////////////////////////////
FUNCTION lNetAddRec( cAlias )
/////////////////////////////


   do while .t.
      if lAddRec( WAIT_SECONDS, cAlias )
         RETURN .t.
      endif

      if alert ( "Could not append a new record.;", { "Try again", "Cancel" } ) != 1
         RETURN .f. 
      endif
   enddo
RETURN .f. 

////////////////////////////////////
FUNCTION lAddRec( nSeconds, cAlias )
////////////////////////////////////


     do while nSeconds > 0 
        ( cAlias )->( dbAppend() )
   
        if !neterr()
           RETURN  .t.
        endif
        
        inkey( .5 )

        nSeconds -= 0.5
	 enddo
RETURN .f.

IMPORTANT: you must unlock the new record when you are ready editing it: tools->( dbUnLock() )

Maybe this could help you.

Regards,
Detlef
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Append Blank question
Posted: Tue Oct 28, 2008 06:44 PM

Darrell

You may also want to take a look at these articles. This info is from my notes and I didn't check to see if the links are still valid.

Regards,
James


4/27/2005 7:08 AM

Windows' Oppontunistic Locking

Is well described at:

http://www.dataaccess.com/whitepapers/o ... ching.html

There are some programs for testing network op locking and for updating the registry here:

http://drouillard.ca/TipsTricks/Samba/Oplocks.html

&
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 708
Joined: Fri Oct 28, 2005 09:53 AM
Append Blank question
Posted: Wed Oct 29, 2008 01:47 AM

Thank You for the information

*~*~*~*~*~*~*~*~*~*
Darrell Ortiz
CDM Software Solutions, Inc.
https://www.cdmsoft.com

Continue the discussion