Returns a property for the current database or for fields, named connections, tables, or views in the current database.
Syntax
DBGETPROP(cName, cType, cProperty)
Returns
Character, Numeric, or Logical
Arguments
cName
Specifies the name of the database, field, named connection, table, or view for which DBGETPROP( ) returns information.
To return information about a field in a table or a view, preface the name of the field with the name of the table or view containing the field. For example, to return information about the custid
field in the customer
table, specify the following for cName:
customer.custid
cType
Specifies whether cName is the current database, or a field, named connection, table, or view in the current database. The following table lists the values you can specify for cType:
cType | Description |
CONNECTION | cName is a named connection in the current database. |
DATABASE | cName is the current database. |
FIELD | cName is a field in the current database. |
TABLE | cName is a table in the current database. |
VIEW | cName is a view in the current database. |
cProperty
Specifies the name of the property for which DBGETPROP( ) returns information.
The following tables list the values you can specify for cProperty, the return value types, and descriptions of each property. Each description includes the read and write privileges for each property. If a property is read-only, its value cannot be changed with DBSETPROP( ). For more information about changing property values, see DBSETPROP( ).
Connection properties
cProperty | Type | Description |
Asynchronous | L | The connection mode. (Default) False (.F.) specifies a synchronous connection. True (.T.) specifies an asynchronous connection. Read-Write. |
BatchMode | L | The batch processing mode. (Default) True (.T.) specifies the connection that operates in batch mode. Read-Write. |
Comment | C | The text of the connection comment. Read-Write. |
ConnectString | C | The login connection string. Read-Write. |
ConnectTimeout | N | The connection timeout interval in seconds. The default is 0 (wait indefinitely). Read-Write. |
Database | C | The name of the server database specified with the DATABASE clause in the CREATE CONNECTION command or in the Connection Designer. Read-Write. |
DataSource | C | The name of the data source as defined in the Odbc.ini file. Read-Write. |
DispLogin | N | Contains a numeric value that determines when the ODBC Login dialog box is displayed. DispLogin may assume the following values:
1 or DB_PROMPTCOMPLETE (from Foxpro.h). 2 or DB_PROMPTALWAYS (from Foxpro.h). 3 or DB_PROMPTNEVER (from Foxpro.h). If 1 or DB_PROMPTCOMPLETE is specified, Microsoft Visual FoxPro displays the ODBC Login dialog box only if any required information is missing. If 2 or DB_PROMPTALWAYS is specified, the ODBC Login dialog box is always displayed, allowing you to change settings before connecting.
If 3 or DB_PROMPTNEVER is specified, the ODBC Login dialog box is not displayed and Visual FoxPro generates an error if the required login information isn't available. |
DispWarnings | L | Contains a logical value that determines if non-trappable warnings from the remote table, ODBC, or Visual FoxPro are displayed. (Default) True (.T.) specifies that non-trappable errors are displayed. Read-Write. |
IdleTimeout | N | The idle timeout interval in seconds. Active connections are deactivated after the specified time interval. The default value is 0 (wait indefinitely). Read-Write. |
PacketSize | N | The size of the network packet used by the connection. Adjusting this value can improve performance. The default value is 4096 bytes (4K). Read-Write |
PassWord | C | The connection password. Read-Write. |
QueryTimeout | N | The query timeout interval in seconds. The default value is 0 (wait indefinitely). Read-Write. |
Transactions | N | Contains a numeric value that determines how the connection manages transactions on the remote table. Transactions may assume the following values:
1 or DB_TRANSAUTO (from Foxpro.h).
2 or DB_TRANSMANUAL (from Foxpro.h). Read-Write. |
UserId | C | The user identification. Read-Write. |
WaitTime | N | The amount of time in milliseconds that elapses before Visual FoxPro checks whether the SQL statement has completed executing. The default is 100 milliseconds. Read-Write. |
Database properties
cProperty | Type | Description |
Comment | C | The text of the database comment. Read-Write. |
Version | N | The database version number. Read-Only. |
Field properties for tables
cProperty | Type | Description |
Caption | C | The field caption. Read-Write. |
Comment | C | The text of the field comment. Read-Write. |
DefaultValue | C | The field default value. Read-Only. |
DisplayClass | C | Name of the class used for field mapping. Read-Write. |
DisplayClassLibrary | C | Path to the class library specified with the DisplayClass property. Read-Write. |
Format | C | The field display format. See the Format Property for a list of format settings. Read-Write. |
InputMask | C | The field input format. See the InputMask Property for a list of input mask settings. Read-Write. |
RuleExpression | C | The field rule expression. Read-Only. |
RuleText | C | The field rule error text. Read-Only. |
Field properties for views
cProperty | Type | Description |
Caption | C | The field caption. Read-Write. |
Comment | C | The text of the field comment. Read-Write. |
DataType | C | The data type for a field in a view. Initially set to the data type for the field in the data source. To specify a different data type for a field with DBSETPROP( ), use the syntax for creating fields in CREATE TABLE – SQL. For example, to change the data type of an integer field named iCost in a table named Mytable to numeric type with width 4 and 2 decimal places, use
DBSETPROP('mytable.icost', 'field', ; You can also include the NOCPTRANS clause to prevent translation of character and memo fields to a different code page.
Read-Write for remote views. |
DefaultValue | C | The field default value. Read-Write. |
KeyField | L | Contains true (.T.) if the field is specified in an index key expression; otherwise, contains false (.F.). Read-Write. |
RuleExpression | C | The field rule expression. Read-Write. |
RuleText | C | The field rule error text. Read-Write. |
Updatable | L | Contains true (.T.) if the field can be updated; otherwise, contains false (.F.). Read-Write. |
UpdateName | C | The name of the field used when data in the field is updated to the remote table. By default, the remote table field name. Read-Write. |
Table properties
cProperty | Type | Description |
Comment | C | The text of the table comment. Read-Write. |
DeleteTrigger | C | The Delete trigger expression. Read-Only. |
InsertTrigger | C | The Insert trigger expression. Read-Only. |
Path | C | The path to the table. Read-Only. |
PrimaryKey | C | The tag name of the primary key. Read-Only. |
RuleExpression | C | The row rule expression. Read-Only. |
RuleText | C | The row rule error text. Read-Only. |
UpdateTrigger | C | The Update trigger expression. Read-Only. |
View properties
cProperty | Type | Description |
BatchUpdateCount | N | The number of update statements sent to the back end for views. 1 is the default. Adjusting this value can greatly increase update performance. Read-Write. |
Comment | C | The text of the view comment. Read-Write. |
CompareMemo | L | Contains true (.T.) (default) if memo fields (of type Memo, General, or Picture) are included in the WHERE clause for updates; otherwise, contains false (.F.). Read-Write. |
ConnectName | C | The named connection used when the view is opened. Read-Only. |
FetchAsNeeded | L | Contains true (.T.) if data is fetched as needed; otherwise, contains false (.F.) (default). Read-Write. |
FetchMemo | L | Contains true (.T.) (the default) if memo and general fields are fetched with the view results; otherwise, contains false (.F.). Read-Write. |
FetchSize | N | The number of records fetched at a time from the remote tables (when progressive fetches are enabled). The default is 100 records. Setting FetchSize to –1 retrieves the complete result set (limited by the MaxRecords setting). Read-Write. |
MaxRecords | N | The maximum number of records fetched when result sets are returned. The default is – 1 (all rows are returned). A value of 0 specifies that the view is executed but no results are fetched. Read-Write. |
Offline | L | Contains true (.T.) if the view is an offline view. Read-only. |
ParameterList | C | The WHERE clause parameters. The format for the parameters is ''ParameterName1, 'Type1'; ParameterName2, 'Type2'; ...'' where Type is a one of the following characters specifying the parameter type:
C - Character For example, ''MyParam1, 'C' '' specifies a single character type parameter named MyParam1.
For more information about creating parameterized views, see Chapter 8, Creating Views, in the Programmer's Guide. |
Prepared | L | Contains true (.T.) if SQL statements are prepared for subsequent REQUERY( ) function calls. REQUERY( ) is used to retrieve data again for a SQL view. See SQLPREPARE( ) for additional information about preparing SQL statements. The default is false (.F.). Read-Write. |
RuleExpression | C | The row rule expression. Read-Write. |
RuleText | C | The rule text expression displayed when an error occurs when data is edited in a Browse or Edit window. Read-Write. |
SendUpdates | L | Contains true (.T.) if a SQL update query is sent to update remote tables; otherwise, contains false (.F.) (default). Read-Write. |
ShareConnection | L | Contains true (.T.) if the view can share its connection handle with other connections; otherwise, contains false (.F.). Read-Write. |
SourceType | N | The view source. SourceType may assume the following values: 1. The view uses local tables.
2. The view uses remote tables. |
SQL | C | The SQL statement executed when the view is opened. Read-Only. |
Tables | C | A comma-delimited list of the names of the tables. Read-Write. |
UpdateType | N | The update type. Valid values are: 1 or DB_UPDATE (from Foxpro.h). The old data is updated with the new data (default).
2 or DB_DELETEINSERT (from Foxpro.h). The old data is deleted and the new data is inserted. |
UseMemoSize | N | The minimum size (in bytes) for which result columns are returned in memo fields. For example, if the width of a column result is greater than the value of UseMemoSize, the column result is stored in a memo field. UseMemoSize may vary from 1 to 255; the default value is 255. Read-Write. |
WhereType | N | The WHERE clause for updates to remote tables. WhereType may assume the following values: 1 or DB_KEY (from Foxpro.h). The WHERE clause used to update remote tables consists of only the primary fields specified with the KeyFieldList property. 2 or DB_KEYANDUPDATABLE (from Foxpro.h). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any updatable fields. 3 or DB_KEYANDMODIFIED (from Foxpro.h) (default). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and any other fields that are modified. 4 or DB_KEYANDTIMESTAMP (from Foxpro.h). The WHERE clause used to update remote tables consists of the primary fields specified with the KeyFieldList property and a comparison of the time stamps. For more information about the WhereType property, see Chapter 8, Creating Views, in the Programmer's Guide. Read-Write. |
Remarks
A database must be opened before you can get its properties or those of its connections, tables, views, or fields. You do not need to execute the USE command to open a table or view before getting its properties.
For more details about the properties you can get for connections, databases, fields, tables, and views, refer to the topics listed in the following table.
For details about | Refer to this section | In this chapter of the Programmer's Guide |
Database properties | "Viewing and Setting Database Properties" | Chapter 7, Working with Tables |
Connections | "Accessing Remote Data" | Chapter 8, Creating Views |
Views | Chapter 8, Creating Views | |
Triggers | "Using Triggers" | Chapter 7, Working with Tables |
Captions | "Creating Captions for Fields" | Chapter 7, Working with Tables |
Default values | "Creating Default Field Values" | Chapter 7, Working with Tables |
"Creating Default Values for View Fields" | Chapter 8, Creating Views | |
Comments | "Adding Comments to Fields" | Chapter 7, Working with Tables |
"Viewing and Setting Database Properties" | Chapter 6, Creating Databases | |
Primary key | "Controlling Duplicate Values" | Chapter 7, Working with Tables |
Rules | "Enforcing Business Rules" | Chapter 7, Working with Tables |
"Setting or Changing Field-level or Table Rules" | Chapter 7, Working with Tables | |
"Creating Rules on View Fields and Rows" | Chapter 8, Creating Views |