summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Oracle.pm15
-rw-r--r--Bugzilla/DB/Pg.pm12
-rw-r--r--Bugzilla/DB/Sqlite.pm6
3 files changed, 6 insertions, 27 deletions
diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm
index d91eb428e..711b84141 100644
--- a/Bugzilla/DB/Oracle.pm
+++ b/Bugzilla/DB/Oracle.pm
@@ -40,6 +40,8 @@ use base qw(Bugzilla::DB);
use DBD::Oracle;
use DBD::Oracle qw(:ora_types);
+use List::Util qw(max);
+
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
@@ -50,6 +52,8 @@ use Bugzilla::Util;
use constant EMPTY_STRING => '__BZ_EMPTY_STR__';
use constant ISOLATION_LEVEL => 'READ COMMITTED';
use constant BLOB_TYPE => { ora_type => ORA_BLOB };
+# The max size allowed for LOB fields, in kilobytes.
+use constant MIN_LONG_READ_LEN => 32 * 1024;
use constant FULLTEXT_OR => ' OR ';
sub new {
@@ -68,8 +72,8 @@ sub new {
my $dsn = "dbi:Oracle:host=$host;sid=$dbname";
$dsn .= ";port=$port" if $port;
my $attrs = { FetchHashKeyName => 'NAME_lc',
- LongReadLen => ( Bugzilla->params->{'maxattachmentsize'}
- || 1000 ) * 1024,
+ LongReadLen => max(Bugzilla->params->{'maxattachmentsize'},
+ MIN_LONG_READ_LEN) * 1024,
};
my $self = $class->db_new({ dsn => $dsn, user => $user,
pass => $pass, attrs => $attrs });
@@ -156,13 +160,6 @@ sub sql_string_concat {
return 'CONCAT(' . join(', ', @params) . ')';
}
-sub sql_string_until {
- my ($self, $string, $substring) = @_;
- return "SUBSTR($string, 1, "
- . $self->sql_position($substring, $string)
- . " - 1)";
-}
-
sub sql_to_days {
my ($self, $date) = @_;
diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm
index 386a67709..e59a638a4 100644
--- a/Bugzilla/DB/Pg.pm
+++ b/Bugzilla/DB/Pg.pm
@@ -192,18 +192,6 @@ sub sql_string_concat {
return '(CAST(' . join(' AS text) || CAST(', @params) . ' AS text))';
}
-sub sql_string_until {
- my ($self, $string, $substring) = @_;
-
- # PostgreSQL does not permit a negative substring length; therefore we
- # use CASE to only perform the SUBSTRING operation when $substring can
- # be found withing $string.
- my $position = $self->sql_position($substring, $string);
- return "CASE WHEN $position != 0"
- . " THEN SUBSTRING($string FROM 1 FOR $position - 1)"
- . " ELSE $string END";
-}
-
# Tell us whether or not a particular sequence exists in the DB.
sub bz_sequence_exists {
my ($self, $seq_name) = @_;
diff --git a/Bugzilla/DB/Sqlite.pm b/Bugzilla/DB/Sqlite.pm
index fb6aaba97..e13fd18e1 100644
--- a/Bugzilla/DB/Sqlite.pm
+++ b/Bugzilla/DB/Sqlite.pm
@@ -237,12 +237,6 @@ sub sql_date_math {
return "DATETIME($date, '$operator' || $interval || ' $units')";
}
-sub sql_string_until {
- my ($self, $string, $substring) = @_;
- my $position = $self->sql_position($substring, $string);
- return "SUBSTR($string, 1, $position - 1)"
-}
-
###############
# bz_ methods #
###############