Re: [Dbix-class] InflateColumn::Markup::Unified inflates columns that use a markup language

2009-09-30 Thread Jose Luis Martinez

Hi,

Nice module!

Anyway, I'd really like to get any ideas, suggestions and complaints you 
may have. If you want support for another markup language, I'll be glad 
to add it.


My two suggestions:

1 - I would make the column to get the markup language from 
configurable. It seems like it can only be called 'markup_lang'.


2- I see that the Markup::Unified module requires, uses, and makes an 
instance of the three markup modules that are supported. IMHO, I don't 
think this is a good long-term strategy if you are willing to support 
more modules because:
 - If you only want to use one markup_lang, you have to install all, or 
the module fails to load.
 - People have to bug you, as the maintainer of the module to get 
their markup language supported by Markup::Unified.
 - All markup modules will be loaded although the application will 
maybe need only one.


Please take a look at how DBIx::Class::EncodedColumn, 
DBIx::Class::UUIDColumns and DBIx::Class::InflateColumn::Serializer do 
it. If you need help, I'd be glad to provide it to you.


Just my 2 cents,

Jose Luis Martinez
jlmarti...@capside.com

___
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] InflateColumn::Markup::Unified inflates columns that use a markup language

2009-09-30 Thread Alexander Hartmaier
Am Mittwoch, den 30.09.2009, 12:45 +0200 schrieb Bernhard Graf:
 Jose Luis Martinez schrieb:

  2- I see that the Markup::Unified module requires, uses, and makes an
  instance of the three markup modules that are supported. IMHO, I don't
  think this is a good long-term strategy if you are willing to support
  more modules because:
   - If you only want to use one markup_lang, you have to install all, or
  the module fails to load.
   - People have to bug you, as the maintainer of the module to get
  their markup language supported by Markup::Unified.
   - All markup modules will be loaded although the application will maybe
  need only one.

 That's a good point!
 So Markup::Unified should be a universal markup class, that provides
 methods to build and to traverse a markup object.

 Then it would need Markup::Unified::Parser::* and
 Markup::Unified::Formatter::* classes for all kind of input and output
 formats. Those modules could be distributed seperatly.

 Sounds like a big challenge. :-)
 But I would estimate a certain amount of interest from wiki-application-
 implementors for such a beast - if there is not already one out.

 I think this is is getting a bit OT...

Sound to me like you need to write a module which represents the markup
column data as object and inflate to it with DBIC.

--
BR Alex


***
T-Systems Austria GesmbH   Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
***
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
***

___
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] Please beta test Sybase support

2009-09-30 Thread Rafael Kitover
Features:
* operation with and without placeholders
* placeholders support with safe last_insert_id
* mostly complete and transparent support for TEXT/IMAGE columns
* complete FreeTDS support (though openclient DBD::Sybase is better)
* ::InflateColumn::DateTime support
* Bulk API -populate support

SVN:
http://dev.catalyst.perl.org/repos/bast/DBIx-Class/0.08/branches/sybase_bulkinsert_support/

To install:
perl Makefile.PL
make installdeps
make
sudo make install

Please read the documentation for DBIx::Class::Storage::DBI::Sybase once
installed.

Please report back your successes, as well as problems.

___
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] Why does this fail?

2009-09-30 Thread fREW Schmidt
Hey guys,

So we have this search that only seems to work with searches of 3 characters
or less.  I am really at quite a loss as to what the deal is.  Here is the
code we are running that fails:

$user-subscription('FRIOUX')-limitations;

 Here are the result classes (User and Subscription) that the above is based
on:

package CIS::Schema::Result::User;
 use base qw/DBIx::Class/;
 use strict;
 use warnings;
 use List::Util 'first';

 __PACKAGE__-load_components(qw/PK::Auto Core/);
 __PACKAGE__-table('User_Profile');
 __PACKAGE__-add_columns(qw/ user_id password address1 address2 city state
 zip
email phone fax date_joined first_name last_name country company_name
agreement commission_from message comment ext disable_logging
disable_accountedit edituser editdate trial chemfinet_userid
chemfinet_agreement enablesearchhelper /);
 __PACKAGE__-set_primary_key('user_id');
 __PACKAGE__-has_many('subscriptions' =
 'CIS::Schema::Result::Subscription',
 {'foreign.user_id' = 'self.user_id'});
 __PACKAGE__-has_many('notes' = 'CIS::Schema::Result::Note', 'user_id');
 __PACKAGE__-has_many(searches = 'CIS::Schema::Result::ActiveSearch',
   {'foreign.user_id' = 'self.user_id'});



sub subscription {
my ($self, $prod) = @_;
# fails for $prod = qw{DWCP STRUCT WBDU WCMD SOURCE FRIOUX}
# works for $prod = qw{DMF PF WAY WES}
return $self-subscriptions-search({ 'me.product_name' = $prod
 })-first;
# always works
# return first { $_-product_name eq $prod } $self-subscriptions-all;
 }



package CIS::Schema::Result::Subscription;
 use base qw/DBIx::Class/;
 use strict;
 use warnings;

 __PACKAGE__-load_components(qw/PK::Auto Core/);
 __PACKAGE__-table('User_Products');
  __PACKAGE__-add_columns(qw/ user_id product_name user_type exp_date
 inst_left
  disable_renewal  mfg_id admin edituser editdate /,
  limitations = {accessor = '_limitations'});
  __PACKAGE__-set_primary_key(qw/ user_id product_name /);
 __PACKAGE__-belongs_to('users' = 'CIS::Schema::Result::User', 'user_id');
 __PACKAGE__-might_have('manufacturer' =
 'CIS::Schema::Result::Manufacturer',
 {'foreign.mfg_id' = 'self.mfg_id'} );


It turns out that DBI actually returns no results in the query.  Here's the
trace (long):

DBI 1.607-ithread default trace level set to 0x0/1 (pid 6124) at
 Company.pm line 130 via Company.pm line 234
 SELECT me.user_id, me.product_name, me.user_type, me.exp_date,
 me.inst_left, me.disable_renewal, me.mfg_id, me.admin, me.edituser,
 me.editdate, me.limitations FROM User_Products me WHERE ( ( me.product_name
 = ? AND me.user_id = ? ) ): 'FRIOUX', 'wesm'
 - prepare_cached('SELECT me.user_id, me.product_name, me.user_type,
 me.exp_date, me.inst_left, me.disable_renewal, me.mfg_id, me.admin,
 me.edituser, me.editdate, me.limitations FROM User_Products me WHERE ( (
 me.product_name = ? AND me.user_id = ? ) )', HASH(0x34f1b94), ...)=
 DBI::st=HASH(0x32bd12c) at DBI.pm line 1777
 *- bind_param(1, 'FRIOUX', ...)= 1 at DBI.pm line 1123**
 - bind_param(2, 'wesm', ...)= 1 at DBI.pm line 1123
 - execute= '0E0' at DBI.pm line 1129
 - fetchrow_array= ( ) [0 items] at Cursor.pm line 89*
  - FETCH('Active')= 1 at ADO.pm line 986
 - disconnect= 1 at ADO.pm line 986
 - DESTROY(DBI::db=HASH(32896ec))= undef at Dispatch.pm line 701
 - DESTROY(DBI::st=HASH(328991c))= undef at Dispatch.pm line 701
 - DESTROY(DBI::st=HASH(34fb85c))= undef at Dispatch.pm line 701
 - DESTROY(DBI::st=HASH(34f31f4))= undef at Dispatch.pm line 701
 - DESTROY(DBI::st=HASH(34fec1c))= undef at Dispatch.pm line 701
  - DESTROY(DBI::st=HASH(34f1d14))= undef at Dispatch.pm line 701
 - DESTROY(DBI::st=HASH(34fea5c))= undef at Dispatch.pm line 701
 - DESTROY(DBI::st=HASH(2705f84))= undef at Dispatch.pm line 701
  - FETCH('Active')= 1 at ADO.pm line 986
 - disconnect= 1 at ADO.pm line 986
 - DESTROY(DBI::db=HASH(32bc0fc))= undef at Dispatch.pm line 701
 [Dispatch] ERROR for request
 '/cis/company/list/?dir=ASCsort=line1term=fadgahghtype=Match%20All%20Words':
 Error executing run mode 'list': Can't call method limitations on an
 undefined value at C:/Inetpub/gic/CIS/Controller/Company.pm line 132.

  at C:/Perl/site/lib/CGI/Application/Dispatch.pm line 704


Note the highlighted (if you can) section above.  You can also just search
for FRIOUX in the output to find it.  Zero rows returned.

The crazy thing is that it works fine with vanilla DBI:

   my $sth = $self-schema-storage-dbh-prepare(q{SELECT * FROM
 user_products WHERE user_id = ? AND product_name = ?});
$sth-execute('wesm', 'DWCP');
while (my $row = $sth-fetchrow_hashref) {
   warn TEST ROW YEA;
   warn $row-{Product_Name};
}


Also, we can't seem to reproduce this in a test script, only in a mod_perl
environment...

Ideas?

-- 
fREW Schmidt
http://blog.afoolishmanifesto.com

[Dbix-class] Re: Why does this fail?

2009-09-30 Thread fREW Schmidt
Ok, so I'm fairly convinced this is a DBD::ADO issue.  We actually *can*
reproduce this with dbi, but only if we do select *.  if we do select foo,
bar, baz it /fails/

If anyone knows where we should look next please  let us know.  In the
meantime we're probably gonna do a ghetto solution with List::Util::first.
-- 
fREW Schmidt
http://blog.afoolishmanifesto.com
___
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] Re: Using Storable with DBIx::Class - Can't locate object method result_source_instance

2009-09-30 Thread Bill Moseley
On Wed, Sep 30, 2009 at 3:00 PM, Wallace Reis reis.wall...@gmail.comwrote:


  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.


Well, I wonder about that message.   That would have me think that the
approach would be to do a Storable round trip like:

$schema-thaw( $schema-freeze( $artist ) );

And then a common use case might be to store an object in a session hash, as
with Catalyst.  Are you saying that the recommended approach is this?

$c-session-{foo} = $schema-freeze( $object );

And then later

$object = $schema-thaw( $c-session-{foo} );

Which ends up running through Storable twice.

I wonder if that message should not point to the
DBIx::Class::ResultSourceHandle docs (which is where it is generated from).
There it would point out that you can set

$DBIx::Class::ResultSourceHandle::thaw_schema = $schema;

before thawing and then the Storable hooks will work.  There it also
recommends using $schema-thaw, but then it's back to pre-serializing,
unless I'm missing the expected use.

Of course, a global $schema is sometimes not desirable.  Perhaps allowing
thaw_schema to be a coderef might be useful as then you could inspect the
deserialized object and have a chance at selecting and returning the correct
schema.


Then, there's  DBIx::Class::Serialize::Storable with the synopsis:

my $cd = $schema-resultset('CD')-find(12);
# if the cache uses Storable, this will work automatically
$cache-set($cd-ID, $cd);

What does that do?  Freezing isn't the issue.  Plus, seems that $cd freezes
and thaws fine without it.  And that synopsis isn't showing the
$cache-get.  I guess I'm missing the point of that component.



-- 
Bill Moseley
mose...@hank.org
___
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