Hello fellow monks,
hope this is the right place to post this...
I recently found out about Class::DBI and I'm loving it.
While attempting to represent a Many-To-Many relationship (for my shopping cart) I ran into a problem:
my table has 2 fields (user_id and item_id), I can add a relationship by using find_or_create({user_id => 1, item_id => 2}) however if I try to delete a relationship I run into lots of trouble.
Since user_id is taken as the "Primary" key if I Cart->delete(user_id => 1, item_id => 2) all relationships containing user_id = 1 are deleted (I want only the one with item_id = 2 to go away). I thought of creating a junk field in the DB and labeling it as the primary key but that is a waste of a field that will never actually be used. I also tried using Class::DBI::Join but it is broken and not maintained.
Please suggest a module or method to get around this,
thanks in advance!!
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.