Bill,

Can we guess that in "select ... into ZZZZ" ZZZZ is a simple alias for
"selection" that is a unique table? If you use into, selection as a table
name is not available anymore (even if selectioninfo() is). I guess that as
result ZZZZ exists as a distinct table only when committed, if not it
remains a single alias for selection; the last selection replaces the
previous one even if you change the name. There is some logic in it, it may
not be the expected one, but it seems to me it WAD.

Jacques Paris
e-mail  [EMAIL PROTECTED]
MapBasic-MapInfo support  http://www.paris-pc-gis.com


-----Original Message-----
From: Bill Thoen [mailto:[EMAIL PROTECTED]
Sent: 1-Aug-04 12:01
To: MapInfo-L
Subject: MI-L A Problem with Cursors of Beers

This is a problem for MapBasic programmers and it involves MapInfo
swicthing one selection cursor with another. In this case it switched a
pint of Bass for a LoveInnaCanoe brand. Horrors!

But what's going on here? If you create one temporary table with a
selection, you don't want a subsequent selection overwriting the first
when you specify a different result table. But that's exaclty what's
happening in the short application below. Does anyone know why this is,
and if there's a workaround?

' Beer.mb
' Demonstrates a bug in selection cursors. They are not persistent!

Dim i As Integer

  Close All
  Print Chr$(12)

  ' Set 'em up and display them...
  Create Table BEERS (
    name Char(40)
    )
  File ApplicationDirectory$() & "Beers.tab"
  Insert Into BEERS (name) Values ("Guinness")
  Insert Into BEERS (name) Values ("Bass")
  Insert Into BEERS (name) Values ("Molson BarleyPop")
  Insert Into BEERS (name) Values ("Red Hook")
  Browse * From BEERS

  ' Create a selection into a cursor
  Select * From BEERS Where rowid = 2 Into BEER2 NoSelect
  Print "Beer 2 is " & BEER2.name

  ' Create another one
  Select * From BEERS Where rowid = 3 Into BEER3 NoSelect
  Print "Beer 3 is " & BEER3.name

  ' So what's happened to BEER2 ???
  Print "Ha! Beer 2 is now " & BEER2.name

' --- end




---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12814



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12815

Reply via email to