Author: spadkins
Date: Fri Nov 21 10:47:09 2008
New Revision: 12094
Modified:
p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm
p5ee/trunk/App-Repository/t/DBI-import.t
Log:
fix Oracle dsn if dbhost is given
Modified: p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository/Oracle.pm Fri Nov 21
10:47:09 2008
@@ -62,10 +62,15 @@
my $dbschema = $self->{dbschema};
my $dbioptions = $self->{dbioptions};
- $dsn = "dbi:${dbdriver}:${dbname}"; # NOTE: a blank ${dbname} is
allowed for an Oracle dsn
- $dsn .= ";host=$dbhost" if ($dbhost);
- $dsn .= ";port=$dbport" if ($dbport);
- $dsn .= ";$dbioptions" if ($dbioptions);
+ if ($dbhost || $dbport || $dbioptions) {
+ $dsn = "dbi:${dbdriver}:sid=${dbname}";
+ $dsn .= ";host=$dbhost" if ($dbhost);
+ $dsn .= ";port=$dbport" if ($dbport);
+ $dsn .= ";$dbioptions" if ($dbioptions);
+ }
+ else {
+ $dsn = "dbi:${dbdriver}:${dbname}"; # NOTE: a blank ${dbname} is
allowed for an Oracle dsn
+ }
}
&App::sub_exit($dsn) if ($App::trace);
Modified: p5ee/trunk/App-Repository/t/DBI-import.t
==============================================================================
--- p5ee/trunk/App-Repository/t/DBI-import.t (original)
+++ p5ee/trunk/App-Repository/t/DBI-import.t Fri Nov 21 10:47:09 2008
@@ -101,72 +101,4 @@
"insert row (primary key included, 0)");
}
-__END__
-
- ok($rep->_insert_row("test_person",
["person_id","age","first_name","gender","state"],
- [5, 1,"christine","F","GA"]),
- "insert again");
- ok($rep->_insert_row("test_person",
["person_id","age","first_name","gender","state"],
- [6,45,"tim", "M","GA"]),
- "insert again");
- ok($rep->_insert_row("test_person",
["person_id","age","first_name","gender","state"],
- [7,39,"keith", "M","GA"]),
- "insert again");
-
- ok($rep->insert("test_person", {
- person_id => 8,
- age => 35,
- first_name => "alex",
- gender => "M",
- state => "GA",
- }),
- "insert hash");
- eval {
- $rep->insert_row("test_person", {
- person_id => 8,
- age => 35,
- first_name => "alex",
- gender => "M",
- state => "GA",
- });
- };
- ok($@, "insert dup hash fails");
- ok($rep->insert("test_person", undef, {
- person_id => 9,
- age => 35,
- first_name => "alex",
- gender => "M",
- state => "GA",
- }),
- "insert hash in 2nd pos");
- ok($rep->insert("test_person", ["age","first_name","gender","state"], {
- person_id => 9,
- age => 35,
- first_name => "alex",
- gender => "M",
- state => "GA",
- }),
- "insert hash in 2nd pos w/ col spec");
- eval {
- $rep->insert_row("test_person", undef, {
- person_id => 9,
- age => 35,
- first_name => "alex",
- gender => "M",
- state => "GA",
- });
- };
- ok($@, "insert dup hash in 2nd pos fails");
- ok($rep->insert("test_person", undef, {
- person_id => 11,
- age => 999,
- first_name => '[EMAIL PROTECTED]'',
- gender => "M",
- state => "GA",
- }),
- "insert \\ and ' and \\' seems to work");
- is($rep->get("test_person",11,"first_name"),'[EMAIL PROTECTED]'', "yep.
first_name worked.");
-}
-
-exit 0;