[ic] [interchange] * Fix problem found after testing -- in-place modification of $column
Mike Heins
mikeh at endpoint.com
Wed May 25 13:35:01 UTC 2016
Quoting Peter (peter at pajamian.dhs.org):
> On 25/05/16 08:36, Peter wrote:
> > On 25/05/16 03:24, Mike Heins wrote:
> >> * Fix problem found after testing -- in-place modification of $column
> >> prevented accessing configuration. It might have been nice to use $qcolumn
> >> or something...
> >
> > Being able to access column config in the future was not something I
> > took into consideration at the time. It should be easy enough to change
> > it to $qcolumn, though.
>
> Feel free to test this, if it doesn't break anything for you I can push
> it out:
Works a treat -- tested NO_UPDATE and without, performs as expected
both times. Thanks Peter!
>
> diff --git a/lib/Vend/Table/DBI.pm b/lib/Vend/Table/DBI.pm
> index deb2c6d..25d5360 100644
> --- a/lib/Vend/Table/DBI.pm
> +++ b/lib/Vend/Table/DBI.pm
> @@ -1873,6 +1873,10 @@ sub set_field {
> return undef;
> }
>
> + my $qcolumn = $column;
> + $qcolumn = $s->[$DBI]->quote_identifier($column)
> + if $s->[$CONFIG]{QUOTE_IDENTIFIERS};
> +
> my $lcfg;
> if(
> $s->[$CONFIG]->{LENGTH_EXCEPTION_DEFAULT}
> @@ -1899,15 +1903,11 @@ sub set_field {
> $extra = "$f = $f, ";
> }
>
> - # Would have preferred that this was not invasive, eliminates
> possibility
> - # of accessing column configuration below this
> - $column = $s->[$DBI]->quote_identifier($column) if
> $s->[$CONFIG]{QUOTE_IDENTIFIERS};
> -
> my $q;
> if(! $s->record_exists($rawkey)) {
> if( $s->[$CONFIG]{AUTO_SEQUENCE} ) {
> $key = 0 if ! $key;
> - $q = qq{INSERT INTO $s->[$QTABLE] ($s->[$QKEY],
> $column) VALUES (?,?)};
> + $q = qq{INSERT INTO $s->[$QTABLE] ($s->[$QKEY],
> $qcolumn) VALUES (?,?)};
> }
> else {
> #::logDebug("creating key '$rawkey' in table $s->[$TABLE]");
> @@ -1917,7 +1917,7 @@ sub set_field {
>
> my @args;
> if(!$q) {
> - $q = qq{update $s->[$QTABLE] SET $extra$column = ? where
> $s->[$QKEY] = ?};
> + $q = qq{update $s->[$QTABLE] SET $extra$qcolumn = ?
> where $s->[$QKEY] = ?};
> @args = ($value, $key);
> }
> else {
>
>
>
> Peter
>
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
--
Mike Heins
End Point -- Expert Internet Consulting http://www.endpoint.com/
phone +1.765.253.4194 <mikeh at endpoint.com>
"The secret of a good sermon is to have a good beginning and a good
ending, then having the two as close together as possible."
-- George Burns
More information about the interchange-users
mailing list