Field Data
rigDbListFields()
Returns an array containing the field names.
put rigDbListFields("tablename") into tFields
repeat for each key tKey in tFields
put tFields[tKey] after tFieldslist
end repeat
rigDbFieldExists()
Sometimes it's helpful to know whether a particular field exists before performing an action. Returns a boolean TRUE/FALSE. Usage example:
if rigDbFieldExists("fieldname", "tablename") is TRUE then
-- some code...
end if
Note: Replace fieldname with the name of the column you are looking for, and replace tablename with the name of the table you are looking for.
rigDbFieldData()
Returns an array containing field information.
Sometimes it's helpful to gather the field names or other metadata, like the column type, max length, etc.
Note: Not all databases provide meta-data.
Usage example:
put rigDbFieldData("tablename") into tFields
repeat for each key tKey in tFields
put tFields[tKey]["name"] & comma after tFieldsData
put tFields[tKey]["type"] & comma after tFieldsData
put tFields[tKey]["maxlength"] & comma after tFieldsData
put "(" & tFields[tKey]["default"] & ")" & comma after tFieldsData
put tFields[tKey]["primarykey"] & "<br />" after tFieldsData
end repeat
The following data is available from this function if supported by your database:
- name: column name
- maxlength: maximum length of the column
- primarykey: 1 if the column is a primary key
- type: the type of the column
- default: the default value of the column