clean up some thingy slightly

This commit is contained in:
Graham Knop 2008-11-06 22:16:22 +00:00
parent 70e6b8a03d
commit 675105b900

View file

@ -11,8 +11,6 @@ package WebGUI::Asset::Wobject::Thingy;
#------------------------------------------------------------------- #-------------------------------------------------------------------
use strict; use strict;
use warnings;
use version;
use Tie::IxHash; use Tie::IxHash;
use JSON; use JSON;
use WebGUI::International; use WebGUI::International;
@ -1284,19 +1282,20 @@ sub _updateFieldType {
my $thingId = shift; my $thingId = shift;
my $assetId = shift; my $assetId = shift;
my $dbDataType = shift; my $dbDataType = shift;
my $db = $session->db;
my ($fieldType) = $self->session->db->quickArray("select fieldType from Thingy_fields where fieldId = " my ($fieldType) = $self->session->db->quickArray("select fieldType from Thingy_fields where fieldId = "
.$self->session->db->quote($fieldId)." and assetId = ".$self->session->db->quote($assetId) .$db->quote($fieldId)." and assetId = ".$db->quote($assetId)
." and thingId = ".$self->session->db->quote($thingId)); ." and thingId = ".$db->quote($thingId));
if($newFieldType ne $fieldType){ if($newFieldType ne $fieldType){
my $thingyTableName = "Thingy_".$thingId; my $thingyTableName = "Thingy_".$thingId;
my $columnName = "field_".$fieldId; my $columnName = "field_".$fieldId;
$error->info("changing column: $columnName, table: $thingyTableName"); $error->info("changing column: $columnName, table: $thingyTableName");
$self->session->db->write( $self->session->db->write(
"ALTER TABLE ".$session->db->dbh->quote_identifier($thingyTableName). "ALTER TABLE ".$db->dbh->quote_identifier($thingyTableName).
" CHANGE ".$self->session->db->dbh->quote_identifier($columnName)." " " CHANGE ".$db->dbh->quote_identifier($columnName)." "
.$session->db->dbh->quote_identifier($columnName)." ".$dbDataType .$db->dbh->quote_identifier($columnName)." ".$dbDataType
); );
} }
return undef; return undef;