> > I inherited a perl CGI application that uses the integer primary key in the > Microsoft Access database fabricate as the file name of flat text file to > hold arbitrary amounts of text. It just dawned on me that this is a bad > idea! If we compress the database, all those unique integer keys will > change! > >
Good questions, but they all hinge on the fact that the "unique primary key" will change. I am more concerned about why THAT would change?? Yikes. What do you mean by "compress"??? Other than the fact that I would avoid M$ access completely, storing the text/images to flat files with their name based on the unique id is a very common way to handle this (I do it all the time). But once a unique key is set it should never change. And if it must for some reason, you are better off writing a wrapper that checks for files associated with the old key and moves them to the new key before doing the update (also something I do, well for revisions not for primary keys). Storing the data file itself or large amounts of text in the database will slow down most DBs, assuming you are searching on the contents of those fields, and/or some DBs might even implement their blob as a local file (not sure specifically). > > What is a way to fix this? > Don't change the primary key. This is basic RDBMS, what if you had other "related" records based on the primary key..... not really any different. > > > Should we have actually store the text in the Microsoft database instead of > storing the file name of the text file in the Access database? Many database > vendors, including Microsoft Access have a feature like memo or blob for > hold large amounts of data. > > > > But what about jpg or png or gif files? Let us suppose we have a web > application that stores data on persons. One data enters then, their name, > address, email address, phone etc. and then uploads a gif or jpg photograph. > If we use the blob feature in the database, how do we use the img tag to > point to a database record? If you are going to store gifs, it seems you > would have to store them in a flat file and store the file name in the > database. OK, how do you generate unique file names if you don't use the > integer primary key? > > > > Thanks, > > siegfried > http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>