Tutorial Toolkit Function Descriptions > Model > User Defined
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
User Defined
A table is provided in the database which is reserved for use by the user. It can store arrays of data for all types (integer,real,logical,strings). The table entries can be assigned arbitrary types ( as integer values) to allow multiple uses. The user can create, count, delete and retrieve the table entries as needed. Each table entry is assigned a label for easy reference.
 
db_create_client_data
(id, client_label, client_type, num_logicals, num_integers, num_reals, num_strings, max_string_length, p_logical_data, p_integer_data, p_real_data, p_string_data)
Description:
Creates a client defined entity in the database.
Input:
INTEGER
client_label
The external id of the db entity being created. if input as ”0”, the database will assign a label. if a number is input, the database will ensure that it is not a duplicate, then insert it.
INTEGER
client_type
Type of data uniquely defined by the client.
INTEGER
num_logicals
The number of logical data items being associated with this entity.
INTEGER
num_integers
The number of integer data items being associated with this entity.
INTEGER
num_reals
The number of real data items being associated with this entity.
INTEGER
num_strings
The number of real data items being associated with this entity.
INTEGER
max_string_length
The maximum length of any one string.
LOGICAL
p_logical_data
Pointer to an array of logicals.
INTEGER
p_integer_data
Pointer to an array of integers.
REAL
p_real_data
Pointer to an array of reals.
STRING
p_string_data[]
Pointer to an array of strings.
Output:
INTEGER
id
This filed receives the id of the client db entity that was just created. this is the uniques database identifier for the entity.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000002
Unrecoverable database error.
13000004
Duplicate entry exists in table.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Creates one record in the “xxx_client_entity” table in the database. Also, depending upon the input data, this routine creates zero or more records in the “xxx_client_interger_data”, or “xxx_client_logical_data”, or “xxx_client_real_data”, or
Example:
Please see db_create_client_data (p. 15) in the MSC Acumen Toolkit - Code Examples.
 
db_count_client_labels_by_type
( client_type, nbr_of_labels)
 
Description:
Returns the number of all labels with a specified type.
Input:
INTEGER
client_type
Type of data uniquely defined by the client.
Output:
INTEGER
nbr_of_labels
The number of all labels.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000126
Label not found.
13000007
other database error.
Example:
Please see db_count_client_labels_by_type (p. 10) in the MSC Acumen Toolkit - Code Examples.
  
db_count_general_field
( <field_id>, <count>)
Description:
This function returns the count of terms in a field. It returns an integer status of 0 on success and 1 on failure.
Input:
INTEGER
field_id
The id of the field.
Output:
INTEGER
count
The count of term_ids in the field.
INTEGER
<Return Value>
0 for success and 1 for failure.
Error Conditions:
None.
Example:
db_count_general_field (p. 12) in the MSC Acumen Toolkit - Code Examples.
 
db_get_all_client_data
(id, num_logicals, num_integers, num_reals, num_strings, max_string_length, p_logical_data, p_integer_data, p_real_data, p_string_data)
 
Description:
Gets all data related to a specified client data entity from the database.
Input:
INTEGER
id
Id of the client entity for which data is requested.
INTEGER
num_logicals
Num of logical numbers for which storage has been allocated by the calling routine.
INTEGER
num_integers
Num of integer numbers for which storage has been allocated by the calling routine.
INTEGER
num_reals
Num of real numbers for which storage has been allocated by the calling routine.
INTEGER
num_strings
Num of strings for which storage has been allocated by the calling routine.
INTEGER
max_string_length
Max number of characters to copy into p_string buffer.
Output:
LOGICAL
p_logical_data(num_logicals)
Pointer to an array of logicals.
INTEGER
p_integer_data()
Pointer to an array of integers.
REAL
p_real_data()
Pointer to an array of reals.
STRING
p_string_data[]()
Pointer to an array of characters.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
DbFUBAR
DbClientEntityNotFound
DbOtherFailure
External Dependencies and Side Effects:
Accesses multiple records in the “xxx_client_integer_data”, “xxx_client_logical_data”, “xxx_client_real_data”, “xxx_client_string_data” in the database.
Example:
Please see db_get_all_client_data (p. 18) in the MSC Acumen Toolkit - Code Examples.
 
db_get_client_data
(client_label,id,client_type,num_logicals, num_integers, num_reals, num_strings, max_string_length)
Description:
Gets a client data entity from the database by user defined label.
Input:
INTEGER
client_label
External id for the user defined entity.
Output:
INTEGER
id
Internal id for the user defined entity.
INTEGER
client_type
Type of data uniquely defined by the client.
INTEGER
num_logicals
The number of logical data items being associated with this entity.
INTEGER
num_integers
The number of integer data items being associated with this entity.
INTEGER
num_reals
The number of real data items being associated with this entity.
INTEGER
num_strings
The number of string items being associated with this entity.
INTEGER
max_string_length
The maximum length of any one string.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000002
Unrecoverable database error.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Accesses one record in the “xxx_client_data” table in the database.
Example:
See example for db_get_client_data (p. 20) in the MSC Acumen Toolkit - Code Examples.
 
db_get_client_id_by_label
(client_label, id)
Description:
Returns client id given the label.
Input:
INTEGER
client_label
The client label.
Output:
INTEGER
id
The client id corresponding to the label.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000126
The entity specified in the query was not labeled.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Accesses a record in the “xxx_client_entity” table.
Example:
Please see db_get_client_id_by_label (p. 22) in the MSC Acumen Toolkit - Code Examples.
 
db_get_client_labels_by_type
(client_type, labels)
Description:
Returns all labels with a specified type.
Input:
INTEGER
client_type
Type of data uniquely defined by the client.
Output:
INTEGER
labels()
An array of labels.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000201
The specified client entity was not found.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Accesses multiple records in the “xxx_client_entity” table.
Example:
Please see db_get_client_labels_by_type (p. 26) in the MSC Acumen Toolkit - Code Examples.
 
db_get_client_label_by_id
(id, client_label)
 
Description:
Returns client label given the id.
Input:
INTEGER
id
The client id.
Output:
INTEGER
client_label
The label corresponding to the id.
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000201
The specified client entity was not found.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Accesses a record in the “xxx_client_entity” table.
Example:
Please see db_get_client_label_by_id (p. 24) in the MSC Acumen Toolkit - Code Examples.
 
db_get_next_client_entity_label
(label)
Description:
This function will get the value of the next available client entity label from the database. This value should be equal to the highest value client entity label in use plus one.
Input:
none
Output:
INTEGER
label
Highest entity label used.
INTEGER
<Return Value>
This value returns the next available client entity label.
Error Conditions:
13000201
The specified client entity was not found.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Selects the largest client_entity_label from the database.
Example:
Please see db_get_next_client_entity_label (p. 36) in the MSC Acumen Toolkit - Code Examples.
 
db_delete_client_data
(label)
 
Description:
Delete client data from the database.
Input:
INTEGER
label
User defined label of the data to be deleted.
Output:
INTEGER
<Return Value>
Integer indicating success or failure of the routine. If the routine failed, this value contains an indication of the reason.
Error Conditions:
13000201
The specified client entity was not found.
13000007
An unspecified database error occurred.
External Dependencies and Side Effects:
Deletes one record in the “xxx_client_entity” table in the database, and depending on the client data, all associated records.
Example:
Please see db_delete_client_data (p. 16) in the MSC Acumen Toolkit - Code Examples.