DBIO::Oracle
Oracle database driver for DBIO (fork of DBIx::Class).
Supports
- desired-state deployment via test-deploy-and-compare (DBIO::Oracle::Deploy)
- native introspection (DBIO::Oracle::Introspect)
- native diff (DBIO::Oracle::Diff)
- native DDL generation (DBIO::Oracle::DDL)
Usage
package MyApp::DB;
use base 'DBIO::Schema';
__PACKAGE__->load_components('Oracle');
my $schema = MyApp::DB->connect('dbi:Oracle:database=myapp');
DBIO core autodetects dbi:Oracle: DSNs and loads this storage automatically.
Oracle Features
Types
NUMBER,INTEGER,BINARY_FLOAT- numeric typesVARCHAR2,CHAR,CLOB,NCLOB- string typesBLOB,RAW,LONG RAW- binary typesDATE,TIMESTAMP,INTERVAL- temporal types
Schema Support
USER_TAB_COLUMNS,USER_TABLESfor introspectionUSER_SEQUENCESfor sequence-based auto-increment- Oracle-specific sequence objects
Introspection (USER_, ALL_)
USER_TABLES- table metadataUSER_TAB_COLUMNS- column metadataUSER_INDEXES,USER_IND_COLUMNS- index informationUSER_CONSTRAINTS,USER_CONS_COLUMNS- constraints
Oracle-Specific
- Sequence-based auto-increment (
SELECT seq.nextval FROM dual) RETURNING INTOclause for inserted row retrieval- Advanced queuing (AQ) support
- Flashback queries
- Database links
Deploy
DBIO::Oracle::Deploy orchestrates test-deploy-and-compare:
- Introspect live database via USER_* views (DBIO::Oracle::Introspect)
- Deploy desired schema to a temporary tablespace
- Introspect the temporary schema the same way
- Diff source vs target (DBIO::Oracle::Diff)
Install (install_ddl) creates fresh schema. Upgrade diffs live vs. desired.
Testing
Requires a running Oracle instance:
export DBIO_TEST_ORA_DSN="dbi:Oracle:host=localhost;service_name=myapp"
export DBIO_TEST_ORA_USER=myapp
export DBIO_TEST_ORA_PASS=secret
prove -l t/
Requirements
- Perl 5.36+
- DBD::Oracle
- DBIO core
See Also
DBIO::Introspect::Base, DBIO::Diff::Base, DBIO::Deploy