You are here

public function MigrateSourceOracle::computeCount in Migrate 6.2

Same name and namespace in other branches
  1. 7.2 plugins/sources/oracle.inc \MigrateSourceOracle::computeCount()

Return a count of all available source records.

File

plugins/sources/oracle.inc, line 126
Define a MigrateSource class for importing from Oracle databases.

Class

MigrateSourceOracle
Implementation of MigrateSource, to handle imports from remote Oracle servers.

Code

public function computeCount() {
  migrate_instrument_start('MigrateSourceOracle count');
  if ($this
    ->connect()) {
    $statement = oci_parse($this->connection, $this->countQuery);
    if (!$statement) {
      $e = oci_error($this->connection);
      throw new Exception($e['message'] . "\n" . $e['sqltext']);
    }
    $result = oci_execute($statement);
    if (!$result) {
      $e = oci_error($statement);
      throw new Exception($e['message'] . "\n" . $e['sqltext']);
    }
    $count_array = oci_fetch_array($statement);
    $count = reset($count_array);
  }
  else {

    // Do something else?
    $count = FALSE;
  }
  migrate_instrument_stop('MigrateSourceOracle count');
  return $count;
}