Re: [RDBO] object caching functionality

2007-04-17 Thread John Siracusa
On 4/17/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > i've also started playing around with something that will make you > cringe, or perhaps chime in with suggestions and enthusiasm ! > > object_tree_as_storable > object_tree_from_storable > > right now they're being made trave

Re: [RDBO] object caching functionality

2007-04-16 Thread John Siracusa
On 4/16/07 12:22 PM, John Siracusa wrote: > How about "object_tree" instead of just "object" to better indicate that > input/output isn't just a long object: ^ Er, "lone" -John

Re: [RDBO] object caching functionality

2007-04-16 Thread John Siracusa
On 4/16/07 12:07 PM, Jonathan Vanasco wrote: > i'm thinking of the following naming scheme: > Helpers::object_as_yaml > Helpers::init_with_yaml_object > > ( using the term 'object' as it is a deep 'loaded related' object, > not a flat column/pairs ) How about "object_tree" instead of just "object

Re: [RDBO] Column "is not null"

2007-04-16 Thread John Siracusa
On 4/16/07 10:26 AM, Ovid wrote: > I can't find this in the docs, but I'm wondering how I go about an 'is > not null' search. query => [ '!install_vlan' => undef ], http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/QueryBuilder.p m#query The example below should work too, but cur

Re: [RDBO] 4 key map table advice sought

2007-04-16 Thread John Siracusa
On 4/16/07 10:02 AM, Jonathan Vanasco wrote: > MyRose::Object::Product > relationships => [ > colors => { > type=> 'many to many', > map_class => 'MyRose::Object:: Product2Color', > map_from => 'product_id', > map_to => 'c

Re: [RDBO] Status of Aggregates?

2007-04-15 Thread John Siracusa
On 4/13/07 11:08 PM, Bill Moseley wrote: > On Fri, Apr 13, 2007 at 07:40:04PM -0700, Bill Moseley wrote: >> This is still the current situation?: >> >> http://www.dev411.com/blog/2006/05/31/rose-db-object-aggregates >> >> i.e. Run you own SQL directly with DBI or use Views and a create a >> t

Re: [RDBO] using functions

2007-04-15 Thread John Siracusa
On 4/14/07 1:16 AM, Jonathan Vanasco wrote: > is there a way to get Rose to search based on functions? > > ie: > bad > SELECT * FROM useraccount WHERE email = ? > good > SELECT * FROM useraccount WHERE lower(email) = lower(?) See this thread for some earlier discussion on this topic: http://www.

Re: [RDBO] Does build_select() Support the "offset" argument?

2007-04-13 Thread John Siracusa
as a general-purpose replacement for SQL::Abstract! :) As I said earlier: > On 3/27/07, John Siracusa <[EMAIL PROTECTED]> wrote: >> QueryBuilder was always meant as an internal tool first (used by Manager) >> that just happens to expose a subset of its functionality publicly. A

Re: [RDBO] dbh caching

2007-04-13 Thread John Siracusa
On 4/13/07, Ovid <[EMAIL PROTECTED]> wrote: > --- Bill Moseley <[EMAIL PROTECTED]> wrote: >> I would expect that most applications need a shared dbh -- anything >> that uses transactions, of course. And, therefore perhaps there was a >> standard approach. > > You know, I was rather surprised about

Re: [RDBO] dbh caching

2007-04-12 Thread John Siracusa
On 4/12/07 10:11 PM, Bill Moseley wrote: > Ok, I just have to ask. What are people doing for dbh caching? > I know this comes up often: > > http://thread.gmane.org/gmane.comp.lang.perl.modules.dbi.rose-db-object/1138/f > ocus=1140 > > [...] I'm also still trying to understand the point of a n

Re: [RDBO] map_records when I don't want 'em

2007-04-11 Thread John Siracusa
On 4/11/07, Derek Watson <[EMAIL PROTECTED]> wrote: > What I really want to be able to do is (using an m-to-m's add_on_save) > > my $item = My::DBO::Item->new(); > $package->add_items($item);# related by an m-to-m with add_on_save > $item->map_record->notes('save me too'); # does map_record eve

Re: [RDBO] Possible to use load() to get a exclusive lock???

2007-04-11 Thread John Siracusa
On 4/10/07, Jeffrey Horn <[EMAIL PROTECTED]> wrote: > I'd like to actually get an exclusive lock on the record at load > time. I'd usually do a "SELECT ... FOR UPDATE" to do this in MySQL. Can I > get that behavior using just the load method above? No, but "select for update" is on my to-do list

Re: [RDBO] map_records when I don't want 'em

2007-04-10 Thread John Siracusa
On 4/10/07, Derek Watson <[EMAIL PROTECTED]> wrote: > I am creating objects from a Manager call: > > my $items= My::DBO::Manager::Item->get_items( > query => [ > sku => int($sku), > active => 1, > ], > ); > > But they have map_records that I don't want > > foreach my $item (

Re: [RDBO] Read-only objects

2007-04-06 Thread John Siracusa
On 4/5/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > Any chance of these features being pushed back into rose? The first thing you're likely to see is support for triggers on save, insert, update, and delete because overriding some of those "correctly" (handling transactions and so on) takes s

Re: [RDBO] Read-only objects

2007-04-04 Thread John Siracusa
On 4/4/07 12:37 PM, Adrian Howard wrote: > Since there are at least three folk who have wanted this sort of > functionality - would it be worth adding something like > is_initialising() to Rose::DB::Object::Util? Just to prevent > gratuitous wheel reinvention :-) No, since that'd require extra ove

Re: [RDBO] Read-only objects

2007-04-04 Thread John Siracusa
On 4/4/07 12:05 PM, Ovid wrote: > Note the 'return' condition. I found that if I didn't have that in, > the following would throw an exception: > > my $os = Donhost::OS->new( os => 'ubuntu' ); > > The hack guarantees that only things like the following throwing > exceptions: > > $os->os('wi

Re: [RDBO] Overriding the metadata class

2007-04-03 Thread John Siracusa
On 4/3/07, Randal L. Schwartz wrote: > sub make_clone { > ## clone the object except for primary keys and new items > my $self = shift; > my %updates = @_; > > my $new = (ref $self)->new; > for my $column ($new->meta->columns) { > my $getter = $column->acc

Re: [RDBO] Overriding the metadata class

2007-04-03 Thread John Siracusa
On 4/3/07, Ovid <[EMAIL PROTECTED]> wrote: > What we're trying to do is use an ORM to make it easy to pull all > database knowledge into a given layer and actually expose *very* little > of structure, just the functionality. However, because surrogate > (non-identifying) keys are rarely used, I ha

Re: [RDBO] Overriding the metadata class

2007-04-03 Thread John Siracusa
On 4/3/07 5:31 AM, Ovid wrote: > One problem is that the return value of add_columns() is actually the new > number of columns in the 'columns_ordered' attribute, not the columns > themselves Doh! Fixed in SVN. > To be fair, I'm going to have to alter even this. I've realized that > I'm making

Re: [RDBO] Overriding the metadata class

2007-04-02 Thread John Siracusa
On 4/2/07, Ovid <[EMAIL PROTECTED]> wrote: > I didn't see it in the docs, but is there anything akin to 'mutator' > metadata which would let me do something like the following? > > foreach my $method ( $class->mutators ) { > $self->make_override( $method ); > } > > The 'mutators' would retu

Re: [RDBO] Overriding the metadata class

2007-04-02 Thread John Siracusa
On 4/2/07, [EMAIL PROTECTED] wrote: > sub setup { > my ( $self, %arg_for ) = @_; > $self->SUPER::setup(%arg_for); > foreach my $column ( $self->columns ) { > my $name = $column->name; > > # here's the problem > $self->alias_column( $name => "_$name"

Re: [RDBO] docs request

2007-04-02 Thread John Siracusa
On 4/2/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > I'm adding a new table with 2 unique indexes / keys on it , one of > which is a multiple column key. the docs are really unclear on how > thats done in the setup. http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata.pm#uni

Re: [RDBO] Loader: request and doc change

2007-04-02 Thread John Siracusa
On 4/2/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > doc change: > with_managers seems to default to true , it should be listed as such It is. File: lib/Rose/DB/Object/Loader.pm ... =item B If true, create L-derived manager classes for each L subclass. Defaults to the value of the l

Re: [RDBO] Best way to do multiple calls to database

2007-03-29 Thread John Siracusa
On 3/29/07 6:27 AM, James Masters wrote: > So now $products is an array of all product information, just > like %product was a hash of all product info. But how do I > elegantly get that stock quantity info for a particular location > out of the $products array? I need something like: > > foreac

Re: [RDBO] Rose::DB::Loader (aka feeling dim)

2007-03-28 Thread John Siracusa
On 3/28/07, Adrian Howard <[EMAIL PROTECTED]> wrote: > CREATE TABLE products ( > id SERIAL NOT NULL PRIMARY KEY, > nameVARCHAR(255) NOT NULL, > vendor_id INT REFERENCES vendors (id), > UNIQUE(name) > ) TYPE = InnoDB; While it will happily acc

Re: [RDBO] Defining "Some times" Relationships

2007-03-27 Thread John Siracusa
On 3/27/07, Robert James Kaes <[EMAIL PROTECTED]> wrote: > CREATE TABLE locations ( > id INT, > ...); > > CREATE TABLE companies ( > id INT, > location_id INT NOT NULL REFERENCES locations(id), > ...); > > CREATE TABLE exhibitions

Re: [RDBO] Does build_select() Support the "offset" argument?

2007-03-27 Thread John Siracusa
On 3/27/07, Robert James Kaes <[EMAIL PROTECTED]> wrote: > My reading of the Rose::DB::Object::QueryBuilder documentation is that > build_select() does NOT support the "offset" argument like the > get_objects() manager method. Is this an oversight, or is there a > fundamental reason why build_sele

Re: [RDBO] Using the results of make_methods()

2007-03-26 Thread John Siracusa
On 3/26/07, Jeff Chimene <[EMAIL PROTECTED]> wrote: > make_classes(); > > sub make_classes > { > use base qw(Rose::DB Rose::DB::Object::Loader); You do not need to inherit from Rose::DB::Object::Loader. Loader is a standalone class that can do work for you. It's not part of

Re: [RDBO] Using the results of make_methods()

2007-03-26 Thread John Siracusa
On 3/26/07, Jeff Chimene <[EMAIL PROTECTED]> wrote: > John Siracusa wrote: >> On 3/23/07, Jeff Chimene <[EMAIL PROTECTED]> wrote: >>> How do I eliminate the following error message? >>> $ perl ./fred.pl >>> Subroutine init_db rede

Re: [RDBO] Paging with Iterators

2007-03-26 Thread John Siracusa
On 3/24/07, Randal L. Schwartz wrote: > > "rose" == rose <[EMAIL PROTECTED]> writes: > rose> I'm using Rose with a fairly large MySQL database and using an > rose> iterator like > > rose> my $itr = Bar->get_bars_iterator(); > rose> while($itr->next()) { > > rose> won't work because by

Re: [RDBO] Duplicate many-to-many map rows

2007-03-26 Thread John Siracusa
On 3/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > On Fri, 23 Mar 2007, John Siracusa wrote: >> If you add the same bar twice, it'll add a new mapping each time. >> That's what add_bars() does. > > Given that Rose knows that this is a many-to-many

Re: [RDBO] Using the results of make_methods()

2007-03-26 Thread John Siracusa
On 3/23/07, Jeff Chimene <[EMAIL PROTECTED]> wrote: > How do I eliminate the following error message? > $ perl ./fred.pl > Subroutine init_db redefined at inspectDB/DB/Object/AutoBase1.pm line 7. AutoBaseNNN.pm classes are the automatically generated RDBO base classes created by the Loader. How i

Re: [RDBO] Duplicate many-to-many map rows

2007-03-23 Thread John Siracusa
On 3/10/07, Mike Schilli <[EMAIL PROTECTED]> wrote: > $foo->add_bars({ string => "I am Bar" }); > $foo->save(); > > The first time this is run, records for both "I am Foo" in foos and "I am Bar" > in bars are created [...] and the relationship table contains the mapping: > > mysql> sele

Re: [RDBO] Column.pm bug w/patch

2007-03-23 Thread John Siracusa
On 3/10/07, Cory Bennett <[EMAIL PROTECTED]> wrote: > I have a column with inflate/deflate triggers and sometimes I get this error: > > Not an ARRAY reference at ./Rose/DB/Object/Metadata/Column.pm line 1087 Sorry for the delay. Your patch is applied to SVN. Thanks! -John -

Re: [RDBO] Sequence Support

2007-03-20 Thread John Siracusa
On 3/20/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > I'd actually like to see sequence classes > Rose::DB::Object::Metadata::Sequence > > Which lets us map sequences to rose objects , and vice versa > > I'd like to be able to call > > my $seq= MyApp::Rose::DB::Object::Sequence1

Re: [RDBO] Sequence Support

2007-03-20 Thread John Siracusa
On 3/20/07, Derek Watson <[EMAIL PROTECTED]> wrote: > Is it possible to get sequence support in RDBO? I know that sequences are > supported for primary key generation, but I have a few cases where they are > used for non-keyed columns What would this support look like? How would the sequence be s

Re: [RDBO] Debian & Rose

2007-03-19 Thread John Siracusa
On 3/19/07, Jeff Chimene <[EMAIL PROTECTED]> wrote: > BTW, kudos for the make_modules() it did good job on a MySQL schema. > I couldn't get make_classes() to work, though. From the tutorial > > @classes = $loader->make_classes; > foreach my $class (@classes) > { > if($class->isa('Rose::DB::

Re: [RDBO] Debian & Rose

2007-03-19 Thread John Siracusa
On 3/17/07, Jeff Chimene <[EMAIL PROTECTED]> wrote: > I see that Rose hasn't been Debianized. Is this deliberate or has no Deb > developer filed an ITP? It's certainly not deliberate. I don't use Debian, but if anyone wants to "Debianize" RDBO, I'll answer any questions I can... -John -

Re: [RDBO] SQLite ATTACH supported by RDB/RDBO?

2007-03-17 Thread John Siracusa
On 3/16/07 3:34 PM, Fred Cox wrote: > Ideally, I would like to have RDB know to ATTACH the second database and treat > the two files as one. > > From what I can tell of the SQLite database, in the case where the table names > are unique, the only complication is that all the sqlite_master tables w

Re: [RDBO] set default DateTime format for stringification

2007-03-17 Thread John Siracusa
On 3/16/07 3:22 PM, Peter Karman wrote: > I know how to set the default output format for a DateTime object when it is > stringified. I'm struggling to know where best to set that for my > DateTime-type > columns. > > Do I create my own Metadata Column subclass and do it there? Or is there some >

Re: [RDBO] Migration from legacy basic DBI to Rose?

2007-03-16 Thread John Siracusa
On 3/16/07, James Masters <[EMAIL PROTECTED]> wrote: > "Creation date $thing{createdate}, postcode: $thing{address}{postcode}". > > Yes, I know - I'm an amateur. But it will be a massive job converting all > this hash methodology to a PERL OO "method" methodology particularly as Rose > method ca

Re: [RDBO] Catalyst::Plugin::Session::Store::DBI

2007-03-15 Thread John Siracusa
On 3/15/07 9:14 AM, Peter Karman wrote: > The latest (0.09) CPAN version of this Catalyst plugin now contains support > for RDBO. You can specify a RDBO class name as the 'dbi_dbh' config param, and > it will return the dbh like: > > My::RDBO::Session->new->dbh Shouldn't that be this instead?

Re: [RDBO] Beginner q. on date

2007-03-15 Thread John Siracusa
On 3/15/07 6:14 AM, Danial Pearce wrote: >> But if I choose the NOT NULL route, then surely I will still need a special >> check i.e. if ($date ne '-00-00') > > RDBO uses DateTime to handle it's objects I believe. YMMV but I think > it may handle the -00-00 case under the hood. -00-00

Re: [RDBO] [bug] Loader (for Postgresql?) picks up bad sequence names

2007-03-09 Thread John Siracusa
On 3/4/07, Randal L. Schwartz wrote: > After running Loader, I got: > > sequence => '"foo_bar"' > > but when it tried to use that to insert a record, Pg barfed. > > Fix was to manually edit all Loader-generated files to be: > > sequence => 'foo_bar' Can you post a test case for this? I

Re: [RDBO] MantToMany + enum bug?

2007-03-09 Thread John Siracusa
On 3/4/07, Cory Bennett <[EMAIL PROTECTED]> wrote: > When I fetch all the TableA's via TableB obj, the TableA objects come with the > enum column marked as modified. This is fixed in SVN, but note that the last test in your test.pl file should be: ok(!defined $mods, "A via B has no modified k

Re: [RDBO] related objects omitted/restricted by Rose::DB::Object::Manager during query

2007-03-09 Thread John Siracusa
On 3/9/07, Jud Dagnall <[EMAIL PROTECTED]> wrote: > I would expect that regardless of how the query was constructed, any > results (projects) returned would be accurate, meaning that they would > reflect the the state of things in the database at the time that the > query was executed. But what yo

Re: [RDBO] on_set trigger bug

2007-03-09 Thread John Siracusa
On 3/9/07, Cory Bennett <[EMAIL PROTECTED]> wrote: > I think this is a bug anyway, but it could be a usage error. When using an > on_set trigger, the return value from the setter is always an empty-string, > but the set seems to still be working. Yep, it was a bug. Fixed in SVN. Thanks for the

Re: [RDBO] delete_prices()

2007-03-09 Thread John Siracusa
On 3/9/07, Peter Karman <[EMAIL PROTECTED]> wrote: > But I don't get this magical method: > >$product->delete_prices($price_id); > > which would be equivalent to: > > sub delete_prices > { > my $self = shift;# Product > my $price_id = shift; > > my @keep = grep { $_->id n

Re: [RDBO] related objects omitted/restricted by Rose::DB::Object::Manager during query

2007-03-09 Thread John Siracusa
On 3/9/07, Jud <[EMAIL PROTECTED]> wrote: > my $result = My::Project::Manager->get_projects > ( > query => [ > 'employees.name' => 'jud', > ], > with_objects => [ 'employees' ], > ); > > I get the expected results (1 item in the test case). However, when I look at > the list of

Re: [RDBO] auto_prime_caches, or common custom Metadata

2007-03-08 Thread John Siracusa
On 3/8/07 9:44 PM, [EMAIL PROTECTED] wrote: > that's all fine and good until i create a table called 'metadata'. :) Distinct namespaces will avoid that. No need for name mangling. Example: My::DBObject - common base class My::DBObject::Metadata - custom metadata class My::DB::Foo -

Re: [RDBO] auto_prime_caches, or common custom Metadata

2007-03-08 Thread John Siracusa
On 3/8/07 7:33 PM, Michael Reece wrote: > here's what i came up with: > > in package My::RDBO::_base, > > sub meta_class { 'My::RDBO::_meta' } > > and then, > > package My::RDBO::_meta; > use base 'Rose::DB::Object::Metadata'; > > sub auto_prime_caches { 0 } > > is this the expected way to do

Re: [RDBO] multi-relationship sort-order

2007-03-08 Thread John Siracusa
On 3/8/07 10:21 AM, Uwe Voelker wrote: > It does work with the real table name or with just 'rel_B.field DESC'. > > But wouldn't 'rel_A.rel_B...' be the safer bet? What if 'rel_A' and > 'rel_B' have the same name? The "tN" aliases are there to resolve any such ambiguity. (There are also the "tN_

Re: [RDBO] unexpected fetchrow_array in scalar context

2007-03-07 Thread John Siracusa
On 3/7/07, Michael Reece <[EMAIL PROTECTED]> wrote: > this was causing me problems (always getting counts of 1) because my > DBI abstraction layer re-implements fetchrow_array, only ever > returning a list. Well there's your problem :) > "[...] For these reasons you should exercise some caution i

Re: [RDBO] [bug] Loader (for Postgresql?) picks up bad sequence names

2007-03-06 Thread John Siracusa
On 3/4/07, Randal L. Schwartz wrote: > After running Loader, I got: > > sequence => '"foo_bar"' Ug, more unquoting bugs. I'll track that down when I have a chance, thanks. -John - Take Surveys. Earn Cash. Influence t

Re: [RDBO] MantToMany + enum bug?

2007-03-06 Thread John Siracusa
On 3/4/07, Cory Bennett <[EMAIL PROTECTED]> wrote: > Any ideas or work arounds? Looks like a bug. The only workaround I can think of is to use the unset_column_value_modified() function from Rose::DB::Object::Util. I'll work on a fix... -John

Re: [RDBO] postgres - select for update / select for share ?

2007-03-06 Thread John Siracusa
On 3/3/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > is there any way i can coerce this into rose queries? Not really, short of using get_objects_from_sql() > if not, any chance of including these as flags in the future? i'm > having a db locking / blocking issue on a certain feature right n

Re: [RDBO] using 'dummy' => { field => 'real expression', ... }

2007-03-06 Thread John Siracusa
On 3/3/07, Randal L. Schwartz wrote: > Well, I did it. I peered under the hood, because I needed this: > > AND > (f_name || ' ' || l_name) LIKE ? > AND > > And I didn't see any way to do that in RDBO::QueryBuilder. Except in > the source code, where I figured out I could use:

Re: [RDBO] safe namespace for user data in rose objects ?

2007-03-01 Thread John Siracusa
On 3/1/07 9:57 AM, Jonathan Vanasco wrote: > i'm actually doing reverse dns now -- as there are some things i've > considered submitting as patches or releasing via svn , and that made > sense -- but i just thought it might make sense if theres a > documented area or prefix ( even that ) for people

Re: [RDBO] MySQL SET columns not checking values()?

2007-03-01 Thread John Siracusa
On 3/1/07 7:03 AM, Adrian Howard wrote: > I've got some SET columns which RDBO seems to be parsing fine, since > the column() values() are set okay, but it accepts things that aren't > in values(). Bug? Expected behaviour? Bug, now fixed in SVN. Thanks for the report. -John --

Re: [RDBO] safe namespace for user data in rose objects ?

2007-03-01 Thread John Siracusa
On 3/1/07 5:30 AM, Adrian Howard wrote: > On 1 Mar 2007, at 00:47, Jonathan Vanasco wrote: >> would it be possible to reserve a namespace within rose db objects >> for user use? > [snip] > > Using one of the inside-out object classes is one way around this. I > use Class::BuildMethods. Or just pi

Re: [RDBO] Complex update, need hand coded SQL?

2007-03-01 Thread John Siracusa
On 2/28/07 7:42 PM, Fred Cox wrote: > I haven't seen anything that indicates I can use a > subselect in the set clause of RDBOM->update_table. Yeah, there's no real support for subselects except as literals, and even that only seems to work in the where clause due to a bug. I'll try to fix the bu

Re: [RDBO] inflating/deflating columns using mysql functions

2007-03-01 Thread John Siracusa
On 2/28/07 7:39 PM, Michael Reece wrote: > On Feb 28, 2007, at 2:13 PM, Michael Reece wrote: >> this looks very promising! but what args are passed to select_sql, >> etc? [...] Right now, the args are the column metadata object, the db object, and the table name. > any suggestions on how to get

Re: [RDBO] inflating/deflating columns using mysql functions

2007-02-28 Thread John Siracusa
On 2/28/07, Michael Reece <[EMAIL PROTECTED]> wrote: > is it possible to inflate/deflate columns using mysql functions via > RDBO? If you're feeling daring, this API is still not public, but I'm pretty sure it still works: http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/msg00710.

Re: [RDBO] Loader primary key confusion

2007-02-27 Thread John Siracusa
On 2/27/07, Fred Cox <[EMAIL PROTECTED]> wrote: > Thanks for the fix! Actually, don't apply this part: >> -our $VERSION = '0.733'; >> +our $VERSION = '0.734'; because this is not 0.734 as it will eventually be released. It's more like 0.733_01. -John --

Re: [RDBO] Loader primary key confusion

2007-02-27 Thread John Siracusa
On 2/27/07, Fred Cox <[EMAIL PROTECTED]> wrote: > Version 761 (latest in FreeBSD ports) RDBO::Loader chooses the wrong primary > key for this PostgreSQL table: The column name "year" is auto-quoted (probably a reserved word) and wasn't being unquoted properly by Rose::DB. The fix is in SVN. The

Re: [RDBO] Loader primary key confusion

2007-02-27 Thread John Siracusa
On 2/27/07, Fred Cox <[EMAIL PROTECTED]> wrote: > Version 761 (latest in FreeBSD ports) RDBO::Loader chooses the wrong primary > key for this PostgreSQL table: Can you post the CREATE TABLE statement and tell me what versions of Postgres, DBI, and DBD::Pg you're using? -John

Re: [RDBO] Sharing one database between all objects

2007-02-26 Thread John Siracusa
On 2/26/07, Adrian Howard <[EMAIL PROTECTED]> wrote: > On 26 Feb 2007, at 08:28, Jud wrote: >> I'm not sure how to get Rose to use only a single database object for all >> classes and objects. I am looking for a better way than to create a new >> Rose::DB object at the beginning of every script, an

[RDBO] ANNOUNCE: Rose::DB::Object 0.763 released

2007-02-24 Thread John Siracusa
Third time's the charm? Sigh. -John 0.763 (02.24.2007) - John Siracusa <[EMAIL PROTECTED]> * Re-enabled the DBD::SQLite 1.13 work-around in the test suite, which I temporarily disabled to test a 1.14 candidate and then forgot to re-enable before the 0.

[RDBO] ANNOUNCE: Rose::DB::Object 0.762 released

2007-02-24 Thread John Siracusa
0.762 (02.24.2007) - John Siracusa <[EMAIL PROTECTED]> * Fixed an unparseable version number in MakeMethods::BigNum that was causing CPAN and associated tools to choke. -John - Take Surveys. Earn Cash. Inf

Re: [RDBO] ANNOUNCE: Rose::DB::Object 0.761 released

2007-02-23 Thread John Siracusa
On 2/23/07 9:28 PM, Randal L. Schwartz wrote: > The rules are defined in ExtUtils::MM, function parse_version. > > This is enough to fix it: > > if(${Math::BigInt::VERSION} >= 1.78) > > Just add braces. Already fixed in SVN. (I moved the real version number for that file above that line in S

[RDBO] ANNOUNCE: Rose::DB::Object 0.761 released

2007-02-23 Thread John Siracusa
oject/showfiles.php?group_id=147570 Change logs are below. -John Rose::DB::Object: 0.761 (02.23.2007) - John Siracusa <[EMAIL PROTECTED]> * Added the ability to specify a unique key by name in calls to load(). * Added support for query_args and other Manager parameters to one-to-one

[RDBO] Last call before 0.761

2007-02-21 Thread John Siracusa
I'm going to release 0.761 shortly. If you have any outstanding bugs not fixed in SVN or any other small suggestions, speak now... -John - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay pa

Re: [RDBO] Customising R:D:O:Loader generated methods

2007-02-21 Thread John Siracusa
On 2/21/07, Adrian Howard <[EMAIL PROTECTED]> wrote: > Rose::DB::Object::Loader->new( > db => MyApp::DB->new, > class_prefix => 'MyApp' > )->make_classes( > pre_init_hook => sub { > my $meta = shift; > $meta->column( 'some_column' )->alias( '_some_column'

Re: [RDBO] incorrect column type for "double precision"?

2007-02-20 Thread John Siracusa
On 2/20/07, Michael Reece <[EMAIL PROTECTED]> wrote: > in a postgres table, i have a column > >lat| double precision > > the column definitions spit out from $class->meta- > >perl_class_definition interpreted this as > >lat=> { type => 'scalar', length => 8 }, I've

Re: [RDBO] Faking row level triggers

2007-02-18 Thread John Siracusa
On 2/18/07 1:18 AM, Ask Bjørn Hansen wrote: > I noticed that save() seems to call insert() or update() as appropriate. I've updated the docs in SVN to better reflect the fact that save() calls insert() or update() as appropriate, since that is part of the public API. -John ---

Re: [RDBO] New Manager argument forms

2007-02-17 Thread John Siracusa
On 2/17/07 10:22 AM, Graham Barr wrote: > On Feb 16, 2007, at 7:26 PM, Jonathan Vanasco wrote: >> On Feb 16, 2007, at 1:11 PM, John Siracusa wrote: >>> Con: small additional overhead to check and coerce the args >> >> wouldn't that require all of these get_

Re: [RDBO] How to use Rose::DB::Object::{Loader, Helpers} at the same time?

2007-02-17 Thread John Siracusa
On 2/16/07 9:13 PM, George Hartzell wrote: > This question still stands, is there a standard way to use mixin > classes w/ Loader? The usual way is to create a common base class with all the helpers you want, then tell the loader to use that class as the base_class. http://search.cpan.org/dist/Ro

[RDBO] New Manager argument forms

2007-02-16 Thread John Siracusa
How do people feel about the following shortcuts? Manager->get_objects([ a => 1, b => 2 ]); Manager->get_objects({ a => 1, b => 2 }); Both being equivalent to: Manager->get_objects(query => [ a => 1, b => 2 ]); This is how the new "find" relationship method type works, and I'm wonde

Re: [RDBO] Only the first unique key is used for load?

2007-02-13 Thread John Siracusa
On 2/13/07, Graham Barr <[EMAIL PROTECTED]> wrote: > This could be done by adding a column_exists method to RDBO which would > only return true if the named column had been loaded from the DB or set > by calling the accessor method. And have ->load use column_exists instead > of defined when passed

Re: [RDBO] Only the first unique key is used for load?

2007-02-12 Thread John Siracusa
On 2/12/07, Jud <[EMAIL PROTECTED]> wrote: >> Allowing a key name to be specified as a parameter to the load() call >> is a better idea, I think. (That'd require people to give their >> unique keys nice/sensible/memorable names, of course.) > > +1 for this. In SVN: $o->load(key => '...'); w

Re: [RDBO] Only the first unique key is used for load?

2007-02-12 Thread John Siracusa
On 2/12/07, Graham Barr <[EMAIL PROTECTED]> wrote: > On Mon, February 12, 2007 9:48 am, John Siracusa wrote: >> On 2/11/07, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: >> RDBO uses the first unique key what has a defined value (evaluated in the >> order they

Re: [RDBO] Only the first unique key is used for load?

2007-02-12 Thread John Siracusa
On 2/11/07, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: > When I run Foo::Model::User::Manager->new(username => 'ask')->load > (speculative => 1) > > the generated SQL is > > SELECT bitcard_id, email, id, name, nomail, pass, public_profile, > username FROM users WHERE email = ? - bind params: > > (

Re: [RDBO] multiple $obj->add_foo() statements

2007-02-12 Thread John Siracusa
On 2/12/07, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: > If I instead of > > $p->add_prices > ({ price => 7.89, region => 'DE' }, > { price => 1.11, region => 'JP' }); > > $p->save; > > do > > $p->add_prices({ price => 7.89, region => 'DE' });, > $p->add_pric

Re: [RDBO] looks_like_map_table

2007-02-12 Thread John Siracusa
On 2/10/07, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: > I suggest changing the looks_like_map_table to not match "foo_bars", > but only *_map and "foos_bars". I realize we can just override it in > our convention manager, but it's a goofy default, I think. Either I > don't understand entirely

Re: [RDBO] idea for new object manager functionality

2007-02-09 Thread John Siracusa
On 2/8/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > Today I think I realized a functionality that might make sense -- if > the results returned by a manager call weren't simply an array, but a > class object. > > It would behave just as an array - there would be no real difference > in current

Re: [RDBO] timezone for magical 'now' value in datetime columns

2007-02-09 Thread John Siracusa
On 2/8/07, Ask Bjørn Hansen <[EMAIL PROTECTED]> wrote: >On 2/8/07, Michael Reece <[EMAIL PROTECTED]> wrote: >> i see that i can define the column as >> >>saved_on => { type => 'datetime', time_zone => 'America/New_York' } >> >> and get the right datetime value, but is there an easy way to >> in

Re: [RDBO] some db parameter questions

2007-02-08 Thread John Siracusa
On 2/8/07 6:10 PM, Jonathan Vanasco wrote: > actually, how do you feel about this replacement routine? That looks pretty much like what I checked in after my previous reply :) (still hunting for all the $self->{'dbh'} instances...) -John

Re: [RDBO] some db parameter questions

2007-02-08 Thread John Siracusa
On 2/8/07 5:54 PM, Jonathan Vanasco wrote: >> Er, that's a "it already is a get/set method in the latest version." > > http://search.cpan.org/~jsiracusa/Rose-DB-Object/lib/Rose/DB/ > Object.pm#dbh Oh, *that* dbh :) That's some old, probably now inappropriate code. I'll change it to what the doc

Re: [RDBO] some db parameter questions

2007-02-08 Thread John Siracusa
On 2/8/07 5:28 PM, Jonathan Vanasco wrote: > I want them to have a DB initially. > > begin > fetch > manipulate, save > commit / rollback > kill db > > do more stuff that is read only. error out if i try to save > anything ( no db ) > > begin > set db > load? > manipulate > commit rollback Ah,

Re: [RDBO] some db parameter questions

2007-02-08 Thread John Siracusa
On 2/8/07 3:00 PM, Jonathan Vanasco wrote: > sub make__rose_db_obj { > my ( $dbh )= @_; > my $rdb_obj= FindMeOn::RoseDB->new(); > $rdb_obj->{'dbh'}= $dbh; > return $rdb_obj; > } Is FindMeOn::RoseDB a Rose::DB subclass? If so, it has a dbh() method that takes an argument: http://search.cpan.org

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread John Siracusa
On 2/6/07, Derek Watson <[EMAIL PROTECTED]> wrote: > That was pretty much my position, too -- I was looking for something more > semantically appropriate. My task was trivial to solve in one or two ways, I > just didn't see any examples on how to do this stuff elegantly. What I am > really looking

Re: [RDBO] Deleting from a one-to-many

2007-02-06 Thread John Siracusa
On 2/6/07, Derek Watson <[EMAIL PROTECTED]> wrote: > How would I go about deleting only the UK price? The following seems to > delete the UK price record, but leaves it in the collection of $p->prices. > > my ($price) = grep { $_->region eq 'UK' } $p->prices; > $price->delete; After doing that, yo

Re: [RDBO] MySQL driver support for multiple databases

2007-02-01 Thread John Siracusa
On 2/1/07 4:03 PM, Chris Jacobson wrote: > *{ 'Rose::DB::MySQL::supports_schema' } = sub { 1 }; > > This suits my purposes for the time being, but it would be nice to see > this feature included in a future release of Rose::DB::MySQL. It likely will be. > I should also say that I have not done

Re: [RDBO] New "find" method type for one-to-many relationships

2007-02-01 Thread John Siracusa
On 2/1/07 3:21 PM, Mike Schilli wrote: > 1) Two columns of a table form a combined unique key, but neither >of them can be defined UNIQUE(). Then you'd just define a unique key using those two columns: SQL: UNIQUE(col1, col2), RDBO: unique_key => [ 'col1', 'col2' ], > 2) You have a

Re: [RDBO] New "find" method type for one-to-many relationships

2007-02-01 Thread John Siracusa
On 2/1/07 2:03 PM, Mike Schilli wrote: > On Thu, 1 Feb 2007, John Siracusa wrote: >> I question the wisdom of not supplying a sort_by paramater, however. > > You're right, in the general case, sort_by is essential, but often > times, the application knows that there's

Re: [RDBO] New "find" method type for one-to-many relationships

2007-02-01 Thread John Siracusa
On 2/1/07 1:14 PM, Mike Schilli wrote > On Tue, 30 Jan 2007, [ISO-8859-1] Ask Bjørn Hansen wrote: >> (although I sometimes get tripped up by forgetting by how ->new->load >> needs unique keys). > > Me too. Does new->load to be restricted to unique keys? Yes, because each object is linked to a sin

Re: [RDBO] Integration with Rose::HTML::Form

2007-01-31 Thread John Siracusa
On 1/30/07, John Siracusa <[EMAIL PROTECTED]> wrote: > I have db_object_from_form() and init_with_db_object() methods that > will handle a tree of RDBO-derived objects that correspond to a tree > of nested RHTMLO forms. The code is included at the end of this > email, but it&#x

Re: [RDBO] Rose::HTML::Form->validate()

2007-01-31 Thread John Siracusa
On 1/31/07, John Siracusa <[EMAIL PROTECTED]> wrote: > I think the solution is pretty simple: don't re-validate fields in > sub-forms when the "cascade" option is on (which it is, by default). > I plan to include this change in the next release. ...and this change

Re: [RDBO] Rose::HTML::Form->validate()

2007-01-31 Thread John Siracusa
On 1/31/07, Derek Watson <[EMAIL PROTECTED]> wrote: > I see that as of 0.546, form validate() calls get passed to sub-forms by > default, > * Added a cascade parameter to validate(), which defaults to true. > (Suggested by Guillermo Roditi) > Which is great - exactly what I needed! But there is a

[RDBO] load_speculative() helper

2007-01-31 Thread John Siracusa
On 1/31/07, Ted Zlatanov <[EMAIL PROTECTED]> wrote: > I would also ask for a load_speculative() method, which simply calls > load with (speculative=>1). I know about default_load_speculative, > this is a local override. Yes, it pollutes the namespace--I think > it's worthwhile. Something like th

<    1   2   3   4   5   6   7   8   9   10   >