Issue #2675000 by alexpott: SQLBase::mapjoinable does not support SQLite part 2
							parent
							
								
									73f91709fb
								
							
						
					
					
						commit
						72d53b30d1
					
				| 
						 | 
					@ -263,6 +263,15 @@ abstract class SqlBase extends SourcePluginBase implements ContainerFactoryPlugi
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    $id_map_database_options = $id_map->getDatabase()->getConnectionOptions();
 | 
					    $id_map_database_options = $id_map->getDatabase()->getConnectionOptions();
 | 
				
			||||||
    $source_database_options = $this->getDatabase()->getConnectionOptions();
 | 
					    $source_database_options = $this->getDatabase()->getConnectionOptions();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Special handling for sqlite which deals with files.
 | 
				
			||||||
 | 
					    if ($id_map_database_options['driver'] === 'sqlite' &&
 | 
				
			||||||
 | 
					      $source_database_options['driver'] === 'sqlite' &&
 | 
				
			||||||
 | 
					      $id_map_database_options['database'] != $source_database_options['database']
 | 
				
			||||||
 | 
					    ) {
 | 
				
			||||||
 | 
					      return FALSE;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    foreach (array('username', 'password', 'host', 'port', 'namespace', 'driver') as $key) {
 | 
					    foreach (array('username', 'password', 'host', 'port', 'namespace', 'driver') as $key) {
 | 
				
			||||||
      if (isset($source_database_options[$key])) {
 | 
					      if (isset($source_database_options[$key])) {
 | 
				
			||||||
        if ($id_map_database_options[$key] != $source_database_options[$key]) {
 | 
					        if ($id_map_database_options[$key] != $source_database_options[$key]) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -107,16 +107,33 @@ class SqlBaseTest extends UnitTestCase {
 | 
				
			||||||
        FALSE,
 | 
					        FALSE,
 | 
				
			||||||
        TRUE,
 | 
					        TRUE,
 | 
				
			||||||
        TRUE,
 | 
					        TRUE,
 | 
				
			||||||
        ['username' => 'different_from_map', 'password' => 'different_from_map'],
 | 
					        ['driver' => 'mysql', 'username' => 'different_from_map', 'password' => 'different_from_map'],
 | 
				
			||||||
        ['username' => 'different_from_source', 'password' => 'different_from_source'],
 | 
					        ['driver' => 'mysql', 'username' => 'different_from_source', 'password' => 'different_from_source'],
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
      // Returns true because source and id map connection options are the same.
 | 
					      // Returns true because source and id map connection options are the same.
 | 
				
			||||||
      [
 | 
					      [
 | 
				
			||||||
        TRUE,
 | 
					        TRUE,
 | 
				
			||||||
        TRUE,
 | 
					        TRUE,
 | 
				
			||||||
        TRUE,
 | 
					        TRUE,
 | 
				
			||||||
        ['username' => 'same_value', 'password' => 'same_value'],
 | 
					        ['driver' => 'pgsql', 'username' => 'same_value', 'password' => 'same_value'],
 | 
				
			||||||
        ['username' => 'same_value', 'password' => 'same_value'],
 | 
					        ['driver' => 'pgsql', 'username' => 'same_value', 'password' => 'same_value'],
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      // Returns false because driver is sqlite and the databases are not the
 | 
				
			||||||
 | 
					      // same.
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        FALSE,
 | 
				
			||||||
 | 
					        TRUE,
 | 
				
			||||||
 | 
					        TRUE,
 | 
				
			||||||
 | 
					        ['driver' => 'sqlite', 'database' => '1.sqlite', 'username' => '', 'password' => ''],
 | 
				
			||||||
 | 
					        ['driver' => 'sqlite', 'database' => '2.sqlite', 'username' => '', 'password' => ''],
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
 | 
					      // Returns false because driver is not the same.
 | 
				
			||||||
 | 
					      [
 | 
				
			||||||
 | 
					        FALSE,
 | 
				
			||||||
 | 
					        TRUE,
 | 
				
			||||||
 | 
					        TRUE,
 | 
				
			||||||
 | 
					        ['driver' => 'pgsql', 'username' => 'same_value', 'password' => 'same_value'],
 | 
				
			||||||
 | 
					        ['driver' => 'mysql', 'username' => 'same_value', 'password' => 'same_value'],
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
    ];
 | 
					    ];
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue