trivial (?) question about joins
[prev]
[thread]
[next]
[Date index for 2004/12/29]
hi
first - i have read the manual and the wiki. but frankly - didn't
understood a bit, and relevant example from wiki doesn't seem to work
for me.
anyway.
i have 2 classes:
package Paczki::stowary;
Paczki::stowary->table('sprzedaz_towary');
Paczki::stowary->columns(All => qw/id sprzedaz towar ilosc koszt_j cena_j czy_pobrano komentarz_nam_kiedy komentarz_my_kiedy/);
Paczki::stowary->has_a(sprzedaz => 'Paczki::sprzedaze');
and
package Paczki::sprzedaze;
Paczki::sprzedaze->table('sprzedaze');
Paczki::sprzedaze->columns(All => qw/ id kupujacy kupil_kiedy data_kontaktu platnosc czy_spakowano wyslano_kiedy dochod_kiedy dochod_ile koszt_wysylki komentarz_wysylki zakonczone_kiedy komentarz_zakonczenia /);
Paczki::sprzedaze->has_many(stowary => 'Paczki::stowary');
everything works, but now i'd like to search for all stowary with have
czy_pobrano NULL *and* their respective sprzedaze's zakonczone_kiedy is
also null.
right now i did it this way:
my @aTemp = Paczki::stowary->search(czy_pobrano => undef, {'order_by' => 'id desc'});
for my $x (@aTemp) {
next if defined($x->sprzedaz->zakonczone_kiedy);
push @{$rArgs->{'STowary'}}, $x;
}
but this solution is more or less unacceptable.
basically - could you provide me with any *working* help?
as i said - i checked the docs (man Class::DBI - a lot of reading, but i
understood very little out of it - it might be my bad english, though).
i also checked wiki, and tried first code from
http://www.class-dbi.com/cgi-bin/wiki/index.cgi?UsingJoins
but, it also didn't work (i got errors about bad bindings - probably i
just missed something obvious, but i just can't seem to find it.
any help would be greatly appreciated,
best regards
depesz
--
*-----------------------------------------------------------------*
sklep z rzeczami do domu: http://ulek.net/
*-----------------------------------------------------------------*
|
trivial (?) question about joins
hubert depesz lubaczewski 20:38 on 29 Dec 2004
|