ORLite

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.53      2012-02-21
	- Add a ->id convenience method alias when table 'foo' has a single
	  numeric primary key 'foo_id' so you can use $foo->id

1.52      2012-01-21
	- Added initial unicode => 1 support (MEMOWE)
	- Bumped Params::Util dependency to 1.0 for *LIKE fixes (ADAMK)

1.51      2011-11-25
	- Module::Install::DSL updated to 1.04
	- Automatically load overlay classes if there exist. That is, where a
	  Foo/TableName.pm module exists in addition to the automatically
	  generated Foo::TableName class.

1.50      2011-06-07
	- Removed normalize as a supported parameter, normalizing columns turns
	  out not to work in practice. However, we always normalize tables to
	  get the class name for the table as that seems to result in class
	  names that make much more sense.

1.49      2011-06-01

MANIFEST  view on Meta::CPAN

t/16_array_create.t
t/17_cache.sql
t/17_cache.t
t/18_update.sql
t/18_update.t
t/19_view.sql
t/19_view.t
t/20_shim.t
t/21_normalize.sql
t/21_normalize.t
t/22_overlay.t
t/23_unicode.sql
t/23_unicode.t
t/24_rowid.sql
t/24_rowid.t
t/25_blob.sql
t/25_blob.t
t/lib/LocalTest.pm
t/lib/MyDB/TableOne.pm
xt/author/00-compile.t
xt/author/clean-namespaces.t

lib/ORLite.pm  view on Meta::CPAN


When called, ORLite generates two types of packages.

Firstly, it builds database connectivity, transaction support, and other
purely database level functionality into your root namespace.

Secondly, it will create one sub-package underneath the namespace of the root
module for each table or view it finds in the database.

Once the basic table support has been generated, it will also try to load an
"overlay" module of the same name. Thus, by created a Foo::TableName module on
disk containing "extra" code, you can extend the original and add additional
functionality to it.

=head1 OPTIONS

ORLite takes a set of options for the class construction at compile time
as a HASH parameter to the "use" line.

As a convenience, you can pass just the name of an existing SQLite file
to load, and ORLite will apply defaults to all other options.

t/22_overlay.t  view on Meta::CPAN

#!/usr/bin/perl

# Tests that overlay modules are automatically loaded

BEGIN {
	$|  = 1;
	$^W = 1;
}

use Test::More tests => 7;
use File::Spec::Functions ':ALL';
use lib 't/lib';
use LocalTest;

t/22_overlay.t  view on Meta::CPAN


is(
	MyDB::TableOne->count,
	2,
	'Count found 2 rows',
);

SCOPE: {
	my $object = MyDB::TableOne->load(1);
	isa_ok( $object, 'MyDB::TableOne' );
	is( $object->dummy, 2, '->dummy ok (overlay was loaded)' );
}



( run in 0.250 second using v1.01-cache-2.11-cpan-26ccb49234f )