You're right, my question probably wasn't formatted properly. But with a bit of work, I think I've semi-managed to find a work around that I think will work.
My new test script does the following, which is basically to run a single query to get the Names and Account tables joined together, then it runs a query for each boxfolder_id found in each Account_id for each Name_id, which is crappily inefficient, but which does the trick in my test script. Now to figure out why it's not working in my Dancer web app the way I expect.
My new code is:
#!/usr/bin/perl -w
use DBIx::Class;
use lib '../lib';
use Carey::Schema;
use Data::Dumper;
die "Usage: $0 name\n\n" if $#ARGV < 0;
my $name = shift @ARGV;
my $schema = Carey::Schema->connect('DBI:mysql:database=careymss;host=
+localhost;port=3306', 'kiddb','', { PrintError => 1, RaiseError => 1}
+);
my $rs = $schema->resultset('Name')->search({ full_name =>
{ regexp => '[[:<:]]'.$n
+ame.'[[:>:]]' }
},
{
rows => 10,
prefetch => 'account',
order_by => { -asc => 'fu
+ll_name' },
});
$schema->storage->debug(1);
my @r = $rs->all;
foreach my $r (@r) {
print "Full Name: ", $r->full_name, " (", $r->name_id, ")\n";
foreach my $a ($r->account()) {
print " account_id=", $a->account_id();
print " boxfolder_id=",$a->boxfolder_id()," ";
my $t = $a->url();
$t =~ m/value2=(\w+)\&/;
print " URL: $1";
my $b = $a->boxfolder();
$vol = $b->{volume};
$folder = $b->{folder};
$range = $b->{range};
print " V=$vol " if defined $vol;
print " F=$folder " if defined $folder;
print " R=$range " if defined $range;
print "\n";
}
}
And I'd appreciate any comnments.
Thanks,
John
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.