From ee66303d56807afde06e1d0302ebc8914310f4e7 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Mon, 5 Jan 2009 18:09:52 +0000 Subject: [PATCH] Have Thingy check for existance of table and column to prevent SQL from dying. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Thingy.pm | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 675e99210..4eccf2140 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -26,6 +26,7 @@ - fixed #9001: Thingy add image broken - fixed #9386: Gallery: "Image resolutions" issue - fixed #9342: Thingy - Cannot edit a thing + - fixed #9033: Deleting Linked Thing Field Crashes Thingy 7.6.7 - fixed #9263: Thingy possibleValues processing, and List type autodetection. diff --git a/lib/WebGUI/Asset/Wobject/Thingy.pm b/lib/WebGUI/Asset/Wobject/Thingy.pm index 2d1b7046a..c68eff7df 100644 --- a/lib/WebGUI/Asset/Wobject/Thingy.pm +++ b/lib/WebGUI/Asset/Wobject/Thingy.pm @@ -914,15 +914,16 @@ sub getFormElement { $class = 'WebGUI::Form::'. $param{fieldType}; my $options = (); my $tableName = 'Thingy_'.$otherThingId; - my ($otherThingTableExists) = $db->quickArray('show tables like ?',[$tableName]); + my $fieldName = 'field_'.$data->{fieldInOtherThingId}; + my ($otherThingTableExists) = $db->quickArray('show tables like ? ?',[$tableName, $fieldName]); if ($otherThingTableExists){ $options = $db->buildHashRef('select thingDataId, ' - .$dbh->quote_identifier('field_'.$data->{fieldInOtherThingId}) + .$dbh->quote_identifier($fieldName) .' from '.$dbh->quote_identifier($tableName)); my $value = $data->{value} || $data->{defaultValue}; ($param{value}) = $db->quickArray('select ' - .$dbh->quote_identifier('field_'.$data->{fieldInOtherThingId}) + .$dbh->quote_identifier($fieldName) .' from '.$dbh->quote_identifier($tableName) .' where thingDataId = ?',[$value]); }