function tripal_core_chado_clear_prepared

1.x tripal_core_chado.api.inc tripal_core_chado_clear_prepared($statement_name_regex = NULL)

Clears prepared statements to avoid conflicts

If no statement_name_regex is supplied then it clears ALL prepared statements; Otherwise, it clears prepared statement names that match the regex provided

1 call to tripal_core_chado_clear_prepared()
tripal_bulk_loader_load_data in tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc
Tripal Bulk Loader

File

tripal_core/api/tripal_core_chado.api.inc, line 3178
The Tripal Core API

Code

function tripal_core_chado_clear_prepared($statement_name_regex = NULL) {
  global $prepared_statements;

  if ($statement_name_regex) {
    $resource = chado_query("SELECT * FROM pg_catalog.pg_prepared_statements WHERE name~'%s'", $statement_name_regex);
    while ($r = db_fetch_object($resource)) {
      $k = array_search($r->name, $prepared_statements);
      unset($prepared_statements[$k]);
      chado_query('DEALLOCATE PREPARE %s', $r->name);
    }
  }
  else {
    $prepared_statements = array();
    chado_query('DEALLOCATE PREPARE ALL');
  }
}