Re: [Dbix-class] Differences in generated relationships

2021-02-12 Thread Matthew Somerville
On Thu, 11 Feb 2021 at 16:12, Dave Cross wrote: > But I'd still like to know where those differences were coming from. In DBIx::Class::Schema::Loader::RelBuilder, in the _relnames_and_method function, there is a "If more than one rel between this pair of tables" section. Not sure I understand it

Re: [Dbix-class] Static / reference data

2018-08-22 Thread Matthew Somerville
On 22 August 2018 at 20:22, Andy Armstrong wrote: > If I do prefetch => ['service', { service => 'parent' }] I only get results > for the cases where the service hierarchy is two levels deep. I think you might only want prefetch => { service => 'parent' } ? The "The "prefetch" attribute can be u

Re: [Dbix-class] Newbie from SQL to DBIx

2018-03-08 Thread Matthew Somerville
On 8 March 2018 at 06:52, Andreas Dafferner wrote: > select distinct left (col, (length(col) - 9)) from table order by col You could do this: FixMyStreet::DB->resultset("Table")->search({}, { columns => { col => \"left(col, length(col)-9)" }, distinct => 1, order_by => "left(col, len

Re: [Dbix-class] A count() after a grouping select() produces a "Duplicate column" error

2017-10-10 Thread Matthew Somerville
Hi, With postgresql, I get: ยง DBIC_TRACE=1 DBIC_TRACE_PROFILE=console perl -e'use App::DB; print App::DB->resultset("Problem")->search(undef, { group_by => [ qw(thing) ] })->count;' SELECT COUNT( * ) FROM ( SELECT me.thing FROM problem me GROUP BY thing ) me 2 Which only fetch

Re: [Dbix-class] SELECT ... FOR UPDATE SKIP LOCKED

2016-05-04 Thread Matthew Somerville
On 4 May 2016 at 21:19, Dmitry Belyavsky wrote: > When did this possibility appeared? Looks like it first appeared in 0.08204 (2012-11-08), Changes has: * New Features / Changes - SQLMaker now accepts \'literal' with the 'for' rs attribute as an override to the builtin FOR o

Re: [Dbix-class] FilterColumn deleting entries when set twice

2015-08-19 Thread Matthew Somerville
On 12 June 2015 at 14:11, Peter Rabbitson wrote: > On 06/12/2015 01:11 AM, Matthew Somerville wrote: >> ie. if you set a filtered column more than once before saving it, the >> data is lost when saved. > Problem confirmed. Will be addressed within a week. Any update on t

[Dbix-class] FilterColumn deleting entries when set twice

2015-06-11 Thread Matthew Somerville
Hi, The code I quote below gives the following output, with DBIx::Class 0.082820: Extra is: 123 Local object extra is: 456 Refetched extra is: 456 Local object extra is: 101112 Use of uninitialized value $n in multiplication (*) at test.pl line 16. Refetched extra is: 0 ie