I have a set of scripts that get installed on various servers. I store the data using DBI, so I can support my clients various SQL servers. Up to this point, I have implemented configuration strings to set the SQL statements for each client to support slight differences in field names, or table names depending on client standard operating procedure, etc. While this works, it seems very unelegant and not the easiest to maintain.
For each of 5 different tables I insert new records, retrieve records by a user number (5-10 records max), retrieve records by a primary key or retrieve all records for summation. All the data is stored in an object so it is either going from the database to the object or the object to the database. My module functions are basically, db->save, db->get_user_recs, db->get_record, db->get_all_recs, and I pass the table_name and any parameter.
I am seeking suggestions on how my database module might be able to map the pieces of the user object back forth to the sql database and create decent sql without resorting to putting the raw sql statements into a configuration file, but still with the flexibility to add or subtract a field or tweak a field name.
g_WhiteIn reply to Creating a Flexible Database Module by gwhite
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |