Re: [Dbix-class] Deletion of related rows in MySQL

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 12:35:04PM +0400, Konstantin A. Pustovalov wrote:
 Hi list!
 
 I have a code which I have narrowed to http://paste.scsys.co.uk/240549
 It does $schema-resultset-search_rs-search_related_rs-delete
 This happened to work with DBIC v 0.08196 but stopped after upgrade
 to recent version.

Which recent version? I ask because this very issue was re-fixed in
0.08205 [1] which shipped 3 month ago.

Please let me know if you observe the same problem under the current 
version 0.08210, and if this is the case - augment t/71mysql.t [2] with 
a scenario modeled on the failure you encountered.

Cheers

[1] https://metacpan.org/source/RIBASUSHI/DBIx-Class-0.08210/Changes#L69
[2] https://github.com/dbsrgits/dbix-class/blob/master/t/71mysql.t#L297


___
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] Deletion of related rows in MySQL

2013-04-09 Thread Konstantin A. Pustovalov

09.04.2013 12:51, Peter Rabbitson ?:

On Tue, Apr 09, 2013 at 12:35:04PM +0400, Konstantin A. Pustovalov wrote:

Hi list!

I have a code which I have narrowed to http://paste.scsys.co.uk/240549
It does $schema-resultset-search_rs-search_related_rs-delete
This happened to work with DBIC v 0.08196 but stopped after upgrade
to recent version.

Which recent version? I ask because this very issue was re-fixed in
0.08205 [1] which shipped 3 month ago.

Please let me know if you observe the same problem under the current
version 0.08210, and if this is the case - augment t/71mysql.t [2] with
a scenario modeled on the failure you encountered.


yes, the recent version is 0.08210 (I have stated that in previous message)

___
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] Deletion of related rows in MySQL

2013-04-09 Thread Konstantin A. Pustovalov

09.04.2013 13:12, Peter Rabbitson пишет:

On Tue, Apr 09, 2013 at 01:00:56PM +0400, Konstantin A. Pustovalov wrote:

09.04.2013 12:51, Peter Rabbitson ?:

On Tue, Apr 09, 2013 at 12:35:04PM +0400, Konstantin A. Pustovalov wrote:

Hi list!

I have a code which I have narrowed to http://paste.scsys.co.uk/240549
It does $schema-resultset-search_rs-search_related_rs-delete
This happened to work with DBIC v 0.08196 but stopped after upgrade
to recent version.

Which recent version? I ask because this very issue was re-fixed in
0.08205 [1] which shipped 3 month ago.

Please let me know if you observe the same problem under the current
version 0.08210, and if this is the case - augment t/71mysql.t [2] with
a scenario modeled on the failure you encountered.


yes, the recent version is 0.08210 (I have stated that in previous message)

Missed that sorry. I *think* I see the issue. Can you please try this
preliminary fix and report back.


Yep. This fix works!

___
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


[Dbix-class] Undetermined deployment statements

2013-04-09 Thread Konstantin A. Pustovalov
I have noticed strange behavior of $schema-deploy (actually my tests 
started to fail after DBIC upgrade).


my $schema = Schema-connect( 'dbi:SQLite:dbmane=:memory:' );
$schema-deploy({ add_drop_table = 1 });

produces DROP TABLE some_table statements
while

my $schema = Schema-connect( 'dbi:SQLite:dbmane=:memory:' );
$schema-storage-ensure_connected;
$schema-deploy({ add_drop_table = 1 });

produces DROP TABLE IF EXISTS some_table

Have no idea of where to commit this bug to (perhaps SQL::Translator?)

DBIC 0.08210
DBD::SQLite 1.37
SQL::Translator 0.11016



___
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] Undetermined deployment statements

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 02:19:02PM +0400, Konstantin A. Pustovalov wrote:
 I have noticed strange behavior of $schema-deploy (actually my
 tests started to fail after DBIC upgrade).

You are on a roll today eh? :)

Try this please:

diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm
index 9a136fe..a6c96bf 100644
--- a/lib/DBIx/Class/Storage/DBI.pm
+++ b/lib/DBIx/Class/Storage/DBI.pm
@@ -87,6 +87,8 @@ sub _determine_supports_join_optimizer { 1 };
 # _determine_supports_X which obv. needs a correct driver as well
 my @rdbms_specific_methods = qw/
   sqlt_type
+  deployment_statements
+
   sql_maker
   build_datetime_parser
   datetime_parser_type


___
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] Undetermined deployment statements

2013-04-09 Thread Konstantin A. Pustovalov

09.04.2013 14:31, Peter Rabbitson пишет:

On Tue, Apr 09, 2013 at 02:19:02PM +0400, Konstantin A. Pustovalov wrote:

I have noticed strange behavior of $schema-deploy (actually my
tests started to fail after DBIC upgrade).

You are on a roll today eh? :)

indeed!


Try this please:

success

Thanks a lot!

___
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] the apparent complexity of it all

2013-04-09 Thread Jess Robinson


Hey, this is partly a response to this email, and partly to the one from  
March 24th (trying to catch up!)


General thought though, if the issue (as it appeared to be) was that you  
hadn't seen/found Tutorial and SQLHackers, then wouldn't it be more useful  
to set about improving these and making them more visible, than making  
another file which will also get lost in the noise?


I'm not a fan of the idea to get them all using the exact same schema  
classes, as that doesn't give much variance. Each is a separate doc for  
teaching in its own way, or at least that was the plan. I don't really  
understand the reasoning for doing this, can you explain it?


As to the previous comment somewhere that there's room for a whole bunch  
of tutorials by lots of people.. Maybe, but not in the DBIC docs  
themselves, that would just be confusing! There's plenty of room on the  
website though... Dammit, must get that updated... volunteers? ;)


On Thu, 04 Apr 2013 07:36:53 +0100, Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 da...@cpan.org  
wrote:



New patches on top of
https://github.com/daxim/dbix-class/commits/master.


I wonder whether this should not mention DBIx::Class::Schema::Loader
from the start.

With 974c7e5, the synopsis then has such a mention.


hope we get some feedback
from other folk versed in doc-writing

I got valuable feedback after reminding on irc. I'm sorry, I don't know
how to work the GH review feature so that it creates a forward link to
the commit, I hope I have done it right by just reading the info and
making a new one, backlinking to the review page. The result is
3a93a5e1cc. When rebasing onto master, you may fixup/squash this into
974c7e53e3.

I decided to not include the alternative way to update and delete via
row object accessors/methods because I feel that's too much for the
scope - I want a newcomer to be able to have a first feeling of success
after a very short time, and balance every side-step against the risk
of not achieving the goal. It does say minimum amount of code in the
intro. The row object alternatives are still explained in the main
docs, in ::Tutorial, in ::SQLHackers, in the book for the approach of
structured learning that comes afterwards, when the newcomer is on the
proverbial hook.


This is one of those people do it differently things. What are we  
actually trying to teach users? I would hope/assume its how to use DBIC as  
a backend for your objects, and not how to use it to talk to your  
database. There's a subtle difference. In the world of objects, and  
certainly in most of my DBIC-using code, I use $row-update 20x more often  
than $resultset-update. Your explanation doesn't really explain why one  
is preferable to the other, you could replace the ResultSet ones with the  
Row ones, and the above comment would still completely apply.



Not merged. While I like the idea, I am not sure if mentioning
DBIC::Row DBIC::Rel::Base (which is about to go away soon... I
hope... I really do) is a good idea. Especially given that we have
https://metacpan.org/module/DBIx::Class::Manual::ResultClass#INHERITED-METHODS.

It's not the problem you think it is. The docs patch does and must
reflect current reality. Worry about changing that when the time
actually comes. Of course, one could reword it to indirectly refer to
e.g. the first two classes in the inherited methods list or somesuch,
but that can silently/unnoticably become a dangling link
when ::Manual::ResultClass gets reorganised.


I'm not sure what this is about, but I agree with the general document  
whats there NOW, remove/change it later if/when it changes. Too much  
planning ahead for changes that may not emerge is wasteful, and the change  
may turn out to be not what we expected.


Unless of course riba's soon means has been implemented and I'm going  
to merge it before this document is done ;)




The explicit mention is better because it creates an obvious mode of
failure: when ::Rel::Base is removed, the author hopefully acks through
the whole source and sees this needs an update. Even if that is missed
and the distro ships with that broken link going nowhere, eventually a
reader notices and reports.


Also I would recommend changing LSQL::Abstract to
LSQL::Abstract|SQL::Abstract/WHERE CLAUSES.

Done in 7923f7c1b5. When rebasing onto master, you may fixup/squash
this into cc3ad5941e.


Perhaps we should have a separate test-less
DBIx::Class::ExtendedManual dist which is a direct dependency of
DBIx::Class?

++ to that


First we need to figure out how to smack metacpan around the head for not  
displaying/acknowledging the existance of .pod-only docs.. It may just  
work with .pm files that only have POD in? I like the ability to  
distribute and update the manual separately, and have it a dependency of  
DBIC itself, that seems to cover both worlds.


Jess

___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: 

Re: [Dbix-class] the apparent complexity of it all

2013-04-09 Thread Jess Robinson
On Thu, 04 Apr 2013 18:13:27 +0100, Brendan Byrd p...@resonatorsoft.org  
wrote:



Sorry, realized that I wasn't on the plain ol' DBIC ML, so I didn't get
this initially.  Message threading might be odd here...

On Thu Apr 4 10:04:06 GMT 2013, Peter Rabbitson wrote:

  Perhaps we should have a separate test-less
  DBIx::Class::ExtendedManual dist which is a direct dependency of
  DBIx::Class?
 ++ to that

Well... Daxim, Abraxxa, Castaway, SineSwiper - who wants to tackle that?
This way we get the reference manual remain in core (and get updated
with code) and the tutorials etc being maintained separately (which is
safe given our commitment to backwards comp).


I like that, though links to it should be everywhere throughout DBIC.
 Castaway, don't you already have a separate distro for DBIC docs
somewhere?


There's ::Tutorial and ::SQLHackers, both separate pieces. I think we're  
after the entire Manual, so I'd suggest starting a new one.



DocMap might still want to have links to them, too.


Yes there should still be links to said Manual docs in the main distro, as  
long as its a dep this will work fine.


Jess

___
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] the apparent complexity of it all

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 01:20:33PM +0100, Jess Robinson wrote:
 
 Not merged. While I like the idea, I am not sure if mentioning
 DBIC::Row DBIC::Rel::Base (which is about to go away soon... I
 hope... I really do) is a good idea. Especially given that we have
 https://metacpan.org/module/DBIx::Class::Manual::ResultClass#INHERITED-METHODS.
 It's not the problem you think it is. The docs patch does and must
 reflect current reality. Worry about changing that when the time
 actually comes. Of course, one could reword it to indirectly refer to
 e.g. the first two classes in the inherited methods list or somesuch,
 but that can silently/unnoticably become a dangling link
 when ::Manual::ResultClass gets reorganised.
 
 I'm not sure what this is about, but I agree with the general
 document whats there NOW, remove/change it later if/when it
 changes. Too much planning ahead for changes that may not emerge is
 wasteful, and the change may turn out to be not what we expected.
 
 Unless of course riba's soon means has been implemented and I'm
 going to merge it before this document is done ;)

It's not exactly planning ahead, it's more of a there is already 
stuff to work around *precisely* this problem. SineSwiper commented 
further here [1] (see 4th reply-hunk). The ::Manual::ResultClass has 
been on CPAN for several months now [2], introduced/linked up by [3]. 
*This* is what I meant by not sure it is a good idea to promote X. 
Reiterated it here as well [4] (3rd reply hunk)

Cheers

[1] 
http://grokbase.com/t/sc/dbix-class/132r6q21ag/the-apparent-complexity-of-it-all#20130404lxvelgj6chdkbkh5boimbr3paa
[2] 
https://metacpan.org/module/RIBASUSHI/DBIx-Class-0.08210/lib/DBIx/Class/Manual/ResultClass.pod
[3] https://github.com/dbsrgits/dbix-class/commit/3d4c5a8439
[4] 
http://grokbase.com/t/sc/dbix-class/132r6q21ag/the-apparent-complexity-of-it-all#20130404bjtf2hk4wcozkvf7nkspe6imke

___
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] the apparent complexity of it all

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 01:20:33PM +0100, Jess Robinson wrote:
 
 First we need to figure out how to smack metacpan around the head
 for not displaying/acknowledging the existance of .pod-only docs..
 It may just work with .pm files that only have POD in?

Butchering dists to please the substandard metacpan is not really 
acceptable in my eye ;) I will be talking to ANDK and xdg about a formal 
definition of how this should work this weekend.

Cheers


___
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


[Dbix-class] select specific columns on resultset

2013-04-09 Thread max
Hi all,
I'm new to DBIx, I'm trying to retrieve only a subset of columns from a
result set:

my @recs=$self-db-resultset($self-table)-search({},{columns = [qw/ id
Name OperationId Name /],},)-all;

but the result contains all the columns, I also tried with the select
attribute with the same result. Is there something wrong ?

Thanks
___
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] select specific columns on resultset

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 03:19:07PM +0200, max wrote:
 Hi all,
 I'm new to DBIx, I'm trying to retrieve only a subset of columns from a
 result set:
 
 my @recs=$self-db-resultset($self-table)-search({},{columns = [qw/ id
 Name OperationId Name /],},)-all;
 

The above looks correct

 but the result contains all the columns,

How did you determine this?

Also what does the DBIC_TRACE=1 look like?

Cheers


___
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] select specific columns on resultset

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 03:19:07PM +0200, max wrote:
 I'm new to DBIx,

It is DBIx::Class (or DBIC for short). There are hundreds of unrelated 
modules in the DBIx:: namespace.

Cheers


___
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] select specific columns on resultset

2013-04-09 Thread max
Thanks for the answer, this piece of code is inside a perl sub, I tried to
extract the array elements as:

foreach my $row (@recs)
{
my $id=$row-id;
my $name=$row-Name;
print MYFILE recs name: $name, id: $id\n\n;
}

and I can see the Name element for example. I tried to insert the DBIC_TRACE
in the sub ouputting it to a file but it's always empty (
$self-db-storage-debugfh(IO::File-new('file','w'));), is there another
way to use it ?

2013/4/9 Peter Rabbitson rabbit+d...@rabbit.us

 On Tue, Apr 09, 2013 at 03:19:07PM +0200, max wrote:
  Hi all,
  I'm new to DBIx, I'm trying to retrieve only a subset of columns from a
  result set:
 
  my @recs=$self-db-resultset($self-table)-search({},{columns = [qw/
 id
  Name OperationId Name /],},)-all;
 

 The above looks correct

  but the result contains all the columns,

 How did you determine this?

 Also what does the DBIC_TRACE=1 look like?

 Cheers


 ___
 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] select specific columns on resultset

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 03:58:53PM +0200, max wrote:
 Thanks for the answer, this piece of code is inside a perl sub, I tried to
 extract the array elements as:
 
 foreach my $row (@recs)
 {
 my $id=$row-id;
 my $name=$row-Name;
 print MYFILE recs name: $name, id: $id\n\n;
 }
 
 and I can see the Name element for example.

Well... you asked for it didn't you? (in fact you asked twice)

 columns = [qw/id Name OperationId Name /]

I am at this point confused what is your problem exactly...

 I tried to insert the DBIC_TRACE
 in the sub ouputting it to a file but it's always empty (
 $self-db-storage-debugfh(IO::File-new('file','w'));), is there another
 way to use it ?

When you use it this way you also need to -storage-debug(1) for things
to start working. During debugging DBIC_TRACE=1 with dump to screen is
much more common, hence why noone answered quuckly ;)

Cheers

___
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] Deletion of related rows in MySQL

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 12:35:04PM +0400, Konstantin A. Pustovalov wrote:
 Hi list!
 
 I have a code which I have narrowed to http://paste.scsys.co.uk/240549
 It does $schema-resultset-search_rs-search_related_rs-delete
 This happened to work with DBIC v 0.08196 but stopped after upgrade
 to recent version.

Fixed by https://github.com/dbsrgits/dbix-class/commit/f4fdfd698d33

Will appear in some form on CPAN (either 0.08211 or 0.08250) before end 
of the month.

Cheers


___
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] Undetermined deployment statements

2013-04-09 Thread Peter Rabbitson
On Tue, Apr 09, 2013 at 02:19:02PM +0400, Konstantin A. Pustovalov wrote:
 I have noticed strange behavior of $schema-deploy (actually my
 tests started to fail after DBIC upgrade).

Fixed by https://github.com/dbsrgits/dbix-class/commit/3e33d1f3285

Will appear on CPAN as part of 0.08250 before end of the month.

Cheers

___
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