From: Nicolas Boisselier Date: Tue, 3 Jul 2018 03:21:33 +0000 (+0100) Subject: lib/php/db/table.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=1d214fef3cdda670015a82be365f603ee7fabad9;p=nb.git lib/php/db/table.php --- diff --git a/lib/php/db/table.php b/lib/php/db/table.php index 9e137de0..8da63d38 100644 --- a/lib/php/db/table.php +++ b/lib/php/db/table.php @@ -778,6 +778,9 @@ Class Table extends nb { $regexp = $this->db()->conf_type('regexp'); if (empty($regexp)) $regexp = 'REGEXP'; + $regexp_not = $this->db()->conf_type('regexp_not'); + if (empty($regexp_not)) $regexp_not = 'NOT '; + foreach ($this->fields() as $k => $field) { // No empty values @@ -802,7 +805,7 @@ Class Table extends nb { $match = 'regexp'; $v = substr($v,1); $v = $this->db()->quote($v); - $equal = ' '.($not ? 'NOT ' : '').$regexp.' '; + $equal = ' '.($not ? $regexp_not : '').$regexp.' '; } elseif ($field->string()) { diff --git a/lib/php/db/types/pgsql.php b/lib/php/db/types/pgsql.php index 804c2a0c..e2e3bbe0 100644 --- a/lib/php/db/types/pgsql.php +++ b/lib/php/db/types/pgsql.php @@ -18,6 +18,7 @@ $DB_TYPES['pgsql'] = array ( 'cast_text' => function($name) { return "$name::text"; }, 'extra_where' => 'denorm', 'regexp' => '~', +'regexp_not' => '!', 'quote_field' => function($str) { $chr = "'"; $str = str_replace($chr,$chr.$chr,$str); return $chr . $str . $chr; }, 'localFile' => array (getenv('HOME').'/.pgpass','^[^:]+:[^:]+::(?P[^:]+):(?[^:]+)'),