From 5f21467bcaedbd5e8c07e2ab736e11169a940f49 Mon Sep 17 00:00:00 2001 From: lissav Date: Wed, 4 Aug 2010 14:17:31 +0000 Subject: [PATCH] fix setting of types for attributes to invalid types for DB2 as much as possible for now git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6978 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/Table.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 90850b088..110fdbacf 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -547,15 +547,21 @@ sub get_datatype_string_db2 { my $types=shift; #types field (eventlog) my $tablename=shift; # tablename my $descr=shift; # table schema - my $typedefined=0; my $ret = "varchar(512)"; # default for most attributes if (($types) && ($types->{$col})) { if ($types->{$col} =~ /INTEGER AUTO_INCREMENT/) { $ret = "INTEGER GENERATED ALWAYS AS IDENTITY"; } else { + # if the column is a key + if (isAKey(\@{$descr->{keys}}, $col)) { + $ret = "VARCHAR(128) NOT NULL "; + } else { $ret = $types->{$col}; + if ($ret eq "TEXT") { # text not in db2 + $ret = "VARCHAR(512)"; + } + } } - $typedefined=1; } if ($col eq "disable") { @@ -565,12 +571,6 @@ sub get_datatype_string_db2 { $ret = "varchar(4098)"; } - # if the column is a key and not already defined - if (isAKey(\@{$descr->{keys}}, $col)) { - if ($typedefined == 0) { - $ret = "VARCHAR(128) NOT NULL "; - } - } return $ret; }