RE: database query matching
by chromatic (Archbishop) on Apr 26, 2000 at 18:50 UTC
|
It sounds like you just need one simple table, with four rows:
Resort, Price, Location, and Activities
Your SQL statements will be very simple, too -- similar to (SELECT * from resorts WHERE price <= ? AND activities LIKE ? AND LOCATION LIKE ?). Don't quote me on the exact syntax.
I second the recommendation to use DBD::CSV and DBI. Not only will it allow you to use SQL syntax on a simple database (you can even edit it in most spreadsheets), it will let you write your program to the standard Perl database interface (DBI). In the future, if you want to get more complicated or put a real database behind it, you can do that with very little effort.
Plus, it will give you good experience. | [reply] |
Re: database query matching
by plaid (Chaplain) on Apr 26, 2000 at 12:19 UTC
|
In your particular situation, the best idea may be to use
some sort of relational database (MySQL, mSQL, or any
non-free ones if you can afford them...). At the best,
you'd be re-inventing the wheel doing it yourself. In
addition to structuring the flatfile database, you'd have
to also do things such as index those 3 fields for fast
lookups and efficient sorts.. Basically, doing things that
the authors of databases have spent much time optimizing.
If you are able to install software on the server, and/or
can get someone to do it for you, MySQL is the best free
way to go. If you are restricted to using flat-file
databases, you'll probably want to do something like just
a comma or tab delimited file, but a good amount of time
will be spent making your searching methods efficient. | [reply] |
RE: database query matching
by ok (Beadle) on Apr 26, 2000 at 13:08 UTC
|
Look into using DBI with DBD::CSV. You'll build character by learning a simple SQL select statement and realize how applicable and powerful and simple DBD::CSV is. | [reply] |
Re: database query matching
by frankus (Priest) on Apr 26, 2000 at 13:33 UTC
|
For a ready made MySQL solution try this
be warned though it can be a bit of a pig getting mysql, DBI, DBD, NET etc.
I found little documentation, but the tutorial is good.
;-) | [reply] |
Re: database query matching
by egabriel (Initiate) on Apr 26, 2000 at 21:58 UTC
|
Well, every resort will have a max price, a min price,
one location, and many activities. So you can get away
with three tables.
resorts resort_activities activities<
-------- ---------- ----------
resort_id* resort_id activity_id
name activity_id description
location
This isn't too bad for a start. I personally recommend
something like postgresql for this. DBD::CSV is good, but
I don't know how it does with multi-table relations.
You could really do all of this with one table instead of
three, but your database wouldn't be 'normalized'. Look
into the concept of 'normalization' before you design
anything that needs to grow to any useful size.
--Gabriel | [reply] |
RE: database query matching
by t0mas (Priest) on Apr 26, 2000 at 11:34 UTC
|
The best way is to use Ezdb located at www.ezperl.com and don't bother with how or look
in the source if you still do ;-)
/t0mas | [reply] |
RE: database query matching
by toadi (Chaplain) on Apr 26, 2000 at 13:29 UTC
|
With a flat text-file you'll make it yourself very difficult
Searchin in an non-indexed file is very intensive an with a longer text-file it will be a pain in the butt!!!
For seaching make it a rule: indexed files only!!!
Best option is get mysql/postgress and learn a bit of sql.
With some easy statements you'll get much done
| [reply] |
Re: database query matching
by Anonymous Monk on Apr 26, 2000 at 11:01 UTC
|
Hi,
best is not to use a flat file for this
Searching in a flat file is a bugger,the best thing
to search is is in a indexed file
of cource I don't know how big the flat text file will be
| [reply] |
Re: database query matching
by Anonymous Monk on Apr 26, 2000 at 11:02 UTC
|
Hi,
best is not to use a flat file for this
Searching in a flat file is a bugger,the best thing
to search is is in a indexed file
of cource I don't know how big the flat text file will be
| [reply] |
Re: database query matching
by Anonymous Monk on Apr 26, 2000 at 15:10 UTC
|
If you really want a simple flat-file database see Brent Michalski's Simple Perl Database at http://webreview.com/wr/pub/98/10/09/perl/index.html | [reply] |
RE: database query matching
by ok (Beadle) on Apr 28, 2000 at 22:30 UTC
|
DBD::CSV can't do joins. Bummer. | [reply] |