Re: [Dbix-class] ★ VOTE NOW: DBIC Governance and Namespace Control ★

2016-12-06 Thread Konstantin A. Pustovalov

Proposal B


___
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 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] exception_action fail after DBIC upgrade

2013-01-22 Thread Konstantin A. Pustovalov



Object which stringifies to empty string
is definitely not the same as empty string (the former is true value
while latter is not).

Yes, except that it is a flawed assumption that folks check for
truthiness of $@. In fact any code that does this (if ($@) { ... }) is
arguably wrong. The only correct way to check for an exception is (if
($@ eq '') { ... } ) after an eval just took place. At which point you
are landing straight into the trap that your exception objects are. Here
is a little nonexhaustive search to convince you that the problem is not
just academical [1]
Oh I see. Checking $@ reftype/magic etc is error-prone to use it here 
and there. It should be $@ eq ''.



Which brings me to your pull request - it can't be accepted as-is. The
case of a ''-stringifying object is not business as usual. Hence the
test you added needs to be tweaked to expect a *dfferent* exception,
saying something like Your exception thrown blah blah stringifies to
the empty string - this is not ok, fix your exception library. Original
exception was Foo::Bar=HASH(0x9bb77d0). Or something like that.

I'll eventually fix test and file a bug for Exception::Class


___
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] exception_action fail after DBIC upgrade

2013-01-21 Thread Konstantin A. Pustovalov



Hi!

Sorry for being silent. Loong russian holidays, you know )
But I have investigated a little. DBIC seems to not notice the
exception if it (exeption) stringifies to zero length string. That
was OK for my code since all error info was coded into exception
type. Till DBIC upgrade. The fix was to add some message to all
exceptions. Should I still pull test to fixate 0.08196 behavior?

Yes please. While this is ultimately a problem with your code (an
exception may *never* stringify to , read `perldoc -f eval` for the
exact reason why), I still want to get DBIC to handle it correctly.

Cheers


If you mean this snip from the doc:
  If there was no error, $@ is guaranteed to be the empty string

then this is not my case. Object which stringifies to empty string is 
definitely not the same as empty string (the former is true value while 
latter is not).

Pull request sent.

___
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] exception_action fail after DBIC upgrade

2012-12-10 Thread Konstantin A. Pustovalov

Hello list!

I'm using exception_action feature. Some of my tests fail after 
upgrading 0.08196 - 0.08204

I have reduced  test case to the following: http://paste.scsys.co.uk/217862
exception_action is never get called in my setup. Am I doing something 
wrong or is it intended behavior?


Thanx in advance!


___
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] Announcing 0.08199

2012-08-23 Thread Konstantin A. Pustovalov

Does not  install clean on perl 5.8.8
DBIC pulls SQLA 1.73pulls Class::Accessor::Grouped 0.10005pulls 
Class::XSAccessor 1.13

Class::XSAccessor 1.13tests fail on perl 5.8.8
Is SQLA's dependency on recent Class::Accessor::Grouped a real must?

23.08.2012 06:30, fREW Schmidt ?:

Hello all!

As a number of you noticed there were a few significant regressions
related to prefetching in the last release.  Thanks to hard work, mostly
by Peter Rabbitson (ribasushi) we've got it fixed and added a couple
regression tests.  I'm sorry that none of us could help the rest of you
add tests for your various issues.  Please test this release to see if
it fixes the various problems.

--fREW

___
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] Throwing exceptions from exception_action

2012-04-23 Thread Konstantin A. Pustovalov

Hi DBIC gurus!

I tried to throw typed exceptions from exception_action based on DBD 
error codes. And to no avail.


Here are problems that I've faced:

1. There are very little docs and few tests on exception_action.
2. exception_action is being called twice ( at least more than once ) 
for every RDBMS error.
This is demonstrated here http://paste.scsys.co.uk/194724 Note that 
$DBI::state and $DBI::err are set only the first time call
3. $DBI::state and $DBI::err are not always set to actual RDBMS error 
codes during exception_action call. $DBI::err is set to default 
20 in the following case with populate for instance: 
http://paste.scsys.co.uk/194725
BTW, I've noticed strange warning for the case when exception_action is 
in use and populate() call initiates DB error:
A DBIx::Class::Storage::TxnScopeGuard went out of scope without 
explicit commit or error. Rolling back. at ...


What I basically want to do is:

MySchema-execption_action( sub {
my $e = shift;

if ( is_canstraint_fail() ) {
UniqueConstraintFail-throw( $e );
} else {
GeneralException-throw( $e );
}
});

And later:
eval {
$schema-resultset( 'user' )-create({ user fileds go here });
};
if ( UniqueConstraintFail-caught ) {
UserExists-throw
} elsif 

What are your suggestions to solve this? What are bugs and what are not?

___
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] Got a problem using DBIC+Params::Validate

2010-03-29 Thread Konstantin A. Pustovalov

On 03/26/2010 07:20 PM, Oleg Kostyuk wrote:

IIRC, evaluating ResultSet in scalar contex will issue count() call.
   

ResultSet is a blessed reference which is scalar.
Can't i say $something = $rs ?


Your @_ contain $self as first paramenter.
Probably, you forget my $self = shift as first line of sub?...
   

No i didn't.
BTW my $self = shift evaluates in scalar context.

So what makes DBIC incompatible with Params::Validate? It merely checks 
class of ResultSet in my test case.

Like so:

   SvGETMAGIC(value);
   if (SvOK(value)  (sv_isobject(value) || (SvPOK(value)  ! 
looks_like_number(value {
...
count = call_method(isa, G_SCALAR);
...
}



___
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] Got a problem using DBIC+Params::Validate

2010-03-26 Thread Konstantin A. Pustovalov

Hi,

I'm getting strange behavior with the following ResultSet class:

cut
package Test::Schema::ResultSet::User;
use strict;
use base 'DBIx::Class::ResultSet';
use Params::Validate qw/:all/;
sub touch {
validate_pos( @_, { isa = __PACKAGE__ } );
}

1
/cut

With this resultset class calling touch() issues 'SELECT COUNT( * ) FROM 
User me:'


 Test::Schema-connect( 'dbi:SQLite:dbname=:memory:' )-resultset( 
'User' )-touch;


What i'm doing wrong?

DBIC version 0.08120
Params::Validate version 0.95

thnx!


___
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] How to specify the necessary scheme?

2010-01-21 Thread Konstantin
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();

Similar questions were in this maillist, but the answer I has not found.

-- 
Konstantin Tokar
tel.:+7(495)9671850 ext. 528
fax: +7(495)7953211
e-mail: konstan...@tokar.ru


___
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] How to specify the necessary scheme?

2010-01-18 Thread Konstantin
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();

Similar questions were in this maillist, but the answer I has not found.

-- 
Konstantin Tokar
tel.:+7(495)9671850 ext. 528
fax: +7(495)7953211
e-mail: konstan...@tokar.ru___
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