Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BINTOC question
Message
From
15/12/2004 11:31:14
Daniel Mory
ECI Solutions, Inc.
Indiana, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
BINTOC question
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00969484
Message ID:
00969484
Views:
46
I found an odd behvavior when using bintoc in an index an integer field.
if the table column has only ones and zeroes as values, it sorts differently if you set the key size to two or four bytes as opposed to one.
if the column contains other values, they all sort the same way.

here is a code example:
CREATE CURSOR temp (myfield I)
INSERT INTO temp VALUES (0)
INSERT INTO temp VALUES (1)
INSERT INTO temp VALUES (0)
INSERT INTO temp VALUES (0)
INSERT INTO temp VALUES (1)
INSERT INTO temp VALUES (1)
INSERT INTO temp VALUES (0)
INDEX ON BINTOC(myfield,1) TAG myindex1
INDEX ON BINTOC(myfield,2) TAG myindex2
INDEX ON BINTOC(myfield,4) TAG myindex3

SET ORDER to myindex1
BROWSE

SET ORDER to myindex2
BROWSE

SET ORDER to myindex3
BROWSE

USE

CREATE CURSOR temp (myfield I)
INSERT INTO temp VALUES (0)
INSERT INTO temp VALUES (1)
INSERT INTO temp VALUES (2)
INSERT INTO temp VALUES (0)
INSERT INTO temp VALUES (1)
INSERT INTO temp VALUES (1)
INSERT INTO temp VALUES (0)
INDEX ON BINTOC(myfield,1) TAG myindex1
INDEX ON BINTOC(myfield,2) TAG myindex2
INDEX ON BINTOC(myfield,4) TAG myindex3


SET ORDER to myindex1
BROWSE

SET ORDER to myindex2
BROWSE

SET ORDER to myindex3
BROWSE
Is this a bug? I don't understand why specifying different lengths for the key would make any difference.
Next
Reply
Map
View

Click here to load this message in the networking platform