2 messages in com.mysql.lists.win32Database update dies
FromSent OnAttachments
John Corbin26 Aug 1999 06:16 
Jani Tolonen30 Aug 1999 05:49 
Subject:Database update dies
From:John Corbin (jcor@apci.net)
Date:08/26/1999 06:16:49 AM
List:com.mysql.lists.win32

I have a Perl routine that grabs a some fields from a database (mySQL) compares them with current info and if different, transfers the current data to the history database and updates the current db. While I can update the current db the updating of the history is failing with a parse error near the last field, which is a mediumtext field.

heres how I get the data out in the beginning:

$dbh = DBI->connect('dbi:mysql:finger', 'root', '', { RaiseError => 1}); $cursor1 = $dbh->prepare("SELECT users.login,users.last_update,plans.server,users.checksum,users.last_time,pl ans.plan FROM users left join plans on plans.user = users.login left join servers on servers.host = users.server WHERE servers.company like $company ");

$cursor1->execute;

while (@row = $cursor1->fetchrow_array) { $userlogin = @row[0]; $last_update= @row[1]; $server = @row[2]; $old_chksum = @row[3]; $last_time = @row[4]; $t_plan = $dbh->quote(@row[5]);

Then to do the updates:

$cursor2 = $dbh->do("insert into history values \($user,$l_server,$user,$nix,$nix,$cksum,$l_date,$l_time,$t_plan\)"); $cursor2 = $dbh->do("UPDATE users SET checksum = $cksum, last_update = $last_date, last_time = $last_time WHERE login = $user");

The UPDATE query will work by itself, but the insert query bombs....where am I going wrong, i think it has to do with a quoting problem?>??