The specific case I had to deal with recently, when importing large quantities of data from an external website :

The DBA created a user account with SELECT only privileges for me. The weird (for me anyway, being used to MySQL way of things) was that the user had no tables - he had to switch to one of the alternate schemas available for him before actually having access to any tables.

In Oracle, that happens by running the

ALTER SESSION SET CURRENT_SCHEMA='mychema'

before anything else ( similar to the SET NAMES process in MySQL ). This was not possible with this module, resulting to a number of errors ( "no such table", etc ). The attached patch checks for an additional key to the configuration array, called 'alt_schema'. If it is found, it runs the above query when connecting.

If there is another (possibly more elegant) way of doing the above, please advise!

CommentFileSizeAuthor
migrate-AddOracleAltSchemaSupport.patch1.18 KBhexblot
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeryan’s picture

Issue summary: View changes
+++ b/plugins/sources/oracle.inc
@@ -99,6 +100,18 @@ class MigrateSourceOracle extends MigrateSource {
+      if(isset($this->configuration['alt_schema'])) {

Note Drupal coding conventions require a space after if.

Could someone other than the patch author test this and give it an RTBC?

Thanks.

mikeryan’s picture

Status: Needs review » Needs work
  1. +++ b/plugins/sources/oracle.inc
    @@ -99,6 +100,18 @@ class MigrateSourceOracle extends MigrateSource {
    +      if(isset($this->configuration['alt_schema'])) {
    

    All the if statements need a space after the if.

  2. +++ b/plugins/sources/oracle.inc
    @@ -99,6 +100,18 @@ class MigrateSourceOracle extends MigrateSource {
    +        $statement = oci_parse($this->connection, "ALTER SESSION SET CURRENT_SCHEMA='".check_plain($this->schema)."'");
    

    There is no $this->schema - I assume you meant $this->configuration['alt_schema']?

    Also note there should be spaces either side of the concatenation operator.