in reply to Sql table names
Does it make sense to store sql table names in a hash
Not to me, it makes your SQL impossible to read without refering to your index hash.
... or hardcode the names in your script?
They have to be written somewhere. They ARE hardcoded into the DB schema.
In the beginning there was the schema. And the chief architect saw that it was good and said unto his minions, go forth and code this schema for it is inviolate and it will not changed. And though the minions wanted desperately to believe the chief architect they knew that the schema would change.....
As so after 40 days and 40 nights it became evident that column X was missing from table Y.....
I expect dealing with this sort of sitation is what you are really talking about. Some of the ways to deal with this eventuality include avoiding select * and always selecting specfic colums, same for updates and inserts. That way adding a column is less of an issue. Abstracting DB access to varying degrees also makes sense. At if simplest you might just put all the DB access code into its own module so at least you have one place to do most of the work in the event of changes to the schema.
cheers
tachyon
|
|---|