Perl 6 - the future is here, just unevenly distributed

IRC log for #askriba, 2016-10-17

| Channels | #askriba index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
04:04 dboehmer joined #askriba
15:22 wesm joined #askriba
15:30 wesm ribasushi: i looked over your response to dboehmer's question but i think my angle is more introspective
15:31 ribasushi wesm: explain...?
15:31 wesm is there a way to tell if a $rs->update would be filtered by a foreign key?
15:32 wesm i have found a legacy rs method in our codebase that can clobber a table if called on a bare rs
15:32 wesm and i'd like it to die if that is the case
15:32 wesm (and refactor it later)
15:32 ribasushi wesm: well - if the resolved attr's do not have a {where} - you die
15:34 wesm ok let me sanity check this, i'm trying to remember from friday
15:34 ribasushi if you want to be more explicit ( filtered by a specific key ) - then as a stopgap you can simply ->as_query and look for \.(?!<$current_source_alias)column_in_question
15:35 ribasushi wesm: ^^ it's a heuristic but it'll have 99.9% success rate, and no false negatives
15:36 wesm oh that's really clever
15:37 ribasushi wesm: it's not ideal, but it will work forever if you do it right
15:37 ribasushi ( make allowance for both quoted and unquoted SQL etc )
15:40 ribasushi wesm: there's also an internal method in DBIC that does exactly that (and a lot of internal logic depends on it working), but I hesitate pointing you this way, as it's not certain it will survive under new managements plans :/
15:40 wesm ah see I thought I was going to need look for the "table.fk_col" => { -ident => "parent_table.id" }
15:41 wesm i see that sort of structure in _resolved_attrs->{from}
15:41 ribasushi no, that's the "join ON <this>" structure
15:41 wesm but that won't be there if the rs is just searched on the table by something directly
15:42 ribasushi wesm: depends - if you prefetch - there will be a multi-source {from} structure
15:42 ribasushi regardless of what your WHERE condition expresses
15:46 ribasushi wesm: for the sake of completeness (and I did warn you the method might not survive): my $classifications = $rs->result_source->schema->storage->_resolve_aliastypes_from_select_args( $rs->_resolved_attrs )
15:46 ribasushi wesm: ^^ that is much closer to what you are asking
15:48 wesm oh wow
15:51 frew joined #askriba
16:01 wesm ribasushi: thanks for the help. we should be able to refactor this rs soon so all this is some caution tape for the time being
16:02 ribasushi wesm: hehe, well you know by now how "soon" goes ;)
16:02 ribasushi wesm: but yes, one of these options should get you by
16:04 wesm yep, soon™ - sometime between tomorrow and never
16:21 ribasushi beh I have to detach sooner today
16:22 ribasushi if someone comes in later - I'll get on it tomorrow
16:22 ribasushi cheers &

| Channels | #askriba index | Today | | Search | Google Search | Plain-Text | summary