* This allows us to distinguish a blob from a normal string and an array of strings
*/
class Blob {
- var $data;
+ private $mData;
function __construct($data) {
$this->mData = $data;
}
} elseif ( ($mode == LIST_SET) && is_numeric( $field ) ) {
$list .= "$value";
} elseif ( ($mode == LIST_AND || $mode == LIST_OR) && is_array($value) ) {
- $list .= $field." IN (".$this->makeList($value).") ";
+ if( count( $value ) == 0 ) {
+ // Empty input... or should this throw an error?
+ $list .= '0';
+ } elseif( count( $value ) == 1 ) {
+ // Special-case single values, as IN isn't terribly efficient
+ $list .= $field." = ".$this->addQuotes( $value[0] );
+ } else {
+ $list .= $field." IN (".$this->makeList($value).") ";
+ }
} elseif( is_null($value) ) {
if ( $mode == LIST_AND || $mode == LIST_OR ) {
$list .= "$field IS ";
return $this->tableName( $matches[1] );
}
+ /*
+ * Build a concatenation list to feed into a SQL query
+ */
+ function buildConcat( $stringList ) {
+ return 'CONCAT(' . implode( ',', $stringList ) . ')';
+ }
+
}
/**