Hi and thanks for your answer.

I think that we're thinking correct both of us. I'm just not good at
explaining... ;)

What i want to know is this; I have a One to Many relationship between the
Plant and Feature table. One plant can come in maybe 10 different shapes -
but _it is_ still the same plant according to all logical rules and real
world models....
s**t (sorry), just figured it out... Sorry for beeing stupid.

The feature table could maby look like this;

/-------pir_key-------------\
| plant (f_key)       | feature    |
| spira vanhoutti    |  bush       |
| spira vanhoutti    |  hedgeplant |
...
...
...

but i still think that it would be a better idea to do it bitwize. Think
about the overhead of the above tables... You'll maybe have 50.000 plants
whit each having 1 to 10 features. That'll be a Feature table with up to
500.000 records. No problem, BUT; you can do it with ONE field in the plant
table and then only have the feature table for information and names of the
different features. So that the feature table would only have 10 records
ever.

In C++ you set flags for thing like if you're using hexadecimal or ocatal
numbers And it's all done bitwize. It's much more flexible then any other
way... I'm thinking about it every time I see this riddiciously privilige
table in mysql. When it could look like this:
Field        Type
Host        char(60)
User        char(16)
Pass        char(16)
Priv        bitwize(14)

INSERT INTO user VALUES(
'localhost',
'phpuser'
Password('shhdonttellanyone'),
00000000000000);



.bobo



thanks for your help...


----- Original Message ----- 
From: "Svensson, B.A.T. (HKG)" <[EMAIL PROTECTED]>
To: "'Bobo Wieland '" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, June 07, 2003 2:28 PM
Subject: RE: [PHP-WIN] Bitwize operations


> Why are youre aproaches incorrect?
>
> Maybe it is possible to modell it like this:
>
> CLASS :: PLANT
> {
>      specie         text
>      sort           text
>      catogory       enum     {pant, flower, bush, etc...}
>      price          decimal
>      nr_in_stock    integer
>      ...
> }
>
> CLASS :: FEATURE
> {
>      shape     enum   Domian {tall, round,...}
>      color     enum   Domain {red, blue, white,...}
>      ...
> }
>
> Of cource this model is dependet (as usually) on what the
> customer what to store and how they would like to be able
> to search in the database. My point is: it is *very*
> important to do feature study *with* the cusotmer to
> establish what excatly they want to do. If one does not
> have this information it is very hard to judge on a
> design and the qulaity of the design.
>
> Anyhow. assume abowe classes:
>
> Then PLANT should have a non dependent relation with FEATURE
> and FEATURE will have a dependet realtion with PLANT
>
> In the DB you might end up with two tables this way:
>
> PLANT_TABLE and FEATURE _TABLE.
>
> Now a costomer will be abl;e to search on categories but
> also be able to narow down i this with special features of
> these catgories. Using states or bolean wont really utilize
> the power of a RDBMS in they way it was thought of in the
> begining.
>
> M<y recommendation is that you very carfully study what they
> want to have, and the make a datamodell (on papper) first, and
> the explain the feature of this data modell for the cusotmer,
> then they might have a chanse to say yes or no to your ideas
> and you can redesign it on papper (itterative development).
>
> Remeber it goes quit fast to change a drawing on a papper
> while it might take month establish changes in an almost
> implimented system.
>
> -----Original Message-----
> From: Bobo Wieland
> To: [EMAIL PROTECTED]
> Sent: 7-6-03 11:07
> Subject: [PHP-WIN] Bitwize operations
>
> Hi!
>
> [LONG EXPLAINATION OF THE PROBLEM (questions further down)]
> I'm about to create a MySQL db for a company dealing with plants (trees
> and
> bushes and that sort of thing). Now a user should be able to search for
> a
> specific plant in this db - but that specific plant could come in many
> different shapes or forms or what-ever, but it is still the same
> plant...
> I've thought about adding the same plant many times in the db, wich
> isn't
> logical correct or have one fields for each state that the plants come
> in.
> but that won't be correct either.
>
> Now, I'm thinking like this; One table for all states and one field in
> the
> main plant table for which states in the states-table that should be
> used...
>
> [...QUESTION 1]
> Is there some built in operation/operators/functions for dealing with
> bitwize operations in PHP/MySQL?
>
> I would like a feild in the MySQL table 1 to store (perhaps) the value
> 0000
> 0101 (or 5) and that should tell PHP to get the information from the
> MySQL
> table 2 where the primary key equals 1 and 4:
>
> table 2
> | pri_key | info                        |
> |      1      |  aaldkjkjskiiejifr.... |
> |      2      |  aaldkjkjskiiejifr.... |
> |      4      |  aaldkjkjskiiejifr.... |
> |      8      |  aaldkjkjskiiejifr.... |
> |     16     |  aaldkjkjskiiejifr.... |
> |     32     |  aaldkjkjskiiejifr.... |
> .....
>
> [...QUESTION 2]
> Is this the best way to do what I'm about to do or is there some better
> way?
>
>
>
>
> well... that's it I suppose...
>
>
>
> .bobo
>
>
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to