in reply to Database Re-Insert

I have a database application using Class::DBI. I use it to insert and retrive records. Recently, each existing record may have an additional field available for inserting and retriving. How I can do this, harmlessly? I have already make a new template (using Template) for displaying the additional field.

Erm. You add the new column to your table. If you're not using something like Class::DBI::Loader add the new column to your Class::DBI subclass. Done.

What's the problem? :-)

Replies are listed 'Best First'.
Re^2: Database Re-Insert
by artist (Parson) on Feb 27, 2006 at 17:59 UTC
    The problem is the question, before I start. Is it going to overwrite the data for existing primary keys? I want the overwrite, instead of rejection or duplication. I like to update existing records with the new data.
    --Artist
      The problem is the question, before I start. Is it going to overwrite the data for existing primary keys? I want the overwrite, instead of rejection or duplication. I like to update existing records with the new data.

      Almost all databases provide some mechanism for updating tables without clearing them. Take a look at your local database's documentation. For MySQL and PostgreSQL take a look at ALTER TABLE.

      (and of course be sure to take backups before hand.)