CursorGetProp(), CursorSetProp()
These functions let you inspect and change properties of open tables, views and cursors (the kind you create with CREATE CURSOR and SQL SELECT). The changes you make affect the object (table, view or cursor) only as long as it's open. For permanent changes, use DBSetProp().For tables and cursors, the only property that can be changed is Buffering.
Usage |
uPropValue = CURSORGETPROP( cProperty [, nWorkArea | cAlias ] ) lSuccess = CURSORSETPROP( cProperty [, uNewValue ] [, nWorkArea | cAlias ] ) |
Parameter |
Value |
Meaning |
cProperty |
Character |
The name of the cursor property to look up or change. |
uNewValue |
Character, Numeric or Logical |
The new value to assign to the specified property. The value must be of the appropriate type for the property. |
nWorkArea |
Numeric |
The work area containing the cursor. |
Omitted |
If cAlias is also omitted, use the current work area. |
|
cAlias |
Character |
The alias for the cursor. |
Omitted |
If nWorkArea is also omitted, use the current work area. |
|
uPropValue |
Character, Numeric or Logical |
The current value of cProperty. |
lSuccess |
.T. |
The change was successful. |
.F. |
The change was unsuccessful. |
In VFP 6 and earlier versions, the descriptions for UpdatableFieldList and UpdateNameList in Help are backward. UpdatableFieldList contains a comma-delimited list of fields that can be updated in the view. If you use the View Designer, it contains the names of the items with check marks in the "pencil" column. UpdateNameList is sort of like SELECT's AS clause—it matches field names in the result cursor with the source field names. The result field name comes first, followed by a space, followed by the aliased field name in the original source. It, too, is set automatically if you use the View Designer. |
lcSource = CursorGetProp("SourceName") DBGetProp(lcSource, ...)
Example |
USE Employee ? CURSORGETPROP("Buffering") && Returns 1 ? CURSORGETPROP("SourceName") && Returns Employee ? CURSORGETPROP("SourceType") && Returns 3 CREATE DATA Test CREATE SQL VIEW MyEmps AS ; SELECT EmployeeId, First_Name, Last_Name ; FROM Employee WHERE Region = ?Region USE MyEmps ? CURSORGETPROP("Buffering") && Returns 3 * Set updating properties * Employee_Id is primary key ? CURSORSETPROP("KeyFieldList", "Employee_Id") ? CURSORSETPROP("UpdateNameList", ; "first_name Employee.first_name,last_name Employee.last_name") ? CURSORSETPROP("SendUpdates", .T.) ? CURSORSETPROP("Tables", "Employee") ? CURSORSETPROP("UpdatableFieldList", "First_Name,Last_Name") * Now the view is updatable |
See Also |