Re: [Dbix-class] Monkey-patching around a MySQL/UTF8 bug

2015-02-26 Thread Hailin Hu
Give a try to connect with the option mysql_enable_utf8 = 1 http://search.cpan.org/~capttofu/DBD-mysql-4.029/lib/DBD/mysql.pm#DATABASE_HANDLES On Thu, Feb 26, 2015 at 11:43 PM, David Cantrell da...@cantrell.org.uk wrote: This bug in DBD::mysql is apparently not going to be fixed:

Re: [Dbix-class] Help with many to many relationship

2014-04-02 Thread Hailin Hu
, AutoCommit = 1, mysql_enable_utf8=1 } ); my $rs = $s-resultset('Ed')-search_rs( undef, {order_by = ['nom']} ); while (my $ed = $rs-next){ print $ed-nom , \n; } It works François -Original Message- From: Hailin Hu

Re: [Dbix-class] match against ...

2014-04-02 Thread Hailin Hu
= $self-{schema}-resultset('Jrn')-search_rs(undef, {where= $where}); But keep having error message. What is @bind for if I don't use it ? Thanks for showing the right way to have this ! François -Original Message- From: Hailin Hu [mailto:i...@h2l.name] Sent: vendredi, 28. mars

Re: [Dbix-class] Help with many to many relationship

2014-04-01 Thread Hailin Hu
Show up the folder structure and the actual package names. On Wed, Apr 2, 2014 at 12:09 AM, RAPPAZ Francois francois.rap...@unifr.ch wrote: Hi I have two tables Abo (primary key: noabt) and Jrn (primary key: nofm) join by a linking table jrnabt (primary keys: nofm, noabt) I have defined

Re: [Dbix-class] match against ...

2014-03-28 Thread Hailin Hu
Hi, Have a look at docs below: http://search.cpan.org/~ribasushi/DBIx-Class-0.08270/lib/DBIx/Class/ResultSet.pm#where http://search.cpan.org/~ribasushi/SQL-Abstract-1.77/lib/SQL/Abstract.pm#SPECIAL_OPERATORS On Sat, Mar 29, 2014 at 12:46 AM, RAPPAZ Francois francois.rap...@unifr.ch wrote: Hi

Re: [Dbix-class] Adding an additional custom join parameter

2013-12-10 Thread Hailin Hu
Can I ask why you need site_task table? In relationship view, it is the same as issue table. It is something like that you defined one many-to-many relation (task - site) through two bridge tables (site_task and issue). On Mon, Dec 9, 2013 at 10:41 AM, Andrew Beverley a...@andybev.com wrote: My

Re: [Dbix-class] Adding an additional custom join parameter

2013-12-10 Thread Hailin Hu
. Good luck :) On Tue, Dec 10, 2013 at 8:36 PM, Andrew Beverley a...@andybev.com wrote: On Tue, 2013-12-10 at 19:42 +0900, Hailin Hu wrote: Can I ask why you need site_task table? In relationship view, it is the same as issue table. That's a good question. The reason is that issues will often

Re: [Dbix-class] fetching a column value directly

2013-11-03 Thread Hailin Hu
1. Define column host as unique in your Result pm, then you can use $rs-find({ host = $host })-addr; 2. Use method first() $hostAdd = $rs-search({host = $host})-get_column('addr')-first; On Mon, Nov 4, 2013 at 2:29 PM, Rajeev Prasad rp.ne...@yahoo.com wrote: hello, I have this host table,

Re: [Dbix-class] where does Main come from?

2013-09-03 Thread Hailin Hu
It seems that you already knew Main is the level representing Schema, so what's the problem? Maybe you prefer MyApp::Schema::ResultSet::*, but it is just a name, isn't it? You can change it as you like. Cheers On Mon, Sep 2, 2013 at 11:39 PM, Dave Howorth dhowo...@mrc-lmb.cam.ac.uk wrote: I'm

Re: [Dbix-class] why the connection to database failed on the first time, success after refresh

2013-06-06 Thread Hailin Hu
It seems the error only occurs on connection. Do you have any sql statement in on_connect_do, which SQL server can't execute correctly? On Thu, Jun 6, 2013 at 2:38 PM, Hugh Wang yow...@verizon.net wrote: I am trying to use Catalyst, with DBIx::Class to connect to a MS Sqlserver database. after

Re: [Dbix-class] Caching a resultset?

2013-01-13 Thread Hailin Hu
If you are using MySQL, I think query cache of MySQL works for you. Hitting query cache is supposed fast enough for general purpose. Is it really necessary to try to cache a RS, which is not a easy job, I'm afraid. On Mon, Jan 14, 2013 at 1:35 PM, Jesse Sheidlower jes...@panix.com wrote: I have

Re: [Dbix-class] Join Three Tables With Aggregate Functions

2012-10-05 Thread Hailin Hu
enable DBIC_TRACE=1 and run it, you can check the sql generated and see what actually happened. 2012/10/05 19:06 sc...@simpzoid.com: Dear All, I have bit of SQL (mysql) which joins three tables to get all the records form the first table and sums from the 2 remaining tables. The SQL looks

Re: [Dbix-class] Automatic reconnection to failed over database

2012-09-03 Thread Hailin Hu
http://search.cpan.org/~capttofu/DBD-mysql-4.022/lib/DBD/mysql.pm#DATABASE_HANDLES Does mysql_auto_reconnect not work? On Thu, Aug 23, 2012 at 12:26 AM, Jorge Gonzalez jorge.gonza...@daikon.es wrote: Hi all, I am in the process of migrating several production apps using DBIx::Class to a

Re: [Dbix-class] Joining group of 2 joined tables together

2012-08-29 Thread Hailin Hu
you can try to define a self-reference has_one relationship on Table 2, and use the relationship in join. you can't join tables without relationship defined. On Wed, Aug 29, 2012 at 5:57 PM, t...@pasteur.fr wrote: Hi list, I am not sure if such complex join has been asked on the list, but I

Re: [Dbix-class] How to

2012-06-19 Thread Hailin Hu
where = { for = 'update' } is supposed to work. try to debug with DBIC_TRACE=1 and see what exactly the sql is. On Tue, Jun 19, 2012 at 3:36 PM, Hardik Joshi hardik.ma...@gmail.com wrote: Thanks Alex, I have tried 'SELECT...FOR UPDATE' with normal DBI module and its working well where as via

Re: [Dbix-class] table-per-subclass - how it works?

2012-06-15 Thread Hailin Hu
Is it acceptable like something below package Target; ... package Host; ... __PACKAGE__-belong_to('target' = 'Target', 'target_id'); sub column_only_exists_in_target { my $self = shift; return $self-target-column_only_exists_in_target; } well, it is not a good solution, but it could work, I

Re: [Dbix-class] table-per-subclass - how it works?

2012-06-15 Thread Hailin Hu
for typical task.  15.06.2012, 10:25, Hailin Hu i...@h2l.name:  Is it acceptable like something below  package Target;  ...  package Host;  ...  __PACKAGE__-belong_to('target' = 'Target', 'target_id');  sub column_only_exists_in_target {    my $self = shift;    return $self-target

Re: [Dbix-class] table-per-subclass - how it works?

2012-06-15 Thread Hailin Hu
expect extends 'Target', not 'Base'. Is it correct? 15.06.2012, 12:06, Hailin Hu i...@h2l.name: I have no idea about standard solution, but another idea for reference :) Package Base; use base 'DBIx::Class::Core'; # parents' name should be a defined has_one or belong_to relationship has

Re: [Dbix-class] Need help with a search query

2012-06-14 Thread Hailin Hu
just as the error said, there is no such a relationship. try to define a many-to-many relationship http://search.cpan.org/~arodland/DBIx-Class-0.08196/lib/DBIx/Class/Relationship.pm#many_to_many or use a multiple level join join = {people_companies = company} On Fri, Jun 15, 2012 at 11:42 AM,