Clipper:Supported Commands and Attributes

Top  Previous  Next

 

 

File Attributes

Supported

 

CREATE

Y1

 

DRIVER(filetype [,driver string])

Y

 

NAME

Y

 

ENCRYPT

N

 

OWNER(password)

N

 

RECLAIM

N2

 

PRE(prefix)

Y

 

BINDABLE

Y

 

THREAD

Y16

 

EXTERNAL(member)

Y

 

DLL([flag])

Y

 

OEM

Y

 

 

File Structures

Supported

 

INDEX

Y

 

KEY

Y

 

MEMO

Y3

 

BLOB

N

 

RECORD

Y

 

 

Index, Key, Memo Attributes

Supported

 

BINARY

N

 

DUP

Y4

 

NOCASE

Y

 

OPT

N

 

PRIMARY

Y

 

NAME

Y3

 

Ascending Components

Y

 

Descending Components

Y

 

Mixed Components

Y

 

 

Field Attributes

Supported

 

DIM

N

 

OVER

Y

 

NAME

Y1

 

 

File Procedures

Supported

 

BOF(file)

Y11

 

BUFFER(file)

N

 

BUILD(file)

Y

 

BUILD(key)

Y

 

BUILD(index)

Y

 

BUILD(index, components)

Y5

 

BUILD(index, components, filter)

N

 

BYTES(file)

N

 

CLOSE(file)

Y

 

COPY(file, new file)

Y6

 

CREATE(file)

Y1

 

DUPLICATE(file)

Y

 

DUPLICATE(key)

Y

 

EMPTY(file)

Y

 

EOF(file)

Y11

 

FLUSH(file)

Y

 

LOCK(file)

Y

 

NAME(label)

Y

 

OPEN(file, access mode)

Y7

 

PACK(file)

Y

 

POINTER(file)

Y12

 

POINTER(key)

Y12

 

POSITION(file)

Y13

 

POSITION(key)

Y13

 

RECORDS(file)

Y14

 

RECORDS(key)

Y14

 

REMOVE(file)

Y

 

RENAME(file, new file)

Y8

 

SEND(file, message)

Y

 

SHARE(file, access mode)

Y7

 

STATUS(file)

Y

 

STREAM(file)

Y

 

UNLOCK(file)

Y

 

 

Record Access

Supported

 

ADD(file)

Y9

 

ADD(file, length)

N

 

APPEND(file)

Y9

 

APPEND(file, length)

N

 

DELETE(file)

Y6

 

GET(file,key)

Y

 

GET(file, filepointer)

Y

 

GET(file, filepointer, length)

N

 

GET(key, keypointer)

Y

 

HOLD(file)

Y10

 

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)

N15

 

COMMIT

N

 

ROLLBACK

N

 

 

Null Data Processing

Supported

 

NULL(field)

N

 

SETNULL(field)

N

 

SETNULL(file,field)

N

 

SETNONNULL(field)

N

Notes

1      If your application creates a Clipper file, you may require additional NAME information for these Clipper data types:

For a Clipper numeric field, use the Clarion REAL data type. Then in the NAME attribute (the External Name field on the Attributes tab in the Field Properties dialog), specify 'NumericFieldName=N(Precision,DecimalPlaces)' where NumericFieldName is the name of the field, Precision is the precision of the field and DecimalPlaces is the number of decimal places. See Data Types above for more information.

For a Clipper logical field, use the Clarion BYTE data type. See Data Types above for more information. See the Miscellaneous section for tips on reading the data from the field.

For a Clipper date field, use the Clarion DATE data type. See Data Types above for more information.

2      When the driver deletes a record from a Clipper 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. To remove records and memo fields permanently, execute a PACK(file).

To those programmers familiar with Clipper, this driver processes deleted records consistent with the way Clipper 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.

3      MEMO field declarations require a pointer field in the file's record structure. Declare the pointer field as a STRING(10) or a LONG. This field will be stored in the .DBF file containing the offset of the memo in the .DBT file. The MEMO declaration must have a NAME() attribute naming the pointer field. See Data Types above for more information.

4      In Clipper 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 Clipper file driver driver changes the key file to point at the active record rather than the deleted record. This means that if you use a Clipper 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.

5      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 below.

6      The COPY() command copies 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 .NTX 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('Clipper'),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.DBT, STRKEY.NTX, STRKEY2.NTX, and NUMKEY.NTX.

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

8      The RENAME command copies the data and memo files using newfile, which may specify a new file name or directory path. Key and index files must be renamed using the same syntax as the COPY command, above.

9      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.

10    Clipper 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.

11    Although the driver supports these functions, we do not recommend their use. They must physically access the files and add overhead. 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.

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

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

14    Under Clipper, 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.

15    See also PROP:Logout in the Language Reference.

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