Re: [Dbix-class] GOVERNANCE: Aggregation and conclusion

2016-11-02 Thread Wallace Reis
On November 2, 2016 at 7:02:46 AM, Dave Cross (d...@dave.org.uk) wrote:
> > Mee too.
> 
> +1 Matt's proposal (new project team)
> -1 Andrew's proposal (forking)

+1 (new project team)
-1 (forking)

--
Wallace Reis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] GOVERNANCE: An actually concrete proposal w/bootstrap governance system

2016-10-18 Thread Wallace Reis
On October 18, 2016 at 4:04:17 PM, Leo Lapworth (l...@cuckoo.org) wrote:
> On 18 October 2016 at 17:51, Matt S Trout wrote:
> 
> > =begin GOVERNANCE
> >
> .
> > =end GOVERNANCE
> >
> > What say ye?
> 
> This gets the governance issue resolved and puts in place a framework that
> can evolve to fit what is needed at the time.
> 
> +1
> 
> Anything more is just detail which can be added as required by the
> community or core updating the governance in accordance with these rules.

+1 # this pretty much summarizes my position.

Cheers!

--
Wallace Reis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] A slightly more concrete proposal

2016-10-06 Thread Wallace Reis
This pretty much matches my situation and opinion.

Thanks Riba for the great work so far.

+1 for Matt's plan.

Cheers,

--
Wallace Reis

Em 5 de out de 2016 08:55, "Nigel Metheringham" <ni...@dotdot.it> escreveu:

Background: I have been a happy DBIx::Class user from the early days.  I
have some code contributions within DBIC and SQLA, although relatively
small ones, but have not had a need to make changes in recent years, so
have recently been a silent DBIC mailing list member.

Riba has put in a lot of work over a number of years maintaining and
improving DBIx::Class - the level of commitment in this should in no way
be understated.

However going forward I would prefer to see an amicable move to a
maintainer team with an initial core membership as indicated by MST.

There needs to remain a focus on ensuring DBIC remains stable and does
not eat data.

Regards

Nigel.

--

[ Nigel Metheringham -- ni...@dotdot.it ]
[ Ellipsis Intangible Technologies  ]




___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/
dbix-class@lists.scsys.co.uk
___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Re: [Dbix-class] How to specify the necessary scheme?

2010-01-28 Thread Wallace Reis
On 21/01/2010, at 12:46, konstan...@tokar.ru wrote:
 Hi, All!
 
 How to use the schema description generated Schema::Loader, for the scheme 
 necessary to me?
 For example, there is class DBIC::EMULATOR::Cruise, I write for the current 
 scheme
 
 use DBIC::EMULATOR;
 my $schema = DBIC::EMULATOR-connect(...);
 my $record = $schema-resultset('ship')-search()-first ();
 
 But if I need to address to tables of other scheme, for example EMULATOR2, 
 EMULATOR3, how it to make? 
 Something like 
 
 my $record = $schema-resultset(EMULATOR2.ship')-search ()-first();
 my $record = $schema-resultset(EMULATOR3.ship')-search ()-first();


You can create separate namespace for each *db schema* you have under your 
*DBIC schema* one, then
you use the qualified table name when you set up the result class:

if your DBIC schema is DBIC::EMULATOR,

code
package DBIC::EMULATOR::EMULATOR1::ship;

use parent 'DBIx::Class::Core';

__PACKAGE__-table('EMULATOR1.ship');
[...]

package DBIC::EMULATOR::EMULATOR2::ship;

use parent 'DBIx::Class::Core';

__PACKAGE__-table('EMULATOR2.ship');
[...]

/code

thus, when you need to get the resultset for this result class you do:

my $emulator1_ship_rs = $schema-resultset('EMULATOR1::ship');
my $emulator2_ship_rs = $schema-resultset('EMULATOR2::ship');

--
   wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
   Software Engineer  and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis
___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] create failures with has_one

2009-12-09 Thread Wallace Reis
On 09/12/2009, at 13:38, Dermot wrote:
 2009/10/19 Dermot paik...@googlemail.com:
 2009/10/19 Wallace Reis wall...@reis.org.br:
 On 15/10/2009, at 21:08, Dermot wrote:
 my $record = {
   'validation_pass' = 1,
   'files' = [],
   'active' = 1,
   'name' = 'Gustav MR',
   'clipdata' = [
   {
 'contrib_id' = 2,
   }
 ],
   'contrib_id' = 2,
 };
 
 
 Use a HashRef for clipdata rel instead of a ArrayRef.
 
 Here, you should note that currently find (and update) part of *_or_create
 methods will fail for nested relations, so you need to call
 find(update)_or_create for relationships separately.
 
 Is this still true? At least of 0.08114.
 Dp.

Yes, and that applies to the problem you described in another thread (about 
dupes).

--
   wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
   Software Engineer  and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis
___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Left join with an extra condition

2009-10-24 Thread Wallace Reis

On 24/10/2009, at 11:48, Bill Moseley wrote:

Can the virtual view inherit from the user?  That is, can I convince  
DBIC that the object returned is a real user object so I can update  
the object and have it written to storage?  The cookbook just says  
that the view cannot be operated on.  Obviously, it would be much  
more useful to have a real user object.


You can do it if you use a DBMS with RULEs support (like PostgreSQL).
Or you can setup a belongs_to rel (where is_foreign_key_constraint =  
0) to the user and override qw/insert delete update/ row methods in  
your view class to do such operations on -referred_user instead of  
$self, like you would do with RULEs on DBMS.


--
   wallace reis/wreis Catalyst and DBIx::Class consultancy  
with a clue

   Software Engineer  and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] create failures with has_one

2009-10-19 Thread Wallace Reis

On 15/10/2009, at 21:08, Dermot wrote:


2009/10/15 Wallace Reis wall...@reis.org.br:

On 15/10/2009, at 08:34, Dermot wrote:


2009/10/15 Wallace Reis wall...@reis.org.br:


On 14/10/2009, at 13:10, Dermot wrote:


my $record = {
   'validation_pass' = 1,
   'files' = [],
   'active' = 1,
   'name' = 'Gustav MR',
   'clipdata' = [
   {
 'contrib_id' = 2,
   }
 ],
   'contrib_id' = 2,
 };



Use a HashRef for clipdata rel instead of a ArrayRef.


Here, you should note that currently find (and update) part of  
*_or_create methods will fail for nested relations, so you need to  
call find(update)_or_create for relationships separately.



I would really, really love to do a doc patch if I knew how. Mostly
because that's all I feel I have the ability to do. However I have no
experience of how to create patches. I guess it's a similar to `svn
diff  ...`. Is there something on the Advent Calendar's or similar
that might show me?


Not sure, but a svn diff output or a svk ci -P patch is fine.

--
   wallace reis/wreis Catalyst and DBIx::Class consultancy  
with a clue

   Software Engineer  and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] create failures with has_one

2009-10-19 Thread Wallace Reis

On 19/10/2009, at 11:59, Dermot wrote:

2009/10/19 Wallace Reis wall...@reis.org.br:

On 15/10/2009, at 21:08, Dermot wrote:

my $record = {
  'validation_pass' = 1,
  'files' = [],
  'active' = 1,
  'name' = 'Gustav MR',
  'clipdata' = [
  {
'contrib_id' = 2,
  }
],
  'contrib_id' = 2,
};



Use a HashRef for clipdata rel instead of a ArrayRef.


That might explain why, even under 0.08112, I get
DBIx::Class::ResultSet::find_or_create(): new_result needs a hash...
when I use a nested structure. Are there any methods I can use that
will allow me to create new, nested rows?


You can encapsulate it in a resultset method like:

sub import_record {
my ( $self, $record ) = @_;
my ( $files, $clipdata ) = map { delete $record-{$_} } qw/files  
clipdata/;

my $schema = $self-result_source-schema;

my $imp_rec;
my $import_txn = sub {
my $imported_record = $self-update_or_create($record);
foreach my $file (@$files) {
$imported_record-update_or_create_related('files', $file,
{ key = 'files_filename' }
);
}
$imported_record-update_or_create_related('clipdata',  
$clipdata);

return $imported_record;
};
eval { $imp_rec = $schema-txn_do($import_txn) };
if ($@) {  # Transaction failed
die something terrible has happened! #
if ($@ =~ /Rollback failed/);  # Rollback failed

# deal_with_failed_transaction();
}
return $imp_rec;
}

then call $schema-resultset('Submissions')-import_record($record).

--
   wallace reis/wreis Catalyst and DBIx::Class consultancy  
with a clue

   Software Engineer  and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] create failures with has_one

2009-10-15 Thread Wallace Reis

On 15/10/2009, at 08:34, Dermot wrote:


2009/10/15 Wallace Reis wall...@reis.org.br:

On 14/10/2009, at 13:10, Dermot wrote:


my $record = {
'validation_pass' = 1,
'files' = [],
'active' = 1,
'name' = 'Gustav MR',
'clipdata' = [
{
  'contrib_id' = 2,
}
  ],
'contrib_id' = 2,
  };



Use a HashRef for clipdata rel instead of a ArrayRef.


Thanx for the replay.

Under ~/Class/ResultSet.pm#create it says use a Arrayref for has_one

Example of creating a new row and also creating rows in a related
has_many or has_one resultset. Note Arrayref.


Patches are welcome!


I think my problem was using update_or_create(). I think there are
differences between the what create() and what update_or_create()
expects. This might explain the Recursive update error I got as well.

At the moment I am using find_or_create() and that is working as  
expected.



There is no difference between those APIs, both update_or_create and  
find_or_create use -create.


--
   wallace reis/wreis Catalyst and DBIx::Class consultancy  
with a clue

   Software Engineer  and a commit bit: http://shadowcat.co.uk/catalyst/
Shadowcat Systems Limited
http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Re: Using Storable with DBIx::Class - Can't locate object method result_source_instance

2009-09-30 Thread Wallace Reis
On Wed, Sep 30, 2009 at 1:10 PM, Bill Moseley mose...@hank.org wrote:
 $VERSION = '0.08111';

 Ok, starting simple, what's the correct way to store and retrieve dbic row
 objects from Storable?
 Unable to restore schema at ../../lib/Storable.pm (autosplit into
 ../../lib/auto/Storable/thaw.al) line 415
 calling -cds on deserialized object
 Can't call method source on an undefined value at
 /usr/local/share/perl/5.10.0/DBIx/Class/R

The error message is clever in 0.08112. You need to 'freeze' and
'thaw' your dbic row. Look at DBIC::Schema docs about it.

-- 
 wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
 Software Engineer  and a commit bit: 
http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
 http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Filtering with Many-to-Many relationship

2009-09-22 Thread Wallace Reis
On Tue, Sep 22, 2009 at 7:23 AM, Oleg Kostyuk cub.ua...@gmail.com wrote:
 I think, you just need to join twice with tags table, and this will
 give you what you want:

And if you need products which have 3 or more tags? One join per tag?
It is not ideal.

-- 
 wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
 Software Engineer  and a commit bit: 
http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
 http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Filtering with Many-to-Many relationship

2009-09-18 Thread Wallace Reis
On Fri, Sep 18, 2009 at 3:06 PM, Shawn Marincas
shawngmarin...@gmail.com wrote:
 I have a table Products and a table Tags with a many_to_many relationship
 setup, the purpose of which would be to easily generate a resultset of
 products with the given tag(s).  However, I'm running in to problems when I
 want to generate a resultset of product records filtered with multiple
 tags.  I was thinking that one of the following would work:

 my $tag1 = 'A';
 my $tag2 = 'B';

my $product_rs = $schema-resultset('Product')-search_rs({
'tag.tag_id' = { -in = [qw/A B/] }
}, {
join = { 'product_tags' = 'tag' }
});

 But apparently the many_to_many relationship accessor only returns a list of
 row_objects rather than a resultset itself, so I can't perform resultset
 searches on that.  So I tried the following to chain together two searches:

You've used the -search method in your code in list context, so it
calls -all over the resultset and returns a list of row objects.

-- 
 wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
 Software Engineer  and a commit bit: 
http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
 http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] different query after upgrade

2009-08-24 Thread Wallace Reis
Actually, never mind what i just said. DBIC is right, it's a proper bugfix.
*Generally*, it is not correct to LEFT JOIN one thing then JOIN
onwards from it, which clearly is not your case here.

Sorry for the wrong spot.

-- 
 wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
 Software Developer and a commit bit: 
http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
 http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Relations for multi-class object inflation from one table

2009-07-24 Thread Wallace Reis
On Thu, Jul 23, 2009 at 4:12 PM, Oleg Kostyukcub.ua...@gmail.com wrote:
 Hello all,

 I read about Dynamic Sub-classing DBIx::Class proxy classes in
 DBIx::Class::Manual::Cookbook, and have question.

 package My::Schema::Result::Company;
 use base qw/DBIx::Class/;
 __PACKAGE__-load_components(qw/Core/);
 __PACKAGE__-table('companies');
 __PACKAGE__-add_columns(qw/company_id ../);
 __PACKAGE__-set_primary_key('company_id');
 __PACKAGE__-has_many('admins', 'My::Schema::Result::User::Admin', );
 __PACKAGE__-has_many('users', 'My::Schema::Result::User', );
 __PACKAGE__-has_many('all_users', 'My::Schema::Result::User', );

 My questions is:

 1) what should be instead of '' in has_many() calls above? I
 think, this should be something like this (for first has_many): {
 'foreign.company_id' = 'self.company_id', 'foreign.admin' = 1 } - is
 this correct?

You can't define rels using constants in FK definitions like
'foreign.admin' = 1. You have to define just the 'all_users' rel with
{ 'foreign.company_id' = 'self.company_id' } and create result class
methods for 'users' and 'admins' like:
sub users_rs {
my $self = shift;
return $self-all_users_rs({ admin = '0' });
}

sub users {
my $self = shift;
my $rs = $self-users_rs;
return wantarray ? $rs-all : $rs;
}

sub admins_rs {
my $self = shift;
return $self-all_users_rs({ admin = '1' });
}

sub admins {
my $self = shift;
my $rs = $self-admins_rs;
return wantarray ? $rs-all : $rs;
}

Or you can create a base result class called Person, then Admin and
User classes as a views (CREATE VIEW) over Person, thus you can define
the rels like:
__PACKAGE__-has_many('admins', 'My::Schema::Result::User::Admin',
{ 'foreign.company_id' = 'self.company_id' });
__PACKAGE__-has_many('users', 'My::Schema::Result::User',
{ 'foreign.company_id' = 'self.company_id' });
__PACKAGE__-has_many('all_users', 'My::Schema::Result::Person',
{ 'foreign.company_id' = 'self.company_id' });

 3) do I need write belongs_to(company) in User::Admin too, or only in
 User will be enough?

Just in User should be enough.


-- 
 wallace reis/wreis Catalyst and DBIx::Class consultancy with a clue
 Software Developer and a commit bit: 
http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
 http://www.shadowcat.co.uk http://www.linkedin.com/in/wallacereis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Patch roundup time, again.

2008-10-06 Thread Wallace Reis
On Sun, Oct 5, 2008 at 6:23 PM, Matt S Trout [EMAIL PROTECTED] wrote:
 Also, can somebody poke at the views branch and get it pulled from trunk so
 we can merge that please? groditi doesn't have time and I'm not sure I can
 get to it soon enough.

All tests successful.

Done.

-- 
wallace reis/wreis

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Resurrected select for patch

2007-09-29 Thread Wallace Reis
On 9/24/07, Matt S Trout [EMAIL PROTECTED] wrote:
 (sorry for the top-posting everybody)

 Can somebody with a pg test rig already set up verify this and commit it
 please?

Done.

-- 
wallace reis/wreis
http://wallace.reis.org.br

___
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]