Jump to content

Is Holding Table Names In A Constants File A Good Idea?


Johnpg82

Recommended Posts

We are having an argument at my work right now. All of the tables in our database are all scattered so I need to take the time to rename them. I was telling them that it might be a good idea to put the tables in a constants file so we might be able to change the table name at a later time. We may have to move some of the tables to its own shared database between all of the systems at once. So I will have to change some of the tables to database_name.table_name. Does anyone have an experience w/ this. Is it going to slow my system down a lot are there any pros or cons to doing things this way? Let me know so I can know if I should pursue this.

 

-John

Link to comment
Share on other sites

I personally don't see any problem with storing them in CONSTANTS, however you really don't want this file being viewable/accessible by users. If I were you, i'd just store them in a database table for convenience.

Link to comment
Share on other sites

If you change to constants now when you rename tables later it take 1 updating of a constants file to update all

just don't be skimpy on nameing them I like to be very specific on my constants

if its a mysql table its called

SQL_USERS_TABLE  as example so I know exactly what it is, yes it is longer than probably the table's true name of "users" but needless to say its specific enough that I know exactly what it is.

 

 

Constants should be used for any application that might travel from server to server or db to db so SQL login info can be constants also.

Link to comment
Share on other sites

I personally don't see any problem with storing them in CONSTANTS, however you really don't want this file being viewable/accessible by users. If I were you, i'd just store them in a database table for convenience.

 

Wolphie I'd prefer not storing my constants in the DB as that will be one less query I have to run. I believe a constant is more secure then a variable and it is not accessible from the outside. Regardless I'll be putting them in secure folder and make sure my permissions are right. Thanks for the tips.

 

-John

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.