You are here

function migrate_example_oracle_uninstall in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate_example/migrate_example_oracle/migrate_example_oracle.install \migrate_example_oracle_uninstall()

Implements hook_uninstall().

File

migrate_example/migrate_example_oracle/migrate_example_oracle.install, line 82
Set up the Oracle migration example module.

Code

function migrate_example_oracle_uninstall() {
  global $conf;
  $connection = @oci_connect($conf['oracle_db']['username'], $conf['oracle_db']['password'], $conf['oracle_db']['connection_string'], 'UTF8');
  if (!$connection) {
    $e = oci_error();
    throw new Exception($e['message']);
  }

  // Get rid of the test data
  // This SQL from http://dbaforums.org/oracle/index.php?showtopic=4990.
  $query = "begin execute immediate 'drop table ORACLE_CONTENT'; exception when others then null; end;";
  $result = oci_parse($connection, $query);
  if (!$result) {
    $e = oci_error($connection);
    throw new Exception($e['message'] . "\n" . $e['sqltext']);
  }
  $status = oci_execute($result);
  if (!$status) {
    $e = oci_error($result);
    throw new Exception($e['message'] . "\n" . $e['sqltext']);
  }
}