[Rt-commit] r2138 - in DBIx-SearchBuilder/trunk: . SearchBuilder
jesse at bestpractical.com
jesse at bestpractical.com
Fri Jan 28 10:32:10 EST 2005
Author: jesse
Date: Fri Jan 28 10:32:10 2005
New Revision: 2138
Modified:
DBIx-SearchBuilder/trunk/ (props changed)
DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm
Log:
r3936 at hualien: jesse | 2005-01-27T14:24:20.889996Z
Patch from Ruslan to use the DBI to better quote identifiers
Modified: DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm
==============================================================================
--- DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm (original)
+++ DBIx-SearchBuilder/trunk/SearchBuilder/Handle.pm Fri Jan 28 10:32:10 2005
@@ -343,7 +343,7 @@
}
my $QueryString =
- "INSERT INTO $table (". join(", ", @cols). ") VALUES ".
+ "INSERT INTO $table (". join(", ", map {$self->dbh->quote_identifier($_) } @cols). ") VALUES ".
"(". join(", ", @vals). ")";
my $sth = $self->SimpleQuery($QueryString, @bind);
@@ -374,8 +374,8 @@
@_ );
my @bind = ();
- my $query = 'UPDATE ' . $args{'Table'} . ' ';
- $query .= 'SET ' . $args{'Column'} . '=';
+ my $query = 'UPDATE ' . $self->dbh->quote_identifier($args{'Table'}) . ' ';
+ $query .= 'SET ' . $self->dbh->quote_identifier($args{'Column'}) . '=';
## Look and see if the field is being updated via a SQL function.
if ($args{'IsSQLFunction'}) {
@@ -389,7 +389,7 @@
## Constructs the where clause.
my $where = 'WHERE ';
foreach my $key (keys %{$args{'PrimaryKeys'}}) {
- $where .= $key . "=?" . " AND ";
+ $where .= $self->dbh->quote_identifier($key) . "=?" . " AND ";
push (@bind, $args{'PrimaryKeys'}{$key});
}
$where =~ s/AND\s$//;
More information about the Rt-commit
mailing list