I have a database that I am working on a Perl script for to
manage.  Basically, this is a database of user accounts on about 80 Unix
boxes.  Most of it is working great, but I have one problem with the two
of the INSERTs.  The INSERTs are putting data into a history table such
that we can maintain when changes to user accounts occurred.  One field
of the INSERTs is not populating a column.  The column is an ENUM type
with either "D" (for deleted account) or "U" (for update to account) as
the valid input.  The INSERT actually populates all the other columns
but this one.  What am I doing wrong?  
        This is a MySQL database running on HP-UX 11i.  This is running
Perl 5.6.0, and I do not have easily available the DBD and DBI versions.
Here is the section of code with the problem INSERT"

<---code snipped above--->
          if ($old[0]) {
            print "$key1 requires updating in database.  Updating entry
now.\n";
            $type = "U";
            #  Insert existing data into acct_hist.
            $dbh->do(qq{
                     INSERT INTO acct_hist (key1, uid, gid, gcos, home,
shell, e
nt_time, update_type, arc_time)
                     VALUES (?,?,?,?,?,?,?,?,NOW())},
                     undef,@old,$type);
            #  Delete existing data from acct_db.
            $dbh->do(qq{DELETE FROM acct_db WHERE key1 = ?},
undef,$key1);
            #  Insert new entry into acct_db.
            $dbh->do(qq{
                   INSERT INTO acct_db VALUES(?,?,?,?,?,?,NOW(),NOW())},
                   undef, $key1, $uid, $gid, $gcos, $home, $shell)
                or print "Error updating database:  ", $dbh->errstr,
"\n";
<---code snipped below--->

        This first INSERT is the problem one.  The second INSERT works
fine.  Thanks in advance for any suggestions.

Scott Nipp
Phone:  (214) 858-1289
E-mail:  [EMAIL PROTECTED]
Web:  http:\\ldsa.sbcld.sbc.com


Reply via email to