1227 |
# Here we have to select on both keys. |
# Here we have to select on both keys. |
1228 |
my ($subClause, $subValue) = _WherePart($table, 'subkey', $subKey); |
my ($subClause, $subValue) = _WherePart($table, 'subkey', $subKey); |
1229 |
push @pairFilters, "($realClause AND $subClause)"; |
push @pairFilters, "($realClause AND $subClause)"; |
1230 |
push @parms, $subValue; |
push @parms, $realValue, $subValue; |
1231 |
} |
} |
1232 |
} |
} |
1233 |
# Join the pair filters together to make a giant key filter. |
# Join the pair filters together to make a giant key filter. |
1979 |
my ($self, $query, $table, @values) = @_; |
my ($self, $query, $table, @values) = @_; |
1980 |
# Declare the return value. |
# Declare the return value. |
1981 |
my @retVal = (); |
my @retVal = (); |
1982 |
|
# We use this hash to check for duplicates. |
1983 |
|
my %dupHash = (); |
1984 |
# Get the number of value sections we have to match. |
# Get the number of value sections we have to match. |
1985 |
my $sectionCount = scalar(@values); |
my $sectionCount = scalar(@values); |
1986 |
# Loop through the assignments found. |
# Loop through the assignments found. |
1993 |
]); |
]); |
1994 |
# Form the key from the real key and the sub key. |
# Form the key from the real key and the sub key. |
1995 |
my $key = $self->JoinKey($realKey, $subKey); |
my $key = $self->JoinKey($realKey, $subKey); |
1996 |
|
# Check for a duplicate. |
1997 |
|
my $wholeThing = join($self->{splitter}, $id, $key, $valueString); |
1998 |
|
if (! $dupHash{$wholeThing}) { |
1999 |
|
# It's okay, we're not a duplicate. Insure we don't duplicate this result. |
2000 |
|
$dupHash{$wholeThing} = 1; |
2001 |
# Break the value into sections. |
# Break the value into sections. |
2002 |
my @sections = split($self->{splitter}, $valueString); |
my @sections = split($self->{splitter}, $valueString); |
2003 |
# Match each section against the incoming values. We'll assume we're |
# Match each section against the incoming values. We'll assume we're |
2023 |
push @retVal, [$id, $key, @sections]; |
push @retVal, [$id, $key, @sections]; |
2024 |
} |
} |
2025 |
} |
} |
2026 |
|
} |
2027 |
# Return the rows found. |
# Return the rows found. |
2028 |
return @retVal; |
return @retVal; |
2029 |
} |
} |
2209 |
# Copy the pattern into the return area. |
# Copy the pattern into the return area. |
2210 |
$escapedValue = $sqlPattern; |
$escapedValue = $sqlPattern; |
2211 |
# Check the pattern. Is it generic or exact? |
# Check the pattern. Is it generic or exact? |
2212 |
if ($sqlPattern =~ /%$/) { |
if ($sqlPattern =~ /(.+)%$/) { |
2213 |
# Yes, it is. We need a LIKE clause and we must escape the underscores |
# Yes, it is. We need a LIKE clause and we must escape the underscores |
2214 |
# and percents in the pattern. |
# and percents in the pattern (except for the last one, of course). |
2215 |
|
$escapedValue = $1; |
2216 |
$escapedValue =~ s/(%|_)/\\$1/g; |
$escapedValue =~ s/(%|_)/\\$1/g; |
2217 |
|
$escapedValue .= "%"; |
2218 |
$sqlClause = "$tableName($fieldName) LIKE ?"; |
$sqlClause = "$tableName($fieldName) LIKE ?"; |
2219 |
} else { |
} else { |
2220 |
# No, it isn't. We use an equality clause. |
# No, it isn't. We use an equality clause. |