[Jifty-commit] r2579 - in Jifty-DBI/branches/od: . lib/Jifty
lib/Jifty/DBI
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jan 26 06:50:40 EST 2007
Author: audreyt
Date: Fri Jan 26 06:50:37 2007
New Revision: 2579
Modified:
Jifty-DBI/branches/od/ (props changed)
Jifty-DBI/branches/od/Changes
Jifty-DBI/branches/od/lib/Jifty/DBI.pm
Jifty-DBI/branches/od/lib/Jifty/DBI/Column.pm
Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm
Jifty-DBI/branches/od/t/06filter_truncate.t
Log:
* Merge from trunk.
* Changelog for 0.31.
* POD and example style cleanup.
Modified: Jifty-DBI/branches/od/Changes
==============================================================================
--- Jifty-DBI/branches/od/Changes (original)
+++ Jifty-DBI/branches/od/Changes Fri Jan 26 06:50:37 2007
@@ -1,6 +1,8 @@
Revision history for Perl extension Jifty::DBI.
- load, load_by_cols, load_from_hash and create are now optionally class methods.
+- "length is 42" in schema declarations is deprecated; please write "max_length is 42" instead.
+- Jifty::DBI::Collection - document the "LIKE" and "MATCHES" limit operators correctly.
0.30 Wed Jan 17 15:29:44 EST 2007
Modified: Jifty-DBI/branches/od/lib/Jifty/DBI.pm
==============================================================================
--- Jifty-DBI/branches/od/lib/Jifty/DBI.pm (original)
+++ Jifty-DBI/branches/od/lib/Jifty/DBI.pm Fri Jan 26 06:50:37 2007
@@ -84,22 +84,20 @@
First, let's define our record class in a new module named "Simple.pm".
-
use warnings;
use strict;
-
- package Simple::Schema;
+
+ package Simple;
use Jifty::DBI::Schema;
-
- column foo => type is 'text';
- column bar => type is 'text';
-
- package Simple;
- use base qw(Jifty::DBI::Record);
+ use Jifty::DBI::Record schema {
+ column foo => type is 'text';
+ column bar => type is 'text';
+ };
# your custom code goes here.
1;
+
Like all perl modules, this needs to end with a true value.
Now, on to the code that will actually *do* something with this object.
@@ -111,7 +109,7 @@
Use two packages, the first is where I get the DB handle from, the latter
is the object I just created.
-
+
my $handle = Jifty::DBI::Handle->new();
$handle->connect(
driver => 'Pg',
@@ -120,15 +118,15 @@
user => 'mhat',
password => ''
);
-
+
Creates a new Jifty::DBI::Handle, and then connects to the database using
that handle. Pretty straight forward, the password '' is what I use
when there is no password. I could probably leave it blank, but I find
it to be more clear to define it.
-
+
my $s = Simple->new( handle => $handle );
-
+
$s->load_by_cols(id=>1);
@@ -207,4 +205,5 @@
=cut
+h
1;
Modified: Jifty-DBI/branches/od/lib/Jifty/DBI/Column.pm
==============================================================================
Modified: Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm (original)
+++ Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm Fri Jan 26 06:50:37 2007
@@ -356,6 +356,7 @@
L<Jifty::DBI::Filter::Truncate>. Note that this is in B<bytes>, not
B<characters>. Correct usage is C<max_length is 42>.
+
=head2 mandatory
Mark as a required column. May be used for generating user
Modified: Jifty-DBI/branches/od/t/06filter_truncate.t
==============================================================================
--- Jifty-DBI/branches/od/t/06filter_truncate.t (original)
+++ Jifty-DBI/branches/od/t/06filter_truncate.t Fri Jan 26 06:50:37 2007
@@ -142,12 +142,12 @@
column name =>
type is 'varchar(10)',
- length is 10,
+ max_length is 10,
default is '';
column disabled =>
type is 'int(4)',
- length is 4,
+ max_length is 4,
default is 0;
}
}
More information about the Jifty-commit
mailing list