Re: DBD::XML

2016-09-01 Thread Nigel Horne
So here's an interesting one.  Any thoughts on this?  I assumed it all 
got pulled in magically, but I guess I'm missing something.  But what?


http://www.cpantesters.org/cpan/report/f9cbd816-7052-11e6-ab41-c893a58a4b8c

-Nigel

--
Nigel Horne
Conductor: Rockville Brass Band, Washington Metropolitan GSO
@nigelhorne | fb/nigel.horne | bandsman.co.uk | concert-bands.co.uk | 
www.nigelhorne.com

Unless it's for my eyes only, please use "reply all"




smime.p7s
Description: S/MIME Cryptographic Signature


Re: how to repersent N:M in DBIx?

2016-09-01 Thread Rajeev Prasad via dbi-users
hi Martin,
same set of IDs for all products. products may have multiple and more tag-IDs, 
but i will be looking for only the given set of IDs - for all the products. I 
could not figure to translate that SQL into DBIx syntax.
thank you.Rajeev
 

On Thursday, September 1, 2016 3:37 AM, Martin Hall 
 wrote:
 

  Don't think this counts as a DBI question really as the best solution would 
be to do it all in a single piece of SQL, rather than bringing the data back 
for local processing.  You're not clear in your description whether you are 
looking for the same set of tag IDs for every product or different sets.  If 
it's the former, then you have a solution.  If it's the latter you need to be 
clear on how you will know that a product has the complete set of tags and that 
will likely require some form of additional lookup table.
 
 On 01/09/2016 04:06, Rajeev Prasad via dbi-users wrote:
  
  Pl refer to this link, it has my exact problem (but it only tells about SQL 
solution): 
http://stackoverflow.com/questions/11409869/mysql-nm-relationship-find-rows-with-several-specific-relations
 
  I have three tables: 1. products:-> prod-id, prod-name
  2. tags:-> tag-id, tag-name
  3. product_tags::-> prod-id, csv_tag_id 
  i read elsewhere on internet that this is not a good database/table design. 
so i am ready to change that too, but i could not think of any other way to 
represent this relationship. a given product could have multiple tags, but i 
have to find - at a given time - only those products which have 'ALL' of 
multiple given tags. 
  the SQL suggested on the page is: 
  SELECT a.*
FROM products a
INNER JOIN product_tags b ON a.product_id = b.product_id
WHERE b.tag_id IN (1,23,54)
GROUP BY a.product_id
HAVING COUNT(1) = 3 thank you. Rajeev
   
 
 -- 
 cheers
 
 
 Martin  
|
|

 
 
  

   

Re: DBD::XML

2016-09-01 Thread Nigel Horne

Hi Ron,


On 01/09/16 02:02, Nigel Horne wrote:

Uploaded to https://metacpan.org/release/NHORNE/DBD-XMLSimple-0.01

Now to see what the cpantesters come up with.


The 2nd line of the Synopsis looks like it's meant to be N separate 
lines.


I saw that had formatted incorrectly on CPAN.  It's on my list.

-Nigel


--
Nigel Horne
Conductor: Rockville Brass Band, Washington Metropolitan GSO
@nigelhorne | fb/nigel.horne | bandsman.co.uk | concert-bands.co.uk | 
www.nigelhorne.com

Unless it's for my eyes only, please use "reply all"




smime.p7s
Description: S/MIME Cryptographic Signature


Re: how to repersent N:M in DBIx?

2016-09-01 Thread Martin Hall
Don't think this counts as a DBI question really as the best solution 
would be to do it all in a single piece of SQL, rather than bringing the 
data back for local processing.  You're not clear in your description 
whether you are looking for the same set of tag IDs for every product or 
different sets.  If it's the former, then you have a solution.  If it's 
the latter you need to be clear on how you will know that a product has 
the complete set of tags and that will likely require some form of 
additional lookup table.


On 01/09/2016 04:06, Rajeev Prasad via dbi-users wrote:
Pl refer to this link, it has my exact problem (but it only tells 
about SQL solution): 
http://stackoverflow.com/questions/11409869/mysql-nm-relationship-find-rows-with-several-specific-relations


I have three tables:
1. products:-> prod-id, prod-name
2. tags:-> tag-id, tag-name
3. product_tags::-> prod-id, csv_tag_id

i read elsewhere on internet that this is not a good database/table 
design. so i am ready to change that too, but i could not think of any 
other way to represent this relationship. a given product could have 
multiple tags, but i have to find - at a given time - only those 
products which have 'ALL' of multiple given tags.


the SQL suggested on the page is:

|SELECTa.*FROMproducts a INNERJOINproduct_tags b ONa.product_id 
=b.product_id WHEREb.tag_id IN(1,23,54)GROUPBYa.product_id 
HAVINGCOUNT(1)=3|

thank you.
Rajeev


--

cheers


Martin