Click or drag to resize

DbFileSpec Class

X#
Hold the file name and path for a .DBF file and provide DBF-related functions, such as creating, copying, deleting, moving, and renaming files.
Inheritance Hierarchy
Object
  FileSpec
    DbFileSpec

Namespace:  VO
Assembly:  VORDDClasses (in VORDDClasses.dll) Version: 2.19
Syntax
 CLASS DbFileSpec INHERIT FileSpec
Request Example View Source

The DbFileSpec type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleDbFileSpec
Instantiates a DBFileSpec object and fills its instance variables with DBF information.
Top
Properties
  NameDescription
Public propertyCode exampleAttributes
One or more of the following characters concatenated into a string, indicating the attributes of the file represented by this file specification:
(Inherited from FileSpec.)
Public propertyDateChanged
A date value denoting when the file was created or last changed. If the file is not found, NULL_DATE is returned.
(Inherited from FileSpec.)
Public propertyDBFAttr
The DBF file attributes returned as a string type.
Public propertyDBFDateChanged
The DBF file date stamp returned as a date type.
Public propertyDBFName
The DBF file name and extension.
Public propertyDBFSize
The DBF file size.
Public propertyDBFTime
The DBF file time stamp returned as a string.
Public propertyDbStruct
An array containing the structure of the DBF file.
Public propertyDelim
Access the delimiter used for the CopyTo() method.
Public propertyCode exampleDrive
A string representing the drive defined to this file specification.
(Inherited from FileSpec.)
Public propertyErrInfo
Return the error object from the last Copy() or Move() operation.
(Inherited from FileSpec.)
Public propertyExtension
A string representing the extension defined to this file specification.
(Inherited from FileSpec.)
Public propertyFCount
The number of fields in the DBF file.
Public propertyFields
The 1-D array of DBF fields to copy out to when using the CopyTo() method.
Public propertyFileName
Assign a file name to the DBFileSpec object.
(Overrides FileName.)
Public propertyForBlock
The FOR condition code block used for the CopyTo() method.
Public propertyFullPath
Assign a full path—including drive, directory, file name, and extension—to the DBFileSpec object.
(Overrides FullPath.)
Public propertyHeaderSize
The size of the DBF file header.
Public propertyHidRDDs
The 1-D array of "hidden" RDDs (i.e., DBFMEMO) used for the CopyTo() method.
Public propertyIndexNames
The 1-D array of index files with drive, path, file name, and extension information.
Public propertyIsAnsi
The ANSI/OEM setting used in the DBF file header.
Public propertyLastUpDate
The date of the last update made to the DBF file as reported in the DBF header.
Public propertyMemAttr
The memo file attributes.
Public propertyMemBlockSize
The memo block size used in the memo file.
Public propertyMemDateChanged
The memo file date stamp returned as a date type.
Public propertyMemFileExt
The memo file name extension excluding the file name.
Public propertyMemFileName
The base memo file name excluding the file name extension.
Public propertyMemFullPath
The full path of the memo file, including drive, directory, file name, and extension.
Public propertyMemName
The memo file name and extension.
Public propertyMemSize
The memo file size.
Public propertyMemTime
The memo file time stamp returned as a string.
Public propertyOrders
The 1-D array of OrderSpec objects that are associated with this DBFileSpec object.
Public propertyCode examplePath
A string representing the path defined to this file specification.
(Inherited from FileSpec.)
Public propertyRDD_Name
The name of the RDD used for instantiation.
Public propertyRDD_Version
The version number of the RDD.
Public propertyRDDs
An array of "hidden" RDDs (such as DBFMEMO) used for instantiation.
Public propertyRecCount
The number of records in the DBF. (Note that "LastRec" is not available in this class, only in the dbServer class)
Public propertyRecno
The record number for the CopyTo() method when a single record is required.
Public propertyRecords
The number of records for the CopyTo() method.
Public propertyRecSize
The record size of the DBF.
Public propertyRest
A logical determining if the CopyTo() method is to copy all records or the current record to EOF.
Public propertyRLockCount
The number of locked records in the DBF.
Public propertySDF
A logical determining if the CopyTo() method is to copy out to an SDF file.
Public propertySize
A numeric value representing the size, in bytes, of the file represented by this file specification.
(Inherited from FileSpec.)
Public propertyTimeChanged
A string indicating the time when the file was created or last changed.
(Inherited from FileSpec.)
Public propertyWhileBlock
A WHILE condition code block used with the CopyTo() method.
Top
Methods
  NameDescription
Public methodCode exampleAppendToPath
Append a subdirectory to the end of this file specification's path.
(Inherited from FileSpec.)
Public methodCode exampleCopy(Usual, Usual)
Make a copy of the file represented by this file specification.
(Inherited from FileSpec.)
Public methodCode exampleCopy(Usual, Usual, Usual)
Copies all files associated with DBFileSpec objects to a different drive and/or directory.
Public methodCode exampleCopyTo
Copies the DBFileSpec object's DBF file to another data format. This can be used for copying out to another RDD, to a delimited file, or to an SDF file.
Public methodCode exampleCreate
Create a new DBF file with the given name, using a provided DBStruct array.
Public methodCode exampleDBFSGetInfo
Fills in the DBFileSpec object's instance variables. This method is not required when using the Find() method, which will invoke this method internally if the file is found.
Public methodCode exampleDelete
Physically deletes all files that are associated with the DBFileSpec object, including memo files and any index files associated with the DBF through OrderSpec objects.
(Overrides Delete.)
Public methodError
Provide a method for handling error conditions raised during FileSpec processing. This is an event handler: it is automatically called by other methods; the developer does not normally need to call the error method, but might want to replace or amend it.
(Inherited from FileSpec.)
Public methodCode exampleFind
Locates the file defined in the DBFileSpec object using the current directory, SetDefault(), or SetPath(). Fills in the instance variables of the DBFileSpec if successful.
(Overrides Find.)
Public methodCode exampleMove(Usual, Usual)
Move the file represented by this file specification to a new location.
(Inherited from FileSpec.)
Public methodCode exampleMove(Usual, Usual, Usual)
Moves and/or renames all files associated with DBFileSpec objects to a different drive and/or directory. Updates DBFileSpec and/or OrderSpec instance variables. Will also rename auto-open index files. Only DBF, MEMO and auto-open index files will get renamed.
Public methodCode examplePathUp
Remove the last subdirectory from the end of this file specification's path.
(Inherited from FileSpec.)
Public methodCode exampleRename
Renames files associated with DBFileSpec object. Only DBF/MEMO and auto-open index files will get renamed. Rename() will not rename a file if it is already open or there is a file name conflict. To rename files to another directory, use the Move() method and supply a different target file name.
(Overrides Rename(Usual, Usual).)
Top
Remarks
A FileSpec is a general purpose object that holds the file name and path of a file. The DBFileSpec subclass is intended specifically for holding information about a DBF file. The FileSpec class does not contain any methods for reading or writing the file, however you can in fact create a DBF structure with this class; it is limited to directory-level properties such as size, date and time changed and operations such as delete and rename. The DBFileSpec adds two operations that apply to DBF files only: reading the record layout through DBFileSpec:DBStruct and creating a file given a record layout through DBFileSpec:Create(). Note that a DBServer object opens an existing file on instantiation; it requires that the file exists, so it cannot be used to create a DBF file. DBFileSpec:Create() is the ideal method for creating a DBF file. DBStruct is available as a access method of the DBServer class, but instantiating a DBServer is an unnecessary complex way of reading a file header. DBFileSpec:DBStruct is a simpler way of getting the record layout.
Examples
The two methods may be used together, in concert with the path manipulation methods of the FileSpec class. For example, to create in the corresponding directory on a different drive a new file with the same record layout as an existing file, you might do something like this:
X#
1oDBFileSpec := DBFileSpec{"c:\data\custdata.dbf"}
2IF oDBFileSpec:Find()        // File exists?
3aDBStruct := oDBFileSpec:DBStruct
4oDBFileSpec:Drive := "d:"
5oDBFileSpec:Create(aDBStruct)
6ENDIF
See Also

Reference