| 1 | =head1 LICENSE | ||
| 2 | |||
| 3 | See the NOTICE file distributed with this work for additional information | ||
| 4 | regarding copyright ownership. | ||
| 5 | |||
| 6 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 7 | you may not use this file except in compliance with the License. | ||
| 8 | You may obtain a copy of the License at | ||
| 9 | |||
| 10 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | |||
| 12 | Unless required by applicable law or agreed to in writing, software | ||
| 13 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 15 | See the License for the specific language governing permissions and | ||
| 16 | limitations under the License. | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | =head1 CONTACT | ||
| 21 | |||
| 22 | Please email comments or questions to the public Ensembl | ||
| 23 | developers list at <http://lists.ensembl.org/mailman/listinfo/dev>. | ||
| 24 | |||
| 25 | Questions may also be sent to the Ensembl help desk at | ||
| 26 | <http://www.ensembl.org/Help/Contact>. | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | package Bio::EnsEMBL::DBSQL::Driver::Oracle; | ||
| 31 | $Bio::EnsEMBL::DBSQL::Driver::Oracle::VERSION = '114.0.0'; | ||
| 32 | use warnings; | ||
| 33 | use strict; | ||
| 34 | |||
| 35 | use Bio::EnsEMBL::Utils::Exception qw(warning); | ||
| 36 | |||
| 37 | use base 'Bio::EnsEMBL::DBSQL::Driver'; | ||
| 38 | |||
| 39 | sub new { | ||
| 40 | my ($self, @args) = @_; | ||
| 41 | warning(__PACKAGE__ . ' is untested and is being used only to collect Oracle-specific code'); | ||
| 42 | return $self->SUPER::new(@args); | ||
| 43 | } | ||
| 44 | |||
| 45 | sub connect_params { | ||
| 46 | my ($self, $conn) = @_; | ||
| 47 | |||
| 48 | my $host = $conn->host(); | ||
| 49 | my $dbname = $conn->dbname(); | ||
| 50 | my ($dsn, $username); | ||
| 51 | |||
| 52 | if (defined $host) { | ||
| 53 | my $port = $conn->port() || 1521; | ||
| 54 | $dsn = sprintf("DBI:Oracle://%s:%s/%s", $host, $port, $dbname); | ||
| 55 | $username = $conn->username(); | ||
| 56 | } else { | ||
| 57 | $dsn = "DBI:Oracle:"; | ||
| 58 | $username = sprintf("%s@%s", $conn->username(), $dbname ); | ||
| 59 | } | ||
| 60 | |||
| 61 | return { | ||
| 62 | dsn => $dsn, | ||
| 63 | username => $username, | ||
| 64 | password => $conn->password(), | ||
| 65 | attributes => { 'RaiseError' => 1, 'PrintError' => 0 }, | ||
| 66 | }; | ||
| 67 | } | ||
| 68 | |||
| 69 | 1; |