IDatabaseValues¶
- class IDatabaseValues¶
Bases:
ImpactCOMWrapperBase- Description:
Reads and writes information to the database.
Wraps a COM object or another wrapper instance. Accepts: - A valid impact_object - An existing impact_com_wrapper_base-derived instance
- property bytes_as_variant¶
Gets bytes_as_variant.
- Description:
Supports reading database picture values as native VARIANT data types (instead of bytes).
- Remarks:
Introduced in Impact 11.0.0.27
- Returns:
The value of bytes_as_variant.
- Return type:
bytes_as_variant (bool)
- property field_count¶
Gets field_count.
- Description:
The number of fields stored in the IDatabaseValues object.
- Returns:
The value of field_count.
- Return type:
field_count (int)
- property field_name¶
Gets field_name.
- Description:
Gets the name of the field with the specified index.
- Returns:
The value of field_name.
- Return type:
field_name (str)
- property field_prompt¶
Gets field_prompt.
- Description:
Gets the prompt of the field with the specified index.
- Returns:
The value of field_prompt.
- Return type:
field_prompt (str)
Gets related_table_values.
- Description:
A collection of all tables that have data related to the parent object
- Remarks:
Introduced in Impact 11.0.0.27
- Returns:
The value of related_table_values.
- Return type:
- property unit_settings¶
Gets unit_settings.
- Description:
Settings that affect both reading and writing values in string format, or when using native VARIANT types.
- Remarks:
The unit_settings will affect both reading and writing values in string format. When reading, string values will be formatted using the appropriate unit settings including the specified locale. When writing string values, the unit settings will affect the parsing of values. The unit_settings will also affect both reading and writing values using native VARIANT data types as well. For Impact’s internal types such as distances, angles, areas, weights and volumes the unit settings will be used to convert double values from user values to internal values. For example if IUnitSettings.distance_type is dfInches then any double value read or written should be expressed as inches. Introduced in Impact 11.0.0.27
- Returns:
The value of unit_settings.
- Return type:
- property values_as_variants¶
Gets values_as_variants.
- Description:
Supports reading database values as native VARIANT data types (instead of strings).
- Remarks:
This property changes the behaviour of the Load and load_default methods. Usually these methods return values as strings. The values_as_variants property does not affect the reading of picture fields which are always returned as an array of bytes or variants (controlled by bytes_as_variant). Writing values as VARIANT data types using the Save method is always supported regardless of this property. The unit_settings can be used to change the units that VARIANT values are read/written in. Introduced in Impact 11.0.0.27
- Returns:
The value of values_as_variants.
- Return type:
values_as_variants (bool)
- do_update()¶
- Description:
Update the saved database values directly in the database.
- Remarks:
Note that from Impact 11.0.0.83, calling do_update on database values from a project’s IDatabaseItem will cause a project update to be recorded.
- ensure_exists(field_name)¶
- Description:
Ensures that the field with the given name exists in the values collection.
- Remarks:
If the named field does not already have an entry in the database_values, it will be given one. Normally this is just a NULL value, but certain special fields will get data appropriate to the project or layer attribute they represent. Eg LAYERS.L_NAME will be filled in with the name of the layer associated with the ILayer whose database_values are being ensured.
- Parameters:
field_name (str) – The name of the field to ensure.
- exists(field_name)¶
- Description:
Determines if a field with a specified name exists.
- Remarks:
To be clear, this method doesn’t check if a value is stored, but if the field name is actually valid for the context.
- Parameters:
field_name (str) – Specifies the name of the field to query.
- load(field_name)¶
- Description:
Loads the value of a specified field.
- Remarks:
By default, values are returned as strings. Set values_as_variants to true in order to retrieve the values as native VARIANT data types.
- Returns:
The values from the database (as a string, by default).
- Parameters:
field_name (str) – Specifies the name of the field to load.
- load_default(field_name, default)¶
- Description:
Loads the value of a specified field.
- Parameters:
field_name (str) – Specifies the name of the field to load.
default (any) – Specifies the default value to use if the field does not exist.
- prompt(field_name)¶
- Description:
Gets the prompt for the field name specified.
- Parameters:
field_name (str) – Specifies the name of the field to get the prompt for.
- refresh()¶
- Description:
Refresh the database values.
- Remarks:
This method only applies to IDatabaseValue objects that represent database values directly from a database table. It does not apply to database_values from IDrawing or ILayer objects.
- save(field_name, field_value)¶
- Description:
Saves the value of a specified field.
- Remarks:
If the IDatabaseValue object represents database values directly from a database table then you must use the do_update method to store these values into the database. This enables you to Save multiple values before calling do_update to write the values to the database.
- Parameters:
field_name (str) – Specifies the name of the field to save.
field_value (any) – Specifies the value to save for the field_name.
- save_with_text_tokens(table_name, field_name, field_value, old_text_val, new_text_val)¶