July 11th, 2003, 11:59 AM
I have a client requirement wherein i have to store SQL statements used frequents by a user against in User Id and display it for him to run it.
I have two options
Either to create a table and store these statements against a user id field
Create cookies and store them in cookies.
Now the immediate limitation i see in creating cookies is if the user moved to a different machine the cookie is lost.
the disadvantage in creating a table is obviously additional data object.
What do you guys suggest ?
July 11th, 2003, 04:16 PM
I'd recommend going with your first option: creating a table and storing a user ID in the user's cookies. As you say, if they moved to another machine or deleted their cookies, they could re-establish their cookie later and have all their queries back. So many web sites work this way that users will most likely expect it. For example, if you put items in your shopping cart at Amazon from your work computer, they show up when you check it from home later that night.
Also, I'd be nervous about storing SQL queries for a web application on the user's machine. That invites a malicious user to edit the SQL queries and potentially have your application running queries that you didn't expect. You may have safeguards against this, but in general it's a good idea to keep these implementation details behind your site and off the user's machine.