Gossamer Forum
Home : Products : DBMan : Customization :

When multiple databases are the question

Quote Reply
When multiple databases are the question
I am working with several databases. They all have the same stucture of records. I would like searches in different databases to be transparent to the users. What determines which database is to be used is a specific field. Say it is called "vehicle" and that it can take 3 values, "a car" "a bike" "a plane". I want to change the structure of dbman in order to detect where to search. What I have thought is to eliminate the hidden field that passes the db_setup on the html.pl file. Then I would have to modify the db.cgi file in order to choose between car.db, bike.db or plane.db depending on what has been chosen. This is what I don't know how to write exactly.


One more thing. Is there a sub to get data from a certain record. like get_record but only to get the data from one field.
Quote Reply
Re: When multiple databases are the question In reply to
The first question of yours is really quite simple. I don't think that you need to do the extensive mod like your talking about. You are correct to eliminate the hidden db_setup line in html.pl. Then in your visible form add the following code:

Code:
<select name="db">
<option value="car.db">a car</option>
<option value="bike.db">a bike</option>
<option value="plane.db">a plane</option>
</select>

This will give you a drop-down selection box with the options. I think this is what you are talking about?

The second question I can't answer, other than you can use get_record and then print out the search results so that only the one field shows up.
Quote Reply
Re: When multiple databases are the question In reply to
The problem is that I want dbman to write to a field the information "a plane" too. I don't want to make the user enter the information twice. I think that this should be simple. Maybe if I insert a line like $in{'record'}=$in{'db'} it could work. Is this reference valid?
Quote Reply
Re: When multiple databases are the question In reply to
 
Quote:
Maybe if I insert a line like $in{'record'}=$in{'db'} it could work. Is this reference valid?

Sure. Do you have a field called "record"?

------------------
JPD