Provides an application programming interface (API) for describing Chado tables. This API consists of a set of functions, one for each table in Chado. Each function simply returns a Drupal style array that defines the table.
Because Drupal 6 does not handle foreign key (FK) relationships, however FK relationships are needed to for Tripal Views. Therefore, FK relationships have been added to the schema defintitions below.
The functions provided in this documentation should not be called as is, but if you need the Drupal-style array definition for any table, use the following function call:
$table_desc = chado_get_schema($table)
where the variable $table contains the name of the table you want to retireve. The chado_get_schema function determines the appropriate version of Chado and uses the Drupal hook infrastructure to call the appropriate hook function to retrieve the table schema.
◆ chado_column_exists()
chado_column_exists |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Check that any given column in a Chado table exists.
This function is necessary because Drupal's db_field_exists() will not look in any other schema but the one were Drupal is installed
- Parameters
-
$table | The name of the chado table. |
$column | The name of the column in the chado table. |
- Returns
- TRUE if the column exists for the table in the chado schema and FALSE if it does not.
◆ chado_dbschema_exists()
chado_dbschema_exists |
( |
|
$schema | ) |
|
Check that any given schema exists.
- Parameters
-
$schema | The name of the schema to check the existence of |
- Returns
- TRUE/FALSE depending upon whether or not the schema exists
◆ chado_get_base_tables()
chado_get_base_tables |
( |
| ) |
|
Returns all chado base tables.
Base tables are those that contain the primary record for a data type. For example, feature, organism, stock, are all base tables. Other tables include linker tables (which link two or more base tables), property tables, and relationship tables. These provide additional information about primary data records and are therefore not base tables. This function retrieves only the list of tables that are considered 'base' tables.
- Returns
- An array of base table names.
◆ chado_get_custom_table_schema()
chado_get_custom_table_schema |
( |
|
$table | ) |
|
Retrieves the schema in an array for the specified custom table.
- Parameters
-
$table | The name of the table to create. |
- Returns
- A Drupal-style Schema API array definition of the table. Returns FALSE on failure.
◆ chado_get_schema()
chado_get_schema |
( |
|
$table | ) |
|
Retrieves the chado tables Schema API array.
- Parameters
-
$table | The name of the table to retrieve. The function will use the appopriate Tripal chado schema API hooks (e.g. v1.11 or v1.2). |
- Returns
- A Drupal Schema API array defining the table.
◆ chado_get_table_names()
chado_get_table_names |
( |
|
$include_custom = NULL | ) |
|
Retrieves the list of tables in the Chado schema. By default it only returns the default Chado tables, but can return custom tables added to the Chado schema if requested
- Parameters
-
$include_custom | Optional. Set as TRUE to include any custom tables created in the Chado schema. Custom tables are added to Chado using the tripal_chado_chado_create_table() function. |
- Returns
- An associative array where the key and value pairs are the Chado table names.
◆ chado_get_version()
chado_get_version |
( |
|
$exact = FALSE , |
|
|
|
$warn_if_unsupported = FALSE |
|
) |
| |
Returns the version number of the currently installed Chado instance. It can return the real or effective version. Note, this function is executed in the hook_init() of the tripal_chado module which then sets the $GLOBAL['exact_chado_version'] and $GLOBAL['chado_version'] variable. You can access these variables rather than calling this function.
- Parameters
-
$exact | Set this argument to 1 to retrieve the exact version that is installed. Otherwise, this function will set the version to the nearest 'tenth'. Chado versioning numbers in the hundreds represent changes to the software and not the schema. Changes in the tenth's represent changes in the schema. |
$warn_if_unsupported | If the currently installed version of Chado is not supported by Tripal this generates a Drupal warning. |
- Returns
- The version of Chado
◆ chado_is_installed()
Check whether chado is installed (either in the same or a different database)
- Returns
- TRUE/FALSE depending upon whether chado is installed.
◆ chado_is_local()
Check that the Chado schema exists within the local database
- Returns
- TRUE/FALSE depending upon whether it exists
◆ chado_sequence_exists()
chado_sequence_exists |
( |
|
$sequence | ) |
|
Check that any given column in a Chado table exists.
This function is necessary because Drupal's db_field_exists() will not look in any other schema but the one were Drupal is installed
- Parameters
-
sequence | The name of the sequence |
- Returns
- TRUE if the seqeuence exists in the chado schema and FALSE if it does not.
◆ chado_table_exists()
chado_table_exists |
( |
|
$table | ) |
|
Check that any given Chado table exists.
This function is necessary because Drupal's db_table_exists() function will not look in any other schema but the one were Drupal is installed
- Parameters
-
$table | The name of the chado table whose existence should be checked. |
- Returns
- TRUE if the table exists in the chado schema and FALSE if it does not.
◆ checkColumnExists()
ChadoSchema::checkColumnExists |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Check that any given column in a Chado table exists.
This function is necessary because Drupal's db_field_exists() will not look in any other schema but the one were Drupal is installed
- Parameters
-
$table | The name of the chado table. |
$column | The name of the column in the chado table. |
- Returns
- TRUE if the column exists for the table in the chado schema and FALSE if it does not.
◆ checkColumnType()
ChadoSchema::checkColumnType |
( |
|
$table, |
|
|
|
$column, |
|
|
|
$expected_type = NULL |
|
) |
| |
Check that any given column in a Chado table exists.
This function is necessary because Drupal's db_field_exists() will not look in any other schema but the one were Drupal is installed
- Parameters
-
$table | The name of the chado table. |
$column | The name of the column in the chado table. |
$type | (OPTIONAL) The PostgreSQL type to check for. If not supplied it will be looked up via the schema (PREFERRED). |
- Returns
- TRUE if the column type matches what we expect and FALSE if it does not.
◆ checkSequenceExists()
ChadoSchema::checkSequenceExists |
( |
|
$table, |
|
|
|
$column |
|
) |
| |
Check that any given sequence in a Chado table exists.
- Parameters
-
table | The name of the table the sequence is used in. |
column | The name of the column the sequence is used to populate. |
- Returns
- TRUE if the seqeuence exists in the chado schema and FALSE if it does not.
◆ getBaseTables()
ChadoSchema::getBaseTables |
( |
| ) |
|
Returns all chado base tables.
Base tables are those that contain the primary record for a data type. For example, feature, organism, stock, are all base tables. Other tables include linker tables (which link two or more base tables), property tables, and relationship tables. These provide additional information about primary data records and are therefore not base tables. This function retrieves only the list of tables that are considered 'base' tables.
- Returns
- An array of base table names.