Tripal
|
Functions | |
chado_edit_custom_table (int $table_id, string $table_name, array $schema, bool $skip_if_exists=True) | |
chado_create_custom_table (string $table, array $schema, bool $skip_if_exists=TRUE, int $mview_id=NULL, bool $redirect=TRUE) | |
chado_validate_custom_table_schema ($schema_array) | |
chado_get_custom_table_id (string $table_name) | |
chado_get_custom_table_names ($include_mview=TRUE) | |
chado_delete_custom_table (int $table_id) | |
Provides an application programming interface (API) for managing Chado tables.
chado_create_custom_table | ( | string | $table, |
array | $schema, | ||
bool | $skip_if_exists = TRUE , |
||
int | $mview_id = NULL , |
||
bool | $redirect = TRUE |
||
) |
Add a new table to the Chado schema.
Please use the new "tripal_chado.custom_table" service instead.
WARNING This function only supports creation of custom tables in the default Chado schema. Also, for Tripal v4 the $redirect and $mview_id arguments no longer have meaning.
This function is simply a wrapper for built-in database functionality provided by Drupal, but ensures the table is created inside the Chado schema rather than the Drupal schema.
If the table already exists then it will be dropped and recreated using the schema provided. However, it will only drop a table if it exsits in the tripal_custom_tables table. This way the function cannot be used to accidentally alter existing non custom tables. If $skip_if_exists is set then the table is simply added to the tripal_custom_tables and no table is created in Chado.
string | $table | The name of the custom table. |
array | $schema | An array contiaining a Drupal table schema definition |
bool | $skip_if_exists | True to skip changing the table if it exists. False, to change the table. This may result in lost data. |
int | $mview_id | If this custom table is a materialized view, the mview ID. |
bool | $redirect | If this form should redirect to a new page. |
Drupal\tripal_chado\Database\ChadoConnection | $chado | A ChadoConnection instance. If none is proivded then the default chado installation is used. |
chado_delete_custom_table | ( | int | $table_id | ) |
Deletes the specified table
Please use the new "tripal_chado.custom_table" service instead.
WARNING: This function only supports deleting custom tables in the default Chado schema.
int | $table_id | The numeric custom table ID. |
chado_edit_custom_table | ( | int | $table_id, |
string | $table_name, | ||
array | $schema, | ||
bool | $skip_if_exists = True |
||
) |
Edits a known custom table in the chado database.
Please use the new "tripal_chado.custom_table" service instead.
WARNING This function only supports editing of custom tables in the default Chado schema.
"Known" custom tables are tables that exist in the tripal_custom_tables already. If it is not in tripal_custom_tables, or the specified table does not exist, it will not attempt to make changes. It will also fail if the specified table is a materialized view.
int | $table_id | The numeric custom table ID. |
string | $table_name | The table name, |
array | $schema | An array containing the Drupal table schema. |
bool | $skip_if_exists | True if the table should not be changed if it already exists. False, to change it regardles. |
chado_get_custom_table_id | ( | string | $table_name | ) |
Retrieve the custom table ID of the specified name
Please use the \Drupal\tripal_chado\ServicesChadoCustomTable::findByName() funct instead.
string | $table_name | The name of the custom table. |
chado_get_custom_table_names | ( | $include_mview = TRUE | ) |
Retrieve a list of all Chado custom table names.
Please use the \Drupal\tripal_chado\Services\ChadoCustomTable::getTables() function instead.
WARNING: This function only supports geting custom tables in the default Chado schema.
boolean | $include_mview | True if the list of custom tables should include materialized views. |
chado_validate_custom_table_schema | ( | $schema_array | ) |
Validate a Drupal Schema API array prior to creating a custom table.
Please use the \Drupal\tripal_chado\ChadoCustomTables\ChadoCustomTable::validateTableSchema() function instead.
This function can be used in a form validate function or whenever a schema is provided by a user and needs validation.
array | $schema_array | An Drupal Schema API compatible array |