From 69e280dbf38bb5f31710fa741be39cbdbd86e981 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 21 Jan 2008 22:15:26 +0000 Subject: [PATCH] Fix setattribs sql statement structure for postgresql statement parse error git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@309 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT-2.0/xCAT/Table.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/perl-xCAT-2.0/xCAT/Table.pm b/perl-xCAT-2.0/xCAT/Table.pm index 83d262cb3..ca860c787 100644 --- a/perl-xCAT-2.0/xCAT/Table.pm +++ b/perl-xCAT-2.0/xCAT/Table.pm @@ -706,15 +706,19 @@ sub setAttribs $action = "a"; @bind = (); $cols = ""; + my %newpairs; + #first, merge the two structures to a single hash foreach (keys %keypairs) { - $cols .= $_ . ","; - push @bind, $keypairs{$_}; - } + $newpairs{$_} = $keypairs{$_}; + } for my $col (keys %$elems) { - $cols = $cols . $col . ","; - push @bind, $$elems{$col}; + $newpairs{$col} = $$elems{$col}; + } + foreach (keys %newpairs) { + $cols .= $_ . ","; + push @bind, $newpairs{$_}; } chop($cols); my $qstring = 'INSERT INTO ' . $self->{tabname} . " ($cols) VALUES (";