From 859886e8f8193c2e0350a2ba841b415967c99ac1 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 18 Feb 2007 22:50:24 +0000 Subject: [PATCH] fix for importing unsigned ints into the SQL Form from an existing table --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/SQLForm.pm | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 26ba877e6..b766bceae 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -16,6 +16,7 @@ - fix: Events are created with no group information. - fix: Can't add files with File Pile (perlDreamer Consulting, LLC) - fix: Calendar: Month View Always Shows Sunday (perlDreamer Consulting, LLC) + - fix: SQL Form and unsigned int (perlDreamer Consulting, LLC) 7.3.9 - fix: SQL Form and big table imports diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index 398afe459..72312c59b 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -1270,6 +1270,7 @@ sub processPropertiesFromFormPost { my $type = $columnDefinition->{Type}; my $set = $columnDefinition->{Type}; + my $unsigned; my $length; $set =~ s/^.*\(//; $set =~ s/\)$//; @@ -1278,11 +1279,13 @@ sub processPropertiesFromFormPost { $length = $set + 0; $type =~ s/\(.*\)//; + ($type, $unsigned) = split /\s+/, $type; + my $shouldBeUnsigned = lc $unsigned eq 'unsigned'; + my $currentField = $allowedDbFieldTypes->{$type}; # Get the fieldTypeId of this column - my ($fieldType) = $self->session->db->quickArray("select fieldTypeId from SQLForm_fieldTypes " - ." where dbFieldType=".$self->session->db->quote($type)." and formFieldType=".$self->session->db->quote($currentField->{defaultFormElement})); + my ($fieldType) = $self->session->db->quickArray("select fieldTypeId from SQLForm_fieldTypes where dbFieldType=? and formFieldType=?",[$type, $currentField->{defaultFormElement}]); # Create the field type if it doesn't exist unless ($fieldType) { @@ -1311,7 +1314,7 @@ sub processPropertiesFromFormPost { $processed->{regex} = $currentField->{defaultRegEx} if ($currentField->{defaultRegEx}); $processed->{fieldName} = $columnDefinition->{Field}; $processed->{displayName} = $columnDefinition->{Field}; - $processed->{signed} = '1'; + $processed->{signed} = $shouldBeUnsigned ? 0 : 1; $processed->{showInSearchResults} = '1'; $processed->{isSearchable} = '1'; my $fieldId = $self->session->id->generate;