FoxPro:Supported Commands and Attributes

Top  Previous  Next

 

 

File Attributes

Supported

 

CREATE

Y

 

DRIVER(filetype [,driver string])

Y

 

NAME

Y

 

ENCRYPT

N

 

OWNER(password)

N

 

RECLAIM

N1

 

PRE(prefix)

Y

 

BINDABLE

Y

 

THREAD

Y13

 

EXTERNAL(member)

Y

 

DLL([flag])

Y

 

OEM

N2

 

 

File Structures

Supported

 

INDEX

Y

 

KEY

Y

 

MEMO

Y

 

BLOB

N

 

RECORD

Y

 

 

Index, Key, Memo Attributes

Supported

 

BINARY

N14

 

DUP

Y3

 

NOCASE

Y

 

OPT

N

 

PRIMARY

Y

 

NAME

Y

 

Ascending Components

Y

 

Descending Components

Y

 

Mixed Components

N

 

 

Field Attributes

Supported

 

DIM

N

 

OVER

Y

 

NAME

Y

 

 

File Procedures

Supported

 

BOF(file)

Y9

 

BUFFER(file)

N

 

BUILD(file)

Y

 

BUILD(key)

Y

 

BUILD(index)

Y

 

BUILD(index, components)

Y4

 

BUILD(index, components, filter)

N

 

BYTES(file)

N

 

CLOSE(file)

Y

 

COPY(file, new file)

Y5

 

CREATE(file)

Y

 

DUPLICATE(file)

Y

 

DUPLICATE(key)

Y

 

EMPTY(file)

Y

 

EOF(file)

Y9

 

FLUSH(file)

Y

 

LOCK(file)

N

 

NAME(label)

Y

 

OPEN(file, access mode)

Y6

 

PACK(file)

Y

 

POINTER(file)

Y10

 

POINTER(key)

Y10

 

POSITION(file)

Y11

 

POSITION(key)

Y11

 

RECORDS(file)

Y12

 

RECORDS(key)

Y12

 

REMOVE(file)

Y

 

RENAME(file, new file)

Y5

 

SEND(file, message)

Y

 

SHARE(file, access mode)

Y6

 

STATUS(file)

Y

 

STREAM(file)

Y

 

UNLOCK(file)

Y

 

 

Record Access

Supported

 

ADD(file)

Y7

 

ADD(file, length)

N

 

APPEND(file)

Y7

 

APPEND(file, length)

N

 

DELETE(file)

Y1

 

GET(file,key)

Y

 

GET(file, filepointer)

Y

 

GET(file, filepointer, length)

N

 

GET(key, keypointer)

Y

 

HOLD(file)

Y8

 

NEXT(file)

Y

 

NOMEMO(file)

Y

 

PREVIOUS(file)

Y

 

PUT(file)

Y

 

PUT(file, filepointer)

Y

 

PUT(file, filepointer, length)

N

 

RELEASE(file)

Y

 

REGET(file,string)

Y

 

REGET(key,string)

Y

 

RESET(file,string)

Y

 

RESET(key,string)

Y

 

SET(file)

Y

 

SET(file, key)

Y

 

SET(file, filepointer)

Y

 

SET(key)

Y

 

SET(key, key)

Y

 

SET(key, keypointer)

Y

 

SET(key, key, filepointer)

Y

 

SKIP(file, count)

Y

 

WATCH(file)

Y

 

 

Transaction Processing

Supported

 

LOGOUT(timeout, file, ..., file)

N

 

COMMIT

N

 

ROLLBACK

N

 

 

Null Data Processing

Supported

 

NULL(field)

N

 

SETNULL(field)

N

 

SETNULL(file,field)

N

 

SETNONNULL(field)

N

Notes:

1      When the driver deletes a record from a FoxPro database, the record is not physically removed, instead the driver marks it inactive. Memo fields are not physically removed from the memo file, however they cannot be retrieved if they refer to an inactive record. Key values are removed from the index files. To remove records and memo fields permanently, execute a PACK(file).

 

To those programmers familiar with FoxPro, this driver processes deleted records consistent with the way FoxPro processes them after the SET DELETED ON command is issued. Records marked for deletion are ignored from processing by executable code statements, but remain in the data file.

2      If you need to access FoxPro data with alternate characters stored using a non-English version of FoxPro, then you should use ODBC. However, if you do not have any string based kesys, you can use the FoxPro driver and call the ConvertOEMToANSI and ConvertANSIToOEM after retrieving and before updating a record.

3      In FoxPro it is legal to enter multiple records with duplicates of the unique key components. However, only the first of these records is indexed. So processing in key order only shows this first record. If you delete a record, then enter a new record with the same key value, the key file continues to point at the deleted record rather than the new record. In this situation, the FoxPro file driver changes the key file to point at the active record rather than the deleted record. This means that if you use a FoxPro program to delete a unique record, then insert a duplicate of this record, the new record is invisible when processing in key order until a pack is done. If you do the same process in a Clarion program, the new record is visible when processing in key order.

4      When building dynamic indexes, the components may take one of two forms:

  BUILD(DynNdx, '+Pre:FLD1, -Pre:FLD2')

This form specifies the names of the fields on which to build the index. The field names must appear as specified in the fields' NAME() attribute if supplied, or must be the label name. A prefix may be used for compatibility with Clarion conventions but is ignored.

  BUILD(DynNdx, 'T[Expression]')

This form specifies the type and Expression used to build an index--see Miscellaneous--Key Definition for more information.

5      These commands copy data and memo files using newfile, which may specify a new file name or directory. Key or index files are copied if the newfile is a subdirectory specification. To copy an index file to a new file, use a special form of the copy command:

   COPY(file,'<index>|<newfile>')

This returns File Not Found if an invalid index is passed. The COPY command assumes a default extension of .IDX for both the source and the target file names if none is specified. If you require a file name without an extension, terminate the name with a period. Given the file structure:

 Clar2  FILE,CREATE,DRIVER('FoxPro'),PRE(CL2)

 NumKey   KEY(+CL2:Num),DUP

 StrKey   KEY(+CL2:Str1)

 StrKey2  KEY(+CL2:Str2)

 AMemo    MEMO(100), NAME('mem')

 Record   RECORD

 Num       STRING(@n-_9.2)

 STR1      STRING(2)

 STR2      STRING(2)

 Mem       STRING(10)

          END

        END

The following commands copy this file definition to A:

 COPY(Clar2,'A:\CLAR2')

 COPY(Clar2,'StrKey|A:\STRKEY')

 COPY(Clar2,'StrKey2|A:\STRKEY2')

 COPY(Clar2,'NumKey|A:\NUMKEY')

After these calls, the following files would exist on drive A: CLAR2.DBF, CLAR2.FPT, STRKEY.IDX, STRKEY2.IDX, and NUMKEY.IDX.

6      You do not need SHARE (or VSHARE) in any environment (for example, Novell) that supplies file locking as part of the operating system.

7      The ADD statement tests for duplicate keys before modifying the data file or its associated KEY files. Consequently it is slower than APPEND which performs no checks and does not update KEYs. When adding large amounts of data to a database use APPEND...BUILD in preference to ADD.

8      FoxPro performs record locking by locking the entire record within the data file. This prevents read access to other processes. Therefore we recommend minimizing the amount of time for which a record is held.

9      Although the driver supports these functions, we do not recommend their use. They must physically access the files and they are slow. Instead, test the value returned by ERRORCODE() after each sequential access. NEXT or PREVIOUS post Error 33 (Record Not Available) if an attempt is made to access a record beyond the end or beginning of the file.

10    There is no distinction between file pointers and key pointers; they both return the record number for the given record.

11    POSITION(file) returns a STRING(12). POSITION(key) returns a STRING the size of the key fields + 4 bytes.

12    Under FoxPro, the RECORDS() function reports the same number of records for the data file and its keys and indexes. Usually there will be no difference in the number of records unless the INDEX is out of date. Because the DELETE statement does not physically remove records, the number of records reported by the RECORDS() function includes inactive records. Exercise care when using this function.The field names must appear as specified in the fields' NAME() attribute if supplied, or must be the label name. A prefix may be used for compatibility with the Clarion conventions but is ignored.

13    THREADed files consume additional file handles for each thread that accesses the file.

14    OEM conversion is not applied to BINARY MEMOs. The driver assumes BINARY MEMOs are zero padded; otherwise, space padded.