🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.vdbase.data.sql
Article #1013

Flush() Doesn't

#1013
From: Jason Ortner
Date: Fri, 29 May 1998 00:00
279 lines
10559 bytes
I have the following code to write a record to disk.  I then want to
query the table and check to see if the same "Team" has been
previously entered, either in the same order or the reverse order.  A
team can only enter once.

All works well as long as you enter the team in the same order but if
you enter a team in the reverse order ie: heeler where the header is
and the header where the heeler is,  it will not find the match.  I
have watch this on the debugger and it appears the team it is checking
for is not being picked up by the cnt query.  I can't tell if this is
because the info. has not been written to disk by the time the query
looks at the table of what.  I have used flush() to force a disk write
in an effort to have the info. available to the query to no avail.
This is a major stumbling block in the completion of this project.  If
I can't get this figured out I am stuck.  One other thing, as a point
of interest, the query in the ckteams2 function will never change
indexnames as far as I can tell.  It will never find the heelln on a
findkey().  Heelln is a valid tag for the file.

I have spent two days on this problem and got no where.  Any and all
help will be gratefully appreciated.


 function PICKLISTLB2_onLeftDblClick(flags, col, row)
   LOCAL wn,lne,ln,fne,fn,rate,lwn,rate
   wn = form.picklistlb2.value
   lwn = len(wn)
   lne = at(',',wn)
   ln = left(wn,lne - 1)
   fne = rat('-',wn) - 3
   fn = substr(wn,(lne + 1),(lwn - fne))
   fn = substr(wn,lne + 1,fne - (lne - 1))
   rate = right(wn,4)

   if _app.head = true
      _app.ropeq1.fields['headfn'].value = fn
      _app.ropeq1.fields['headln'].value = ln
      _app.ropeq1.fields['hdrateing'].value = rate


         if (not empty(_app.ropeq1.fields['headln'].value)) and ;
            (not empty(_app.ropeq1.fields['heelln'].value))

               hdfn = _app.ropeq1.fields['headfn'].value
               hdln = _app.ropeq1.fields['headln'].value
               hefn = _app.ropeq1.fields['heelfn'].value
               heln = _app.ropeq1.fields['heelln'].value
               _app.ropeq1.flush()
               sp = ckhdrhlr(hdfn,hdln,hefn,heln)

                  if sp = true
                     _app.ropeq1.fields['headfn'].value = null
                     _app.ropeq1.fields['headln'].value = null
                     _app.ropeq1.fields['hdrateing'].value = null
                     _app.ropeq1.flush()
                     return
                  endif

            set procedure to tckteams.prg additive
            mr = ckteams2(hdfn,hdln,hefn,heln)

               if mr = 1
                  _app.ropeq1.fields['headfn'].value = null
                  _app.ropeq1.fields['headln'].value = null
                  _app.ropeq1.fields['heelfn'].value = null
                  _app.ropeq1.fields['heelln'].value = null
                  _app.ropeq1.fields['hdrateing'].value = null
                  _app.ropeq1.fields['heelrateing'].value = null
                  _app.ropeq1.flush()
                  return
               endif
          endif
      _app.heel = true
      form.grid2.refresh()
      form.grid3.refresh()
      form.entertxt2.text = "Entering Heeler"
      form.entertxt2.colornormal = 'white/red'

   elseif _app.heel = true
      _app.ropeq1.fields['heelfn'].value = fn
      _app.ropeq1.fields['heelln'].value = ln
      _app.ropeq1.fields['heelrateing'].value = rate


      if (not empty(_app.ropeq1.fields['headln'].value)) and ;
            (not empty(_app.ropeq1.fields['heelln'].value))

               hdfn = _app.ropeq1.fields['headfn'].value
               hdln = _app.ropeq1.fields['headln'].value
               hefn = _app.ropeq1.fields['heelfn'].value
               heln = _app.ropeq1.fields['heelln'].value
               _app.ropeq1.flush()
               sp = ckhdrhlr(hdfn,hdln,hefn,heln)

                  if sp = true
                     _app.ropeq1.fields['heelfn'].value = null
                     _app.ropeq1.fields['heelln'].value = null
                     _app.ropeq1.fields['heelrateing'].value = null
                     _app.ropeq1.flush()
                     //_app.ropeq1.refresh()
                     //_app.ropeq1.refreshcontrols()
                     return
                  endif

         set procedure to tckteams.prg additive
         mr = ckteams2(hdfn,hdln,hefn,heln)

               if mr = 1
                  _app.ropeq1.fields['headfn'].value = null
                  _app.ropeq1.fields['headln'].value = null
                  _app.ropeq1.fields['heelfn'].value = null
                  _app.ropeq1.fields['heelln'].value = null
                  _app.ropeq1.fields['hdrateing'].value = null
                  _app.ropeq1.fields['heelrateing'].value = null
                  _app.ropeq1.flush()
                  return
               endif

       endif
      _app.head = true
      form.grid3.refresh()
      form.grid2.refresh()
      form.entertxt2.text = "Entering Header"
      form.entertxt2.colornormal = 'red/white'
   endif

   if (not empty(_app.ropeq1.fields['headln'].value)) and ;
            (not empty(_app.ropeq1.fields['heelln'].value))

          _app.ropeq1.next(1)
          numentries()

   endif
   //_app.heel = true
   form.teamsenteref2.value = ltrim(str(_app.nrent1))
   form.seekerbox2.setfocus()

       return
FUNCTION CKTEAMS2(hdfn,hdln,hefn,heln)
LOCAL draw,hdfn1,hdln1,hefn1,heln1,mr
PRIVATE thisrope
thisrope = ''
mr = 0
 hdfn1 = trim(hdfn)
 hdln1 = trim(hdln)
 hefn1 = trim(hefn)
 heln1 = trim(heln)
 if _app.curpgec = 2
    thisrope := 'rope1.dbf'
 elseif _app.curpgec = 3
    thisrope := 'rope2.dbf'
 elseif _app.curpgec = 4
    thisrope := 'rope3.dbf'
 elseif _app.curpgec = 5
    thisrope := 'rope4.dbf'
 elseif _app.curpgec = 6
    thisrope := 'rope5.dbf'
 endif
cnt = new query()
   cnt.sql = "SELECT HEADFN, HEADLN, HEELFN, HEELLN, DRAWNUM,
DATEOFROPE ;
     FROM '&thisrope' Rope1 ;
      WHERE (HEADFN <> '') ;
      AND  (HEADLN <> '') ;
      AND  (HEELFN <> '') ;
      AND  (HEELLN <> '') ;
      AND  (DATEOFROPE = :dt)"           //ORDER BY HEADLN
      cnt.params["dt"] = _app.dofrec1
      //cnt.params["b"] = thisrope(a)
cnt.active = true
cnt.rowset.indexname = 'headln'
CNT.ROWSET.filter = [dateofrope = ']+ _app.dofrec1 +[']
cnt.rowset.first()
cnt.rowset.findkey(hdln)

if not cnt.rowset.endofset
  do while trim(cnt.rowset.fields['headln'].value) = hdln1 ;
  and not cnt.rowset.endofset

   if hdfn1+hdln1+hefn1+heln1 =
trim(cnt.rowset.fields['headfn'].value);
    +trim(cnt.rowset.fields['headln'].value);
      +trim(cnt.rowset.fields['heelfn'].value);
      +trim(cnt.rowset.fields['heelln'].value)

                   draw = cnt.rowset.fields['drawnum'].value
                   mr = okbox('This team, '+hdfn1+' '+hdln1+;
                     ' and '+hefn1+' '+heln1+;
                        ', is already entered in this roping, '+;
                        'in Position number '+draw+'.')
                   cnt.active = false
                   cnt = null
                   return mr

    elseif hdfn1+hdln1+hefn1+heln1 =
trim(cnt.rowset.fields['heelfn'].value);
        +trim(cnt.rowset.fields['heelln'].value);
           +trim(cnt.rowset.fields['headfn'].value);
           +trim(cnt.rowset.fields['headln'].value)

                   draw = cnt.rowset.fields['drawnum'].value
                   mr = okbox('This team, '+hdfn1+' '+hdln1+;
                     ' and '+hefn1+' '+heln1+;
                        ', is already entered in this roping, '+;
                        'in Position number '+draw+'.')
                    cnt.active = false
                    cnt = null
                    return mr

    elseif hefn1+heln1+hdfn1+hdln1 =
trim(cnt.rowset.fields['heelfn'].value);
        +trim(cnt.rowset.fields['heelln'].value);
           +trim(cnt.rowset.fields['headfn'].value);
           +trim(cnt.rowset.fields['headln'].value)

                   draw = cnt.rowset.fields['drawnum'].value
                   mr = okbox('This team, '+hdfn1+' '+hdln1+;
                     ' and '+hefn1+' '+heln1+;
                        ', is already entered in this roping, '+;
                        'in Position number '+draw+'.')
                    cnt.active = false
                    cnt = null
                    return mr

    else
     cnt.rowset.next()
   endif
 enddo
endif
cnt.active = false
cnt.rowset.indexname := 'heelln'
cnt.active = true
cnt.rowset.findkey(heln)

if not cnt.rowset.endofset

  do while trim(cnt.rowset.fields['heelln'].value) = heln ;
    and not cnt.rowset.endofset

    if hefn1+heln1+hdfn1+hdln1 =
trim(cnt.rowset.fields['heelfn'].value);
      +trim(cnt.rowset.fields['heelln'].value);
      +trim(cnt.rowset.fields['headfn'].value);
      +trim(cnt.rowset.fields['headln'].value)

       draw = cnt.rowset.fields['drawnum'].value
         mr = okbox('This team, '+hdfn1+' '+hdln1+;
       ' and '+hefn1+' '+heln1+;
         ', is already entered in this roping, '+;
         'in Position number '+draw+'.')
         cnt.active = false
         cnt = null
         return mr

    elseif hefn+heln+hdfn+hdln =
trim(cnt.rowset.fields['headfn'].value);
      +trim(cnt.rowset.fields['headln'].value);
         +trim(cnt.rowset.fields['heelfn'].value);
         +trim(cnt.rowset.fields['heelln'].value)

         draw = cnt.rowset.fields['drawnum'].value
         mr = okbox('This team, '+hdfn1+' '+hdln1+;
       ' and '+hefn1+' '+heln1+;
         ', is already entered in this roping, '+;
         'in Position number '+draw+'.')
         cnt.active = false
         cnt = null
         return mr
    else
      cnt.rowset.next()
    endif
  enddo
    ?"I didn't find it!!"
 endif
cnt.active = false
cnt = null
return mr
*******************************
Technical Details
Message-ID: <6knoe5$f7h4@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff5a1,c2d1a2cf51380c62,start
X-Google-Attributes: gidff5a1,public
From: "Jason Ortner" <jortner@onramp113.org>
Subject: Flush() Doesn't
Date: 1998/05/29
Message-ID: <6knoe5$f7h4@forums.borland.com>
X-Deja-AN: 357830362
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.vdbase.data.sql