summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-05 20:43:18 +0200
committerDylan William Hardison <dylan@hardison.net>2017-07-07 00:19:20 +0200
commit37722eca39874bb6abdcd120e3e458bd62dea62b (patch)
tree57a9a9970c00ec77baecab7e154ef7dfcef863fe /Bugzilla/DB
parenta6f98de0d4e842351222b0173a1fff151da8738e (diff)
downloadbugzilla-37722eca39874bb6abdcd120e3e458bd62dea62b.tar.gz
bugzilla-37722eca39874bb6abdcd120e3e458bd62dea62b.tar.xz
Bug 1377933 - Remove trailing whitespace from all perl files
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Mysql.pm92
-rw-r--r--Bugzilla/DB/Oracle.pm104
-rw-r--r--Bugzilla/DB/Pg.pm22
-rw-r--r--Bugzilla/DB/Schema.pm166
-rw-r--r--Bugzilla/DB/Schema/Mysql.pm32
-rw-r--r--Bugzilla/DB/Schema/Oracle.pm66
-rw-r--r--Bugzilla/DB/Schema/Pg.pm18
-rw-r--r--Bugzilla/DB/Schema/Sqlite.pm24
-rw-r--r--Bugzilla/DB/Sqlite.pm10
9 files changed, 267 insertions, 267 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index a9a32fac4..727fe2316 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -37,7 +37,7 @@ use List::Util qw(max);
use Text::ParseWords;
# This is how many comments of MAX_COMMENT_LENGTH we expect on a single bug.
-# In reality, you could have a LOT more comments than this, because
+# In reality, you could have a LOT more comments than this, because
# MAX_COMMENT_LENGTH is big.
use constant MAX_COMMENTS => 50;
@@ -58,8 +58,8 @@ sub new {
# Needs to be explicitly specified for command-line processes.
mysql_auto_reconnect => 1,
);
-
- my $self = $class->db_new({ dsn => $dsn, user => $user,
+
+ my $self = $class->db_new({ dsn => $dsn, user => $user,
pass => $pass, attrs => \%attrs });
# This makes sure that if the tables are encoded as UTF-8, we
@@ -74,7 +74,7 @@ sub new {
$self->{private_bz_dsn} = $dsn;
bless ($self, $class);
-
+
# Bug 321645 - disable MySQL strict mode, if set
my ($var, $sql_mode) = $self->selectrow_array(
"SHOW VARIABLES LIKE 'sql\\_mode'");
@@ -92,7 +92,7 @@ sub new {
}
}
- # Allow large GROUP_CONCATs (largely for inserting comments
+ # Allow large GROUP_CONCATs (largely for inserting comments
# into bugs_fulltext).
$self->do('SET SESSION group_concat_max_len = 128000000');
@@ -151,7 +151,7 @@ sub sql_limit {
sub sql_string_concat {
my ($self, @params) = @_;
-
+
return 'CONCAT(' . join(', ', @params) . ')';
}
@@ -193,7 +193,7 @@ sub sql_fulltext_search {
sub sql_istring {
my ($self, $string) = @_;
-
+
return $string;
}
@@ -213,13 +213,13 @@ sub sql_date_format {
my ($self, $date, $format) = @_;
$format = "%Y.%m.%d %H:%i:%s" if !$format;
-
+
return "DATE_FORMAT($date, " . $self->quote($format) . ")";
}
sub sql_date_math {
my ($self, $date, $operator, $interval, $units) = @_;
-
+
return "$date $operator INTERVAL $interval $units";
}
@@ -324,7 +324,7 @@ sub bz_setup_database {
my ($sd_index_deleted, $longdescs_index_deleted);
my @tables = $self->bz_table_list_real();
- # We want to convert tables to InnoDB, but it's possible that they have
+ # We want to convert tables to InnoDB, but it's possible that they have
# fulltext indexes on them, and conversion will fail unless we remove
# the indexes.
if (grep($_ eq 'bugs', @tables)
@@ -353,7 +353,7 @@ sub bz_setup_database {
# Upgrade tables from MyISAM to InnoDB
my $db_name = Bugzilla->localconfig->{db_name};
my $myisam_tables = $self->selectcol_arrayref(
- 'SELECT TABLE_NAME FROM information_schema.TABLES
+ 'SELECT TABLE_NAME FROM information_schema.TABLES
WHERE TABLE_SCHEMA = ? AND ENGINE = ?',
undef, $db_name, 'MyISAM');
foreach my $should_be_myisam (Bugzilla::DB::Schema::Mysql::MYISAM_TABLES) {
@@ -369,12 +369,12 @@ sub bz_setup_database {
print "done.\n";
}
}
-
- # Versions of Bugzilla before the existence of Bugzilla::DB::Schema did
+
+ # Versions of Bugzilla before the existence of Bugzilla::DB::Schema did
# not provide explicit names for the table indexes. This means
# that our upgrades will not be reliable, because we look for the name
# of the index, not what fields it is on, when doing upgrades.
- # (using the name is much better for cross-database compatibility
+ # (using the name is much better for cross-database compatibility
# and general reliability). It's also very important that our
# Schema object be consistent with what is on the disk.
#
@@ -405,7 +405,7 @@ sub bz_setup_database {
# to handle basic MySQL stuff.
my $rename_time = int($bug_count / 3000) + 3;
# And 45 minutes for every 15,000 attachments, per some experiments.
- my ($attachment_count) =
+ my ($attachment_count) =
$self->selectrow_array("SELECT COUNT(*) FROM attachments");
$rename_time += int(($attachment_count * 45) / 15000);
# If we're going to take longer than 5 minutes, we let the user know
@@ -471,19 +471,19 @@ sub bz_setup_database {
}
# The email_setting table also had the same problem.
- if( grep($_ eq 'email_setting', @tables)
- && $self->bz_index_info_real('email_setting',
- 'email_settings_user_id_idx') )
+ if( grep($_ eq 'email_setting', @tables)
+ && $self->bz_index_info_real('email_setting',
+ 'email_settings_user_id_idx') )
{
- $self->bz_drop_index_raw('email_setting',
+ $self->bz_drop_index_raw('email_setting',
'email_settings_user_id_idx');
}
# Go through all the tables.
foreach my $table (@tables) {
- # Will contain the names of old indexes as keys, and the
+ # Will contain the names of old indexes as keys, and the
# definition of the new indexes as a value. The values
- # include an extra hash key, NAME, with the new name of
+ # include an extra hash key, NAME, with the new name of
# the index.
my %rename_indexes;
# And go through all the columns on each table.
@@ -494,8 +494,8 @@ sub bz_setup_database {
if ($table eq 'series_categories') {
# The series_categories index had a nonstandard name.
push(@columns, 'series_cats_unique_idx');
- }
- elsif ($table eq 'email_setting') {
+ }
+ elsif ($table eq 'email_setting') {
# The email_setting table had a similar problem.
push(@columns, 'email_settings_unique_idx');
}
@@ -506,13 +506,13 @@ sub bz_setup_database {
push(@columns, @{$bad_names->{$table}})
if (exists $bad_names->{$table});
foreach my $column (@columns) {
- # If we have an index named after this column, it's an
+ # If we have an index named after this column, it's an
# old-style-name index.
if (my $index = $self->bz_index_info_real($table, $column)) {
# Fix the name to fit in with the new naming scheme.
$index->{NAME} = $table . "_" .
$index->{FIELDS}->[0] . "_idx";
- print "Renaming index $column to "
+ print "Renaming index $column to "
. $index->{NAME} . "...\n";
$rename_indexes{$column} = $index;
} # if
@@ -531,7 +531,7 @@ sub bz_setup_database {
# This kind of situation happens when people create the database
# themselves, and if we don't do this they will get the big
# scary WARNING statement about conversion to UTF8.
- if ( !$self->bz_db_is_utf8 && !@tables
+ if ( !$self->bz_db_is_utf8 && !@tables
&& (Bugzilla->params->{'utf8'} || !scalar keys %{Bugzilla->params}) )
{
$self->_alter_db_charset_to_utf8();
@@ -545,7 +545,7 @@ sub bz_setup_database {
$self->_bz_store_real_schema;
}
if ($longdescs_index_deleted) {
- $self->_bz_real_schema->delete_index('longdescs',
+ $self->_bz_real_schema->delete_index('longdescs',
'longdescs_thetext_idx');
$self->_bz_store_real_schema;
}
@@ -553,7 +553,7 @@ sub bz_setup_database {
# 2005-09-24 - bugreport@peshkin.net, bug 307602
# Make sure that default 4G table limit is overridden
my $attach_data_create = $self->selectrow_array(
- 'SELECT CREATE_OPTIONS FROM information_schema.TABLES
+ 'SELECT CREATE_OPTIONS FROM information_schema.TABLES
WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?',
undef, $db_name, 'attach_data');
if ($attach_data_create !~ /MAX_ROWS/i) {
@@ -571,17 +571,17 @@ sub bz_setup_database {
#
# TABLE_COLLATION IS NOT NULL prevents us from trying to convert views.
my $non_utf8_tables = $self->selectrow_array(
- "SELECT 1 FROM information_schema.TABLES
- WHERE TABLE_SCHEMA = ? AND TABLE_COLLATION IS NOT NULL
- AND TABLE_COLLATION NOT LIKE 'utf8%'
+ "SELECT 1 FROM information_schema.TABLES
+ WHERE TABLE_SCHEMA = ? AND TABLE_COLLATION IS NOT NULL
+ AND TABLE_COLLATION NOT LIKE 'utf8%'
LIMIT 1", undef, $db_name);
-
+
if (Bugzilla->params->{'utf8'} && $non_utf8_tables) {
print "\n", install_string('mysql_utf8_conversion');
if (!Bugzilla->installation_answers->{NO_PAUSE}) {
- if (Bugzilla->installation_mode ==
- INSTALLATION_MODE_NON_INTERACTIVE)
+ if (Bugzilla->installation_mode ==
+ INSTALLATION_MODE_NON_INTERACTIVE)
{
die install_string('continue_without_answers'), "\n";
}
@@ -604,8 +604,8 @@ sub bz_setup_database {
# If this particular column isn't stored in utf-8
if ($column->{Collation}
- && $column->{Collation} ne 'NULL'
- && $column->{Collation} !~ /utf8/)
+ && $column->{Collation} ne 'NULL'
+ && $column->{Collation} !~ /utf8/)
{
my $name = $column->{Field};
@@ -727,7 +727,7 @@ sub _fix_defaults {
my $raw_default = $raw_info->{COLUMN_DEF};
if (defined $raw_default) {
if ($raw_default eq '') {
- # Only (var)char columns can have empty strings as
+ # Only (var)char columns can have empty strings as
# defaults, so if we got an empty string for some
# other default type, then it's bogus.
next unless $abs_def->{TYPE} =~ /char/i;
@@ -743,7 +743,7 @@ sub _fix_defaults {
print "Fixing defaults...\n";
foreach my $table (reverse sort keys %fix_columns) {
- my @alters = map("ALTER COLUMN $_ DROP DEFAULT",
+ my @alters = map("ALTER COLUMN $_ DROP DEFAULT",
@{ $fix_columns{$table} });
my $sql = "ALTER TABLE $table " . join(',', @alters);
$self->do($sql);
@@ -753,7 +753,7 @@ sub _fix_defaults {
sub _alter_db_charset_to_utf8 {
my $self = shift;
my $db_name = Bugzilla->localconfig->{db_name};
- $self->do("ALTER DATABASE $db_name CHARACTER SET utf8");
+ $self->do("ALTER DATABASE $db_name CHARACTER SET utf8");
}
sub bz_db_is_utf8 {
@@ -806,9 +806,9 @@ sub bz_enum_initial_values {
=head1 MYSQL-SPECIFIC DATABASE-READING METHODS
These methods read information about the database from the disk,
-instead of from a Schema object. They are only reliable for MySQL
+instead of from a Schema object. They are only reliable for MySQL
(see bug 285111 for the reasons why not all DBs use/have functions
-like this), but that's OK because we only need them for
+like this), but that's OK because we only need them for
backwards-compatibility anyway, for versions of Bugzilla before 2.20.
=over 4
@@ -834,7 +834,7 @@ sub _bz_raw_column_info {
my ($self, $table, $column) = @_;
# DBD::mysql does not support selecting a specific column,
- # so we have to get all the columns on the table and find
+ # so we have to get all the columns on the table and find
# the one we want.
my $info_sth = $self->column_info(undef, undef, $table, '%');
@@ -901,7 +901,7 @@ sub bz_index_info_real {
=item C<bz_index_list_real($table)>
- Description: Returns a list of index names on a table in
+ Description: Returns a list of index names on a table in
the database, as it actually exists on disk.
Params: $table - The name of the table you want info about.
Returns: An array of index names.
@@ -923,7 +923,7 @@ sub bz_index_list_real {
=head1 MYSQL-SPECIFIC "SCHEMA BUILDER"
-MySQL needs to be able to read in a legacy database (from before
+MySQL needs to be able to read in a legacy database (from before
Schema existed) and create a Schema object out of it. That's what
this code does.
@@ -942,7 +942,7 @@ sub _bz_build_schema_from_disk {
my @tables = $self->bz_table_list_real();
if (@tables) {
- print "Building Schema object from database...\n";
+ print "Building Schema object from database...\n";
}
foreach my $table (@tables) {
$schema->add_table($table);
@@ -956,7 +956,7 @@ sub _bz_build_schema_from_disk {
foreach my $index (@indexes) {
unless ($index eq 'PRIMARY') {
my $index_info = $self->bz_index_info_real($table, $index);
- ($index_info = $index_info->{FIELDS})
+ ($index_info = $index_info->{FIELDS})
if (!$index_info->{TYPE});
$schema->set_index($table, $index, $index_info);
}
diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm
index 42f3b5efd..5c9ea68a3 100644
--- a/Bugzilla/DB/Oracle.pm
+++ b/Bugzilla/DB/Oracle.pm
@@ -49,7 +49,7 @@ our $fulltext_label = 0;
sub new {
my ($class, $params) = @_;
- my ($user, $pass, $host, $dbname, $port) =
+ my ($user, $pass, $host, $dbname, $port) =
@$params{qw(db_user db_pass db_host db_name db_port)};
# You can never connect to Oracle without a DB name,
@@ -62,11 +62,11 @@ sub new {
# construct the DSN from the parameters we got
my $dsn = "dbi:Oracle:host=$host;sid=$dbname";
$dsn .= ";port=$port" if $port;
- my $attrs = { FetchHashKeyName => 'NAME_lc',
+ my $attrs = { FetchHashKeyName => 'NAME_lc',
LongReadLen => max(Bugzilla->params->{'maxattachmentsize'} || 0,
MIN_LONG_READ_LEN) * 1024,
};
- my $self = $class->db_new({ dsn => $dsn, user => $user,
+ my $self = $class->db_new({ dsn => $dsn, user => $user,
pass => $pass, attrs => $attrs });
# Needed by TheSchwartz
$self->{private_bz_dsn} = $dsn;
@@ -76,7 +76,7 @@ sub new {
# Set the session's default date format to match MySQL
$self->do("ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'");
$self->do("ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SS'");
- $self->do("ALTER SESSION SET NLS_LENGTH_SEMANTICS='CHAR'")
+ $self->do("ALTER SESSION SET NLS_LENGTH_SEMANTICS='CHAR'")
if Bugzilla->params->{'utf8'};
# To allow case insensitive query.
$self->do("ALTER SESSION SET NLS_COMP='ANSI'");
@@ -103,14 +103,14 @@ sub bz_check_regexp {
{ value => $pattern, dberror => $self->errstr });
}
-sub bz_explain {
- my ($self, $sql) = @_;
- my $sth = $self->prepare("EXPLAIN PLAN FOR $sql");
+sub bz_explain {
+ my ($self, $sql) = @_;
+ my $sth = $self->prepare("EXPLAIN PLAN FOR $sql");
$sth->execute();
my $explain = $self->selectcol_arrayref(
"SELECT PLAN_TABLE_OUTPUT FROM TABLE(DBMS_XPLAN.DISPLAY)");
- return join("\n", @$explain);
-}
+ return join("\n", @$explain);
+}
sub sql_group_concat {
my ($self, $text, $separator) = @_;
@@ -134,7 +134,7 @@ sub sql_not_regexp {
$self->bz_check_regexp($real_pattern) if !$nocheck;
- return "NOT REGEXP_LIKE($expr, $pattern)"
+ return "NOT REGEXP_LIKE($expr, $pattern)"
}
sub sql_limit {
@@ -173,7 +173,7 @@ sub sql_fulltext_search {
sub sql_date_format {
my ($self, $date, $format) = @_;
-
+
$format = "%Y.%m.%d %H:%i:%s" if !$format;
$format =~ s/\%Y/YYYY/g;
@@ -213,7 +213,7 @@ sub sql_in {
my $length = $#in_list + 1;
my $splice = $length > 1000 ? 1000 : $length;
my @sub_in_list = splice(@in_list, 0, $splice);
- push(@in_str,
+ push(@in_str,
$self->SUPER::sql_in($column_name, \@sub_in_list, $negate));
}
return "( " . join(" OR ", @in_str) . " )";
@@ -237,7 +237,7 @@ sub bz_drop_table {
}
}
-# Dropping all FKs for a specified table.
+# Dropping all FKs for a specified table.
sub _bz_drop_fks {
my ($self, $table) = @_;
my @columns = $self->bz_table_columns($table);
@@ -272,10 +272,10 @@ sub _fix_hashref {
sub adjust_statement {
my ($sql) = @_;
-
+
if ($sql =~ /^CREATE OR REPLACE.*/i){
return $sql;
- }
+ }
# We can't just assume any occurrence of "''" in $sql is an empty
# string, since "''" can occur inside a string literal as a way of
@@ -297,7 +297,7 @@ sub adjust_statement {
# number of parts
my @result;
my $part = shift @parts;
-
+
# Oracle requires a FROM clause in all SELECT statements, so append
# "FROM dual" to queries without one (e.g., "SELECT NOW()")
my $is_select = ($part =~ m/^\s*SELECT\b/io);
@@ -309,21 +309,21 @@ sub adjust_statement {
# Oracle use SUBSTR instead of SUBSTRING
$part =~ s/\bSUBSTRING\b/SUBSTR/io;
-
+
# Oracle need no 'AS'
$part =~ s/\bAS\b//ig;
-
+
# Oracle doesn't have LIMIT, so if we find the LIMIT comment, wrap the
# query with "SELECT * FROM (...) WHERE rownum < $limit"
my ($limit,$offset) = ($part =~ m{/\* LIMIT (\d*) (\d*) \*/}o);
-
+
push @result, $part;
while( @parts ) {
my $string = shift @parts;
my $nonstring = shift @parts;
-
+
# if the non-string part is zero-length and there are more parts left,
- # then this is an escaped quote inside a string literal
+ # then this is an escaped quote inside a string literal
while( !(length $nonstring) && @parts ) {
# we know it's safe to remove two parts at a time, since we
# entered the loop with an even number of parts
@@ -332,7 +332,7 @@ sub adjust_statement {
}
# Look for a FROM if this is a SELECT and we haven't found one yet
- $has_from = ($nonstring =~ m/\bFROM\b/io)
+ $has_from = ($nonstring =~ m/\bFROM\b/io)
if ($is_select and !$has_from);
# Oracle recognizes CURRENT_DATE, but not CURRENT_DATE()
@@ -341,11 +341,11 @@ sub adjust_statement {
# Oracle use SUBSTR instead of SUBSTRING
$nonstring =~ s/\bSUBSTRING\b/SUBSTR/io;
-
+
# Oracle need no 'AS'
$nonstring =~ s/\bAS\b//ig;
-
- # Take the first 4000 chars for comparison
+
+ # Take the first 4000 chars for comparison
$nonstring =~ s/\(\s*(longdescs_\d+\.thetext|attachdata_\d+\.thedata)/
\(DBMS_LOB.SUBSTR\($1, 4000, 1\)/ig;
@@ -367,7 +367,7 @@ sub adjust_statement {
$new_sql .= " FROM DUAL" if ($is_select and !$has_from);
# Wrap the query with a "WHERE rownum <= ..." if we found LIMIT
-
+
if (defined($limit)) {
if ($new_sql !~ /\bWHERE\b/) {
$new_sql = $new_sql." WHERE 1=1";
@@ -377,7 +377,7 @@ sub adjust_statement {
my ($before_from, $after_from) = split(/\bFROM\b/i, $new_sql, 2);
$before_where = "$before_from FROM ($before_from,"
. " ROW_NUMBER() OVER (ORDER BY 1) R "
- . " FROM $after_from ) ";
+ . " FROM $after_from ) ";
$after_where = " R BETWEEN $offset+1 AND $limit+$offset";
} else {
$after_where = " rownum <=$limit AND ".$after_where;
@@ -442,7 +442,7 @@ sub selectall_arrayref {
unshift @_, $new_stmt;
my $ref = $self->SUPER::selectall_arrayref(@_);
return undef if !defined $ref;
-
+
foreach my $row (@$ref) {
if (ref($row) eq 'ARRAY') {
_fix_arrayref($row);
@@ -462,7 +462,7 @@ sub selectall_hashref {
unshift @_, $new_stmt;
my $rows = $self->SUPER::selectall_hashref(@_);
return undef if !defined $rows;
- foreach my $row (values %$rows) {
+ foreach my $row (values %$rows) {
_fix_hashref($row);
}
return $rows;
@@ -510,7 +510,7 @@ sub bz_table_columns_real {
my ($self, $table) = @_;
$table = uc($table);
my $cols = $self->selectcol_arrayref(
- "SELECT LOWER(COLUMN_NAME) FROM USER_TAB_COLUMNS WHERE
+ "SELECT LOWER(COLUMN_NAME) FROM USER_TAB_COLUMNS WHERE
TABLE_NAME = ? ORDER BY COLUMN_NAME", undef, $table);
return @$cols;
}
@@ -518,7 +518,7 @@ sub bz_table_columns_real {
sub bz_table_list_real {
my ($self) = @_;
my $tables = $self->selectcol_arrayref(
- "SELECT LOWER(TABLE_NAME) FROM USER_TABLES WHERE
+ "SELECT LOWER(TABLE_NAME) FROM USER_TABLES WHERE
TABLE_NAME NOT LIKE ? ORDER BY TABLE_NAME", undef, 'DR$%');
return @$tables;
}
@@ -529,15 +529,15 @@ sub bz_table_list_real {
sub bz_setup_database {
my $self = shift;
-
+
# Create a function that returns SYSDATE to emulate MySQL's "NOW()".
- # Function NOW() is used widely in Bugzilla SQLs, but Oracle does not
- # have that function, So we have to create one ourself.
+ # Function NOW() is used widely in Bugzilla SQLs, but Oracle does not
+ # have that function, So we have to create one ourself.
$self->do("CREATE OR REPLACE FUNCTION NOW "
. " RETURN DATE IS BEGIN RETURN SYSDATE; END;");
- $self->do("CREATE OR REPLACE FUNCTION CHAR_LENGTH(COLUMN_NAME VARCHAR2)"
+ $self->do("CREATE OR REPLACE FUNCTION CHAR_LENGTH(COLUMN_NAME VARCHAR2)"
. " RETURN NUMBER IS BEGIN RETURN LENGTH(COLUMN_NAME); END;");
-
+
# Create types for group_concat
my $type_exists = $self->selectrow_array("SELECT 1 FROM user_types
WHERE type_name = 'T_GROUP_CONCAT'");
@@ -553,7 +553,7 @@ sub bz_setup_database {
END;
END;");
- $self->do("CREATE OR REPLACE TYPE T_GROUP_CONCAT AS OBJECT
+ $self->do("CREATE OR REPLACE TYPE T_GROUP_CONCAT AS OBJECT
( CLOB_CONTENT CLOB,
DELIMITER VARCHAR2(256),
STATIC FUNCTION ODCIAGGREGATEINITIALIZE(
@@ -561,7 +561,7 @@ sub bz_setup_database {
RETURN NUMBER,
MEMBER FUNCTION ODCIAGGREGATEITERATE(
SELF IN OUT NOCOPY T_GROUP_CONCAT,
- VALUE IN T_CLOB_DELIM)
+ VALUE IN T_CLOB_DELIM)
RETURN NUMBER,
MEMBER FUNCTION ODCIAGGREGATETERMINATE(
SELF IN T_GROUP_CONCAT,
@@ -570,7 +570,7 @@ sub bz_setup_database {
RETURN NUMBER,
MEMBER FUNCTION ODCIAGGREGATEMERGE(
SELF IN OUT NOCOPY T_GROUP_CONCAT,
- CTX2 IN T_GROUP_CONCAT)
+ CTX2 IN T_GROUP_CONCAT)
RETURN NUMBER);");
$self->do("CREATE OR REPLACE TYPE BODY T_GROUP_CONCAT IS
@@ -584,35 +584,35 @@ sub bz_setup_database {
END;
MEMBER FUNCTION ODCIAGGREGATEITERATE(
SELF IN OUT NOCOPY T_GROUP_CONCAT,
- VALUE IN T_CLOB_DELIM)
+ VALUE IN T_CLOB_DELIM)
RETURN NUMBER IS
BEGIN
SELF.DELIMITER := VALUE.P_DELIMITER;
- DBMS_LOB.WRITEAPPEND(SELF.CLOB_CONTENT,
+ DBMS_LOB.WRITEAPPEND(SELF.CLOB_CONTENT,
LENGTH(SELF.DELIMITER),
SELF.DELIMITER);
DBMS_LOB.APPEND(SELF.CLOB_CONTENT, VALUE.P_CONTENT);
-
+
RETURN ODCICONST.SUCCESS;
END;
MEMBER FUNCTION ODCIAGGREGATETERMINATE(
SELF IN T_GROUP_CONCAT,
RETURNVALUE OUT NOCOPY CLOB,
- FLAGS IN NUMBER)
+ FLAGS IN NUMBER)
RETURN NUMBER IS
BEGIN
- RETURNVALUE := RTRIM(LTRIM(SELF.CLOB_CONTENT,
- SELF.DELIMITER),
+ RETURNVALUE := RTRIM(LTRIM(SELF.CLOB_CONTENT,
+ SELF.DELIMITER),
SELF.DELIMITER);
RETURN ODCICONST.SUCCESS;
END;
MEMBER FUNCTION ODCIAGGREGATEMERGE(
SELF IN OUT NOCOPY T_GROUP_CONCAT,
- CTX2 IN T_GROUP_CONCAT)
+ CTX2 IN T_GROUP_CONCAT)
RETURN NUMBER IS
BEGIN
- DBMS_LOB.WRITEAPPEND(SELF.CLOB_CONTENT,
- LENGTH(SELF.DELIMITER),
+ DBMS_LOB.WRITEAPPEND(SELF.CLOB_CONTENT,
+ LENGTH(SELF.DELIMITER),
SELF.DELIMITER);
DBMS_LOB.APPEND(SELF.CLOB_CONTENT, CTX2.CLOB_CONTENT);
RETURN ODCICONST.SUCCESS;
@@ -620,8 +620,8 @@ sub bz_setup_database {
END;");
# Create user-defined aggregate function group_concat
- $self->do("CREATE OR REPLACE FUNCTION GROUP_CONCAT(P_INPUT T_CLOB_DELIM)
- RETURN CLOB
+ $self->do("CREATE OR REPLACE FUNCTION GROUP_CONCAT(P_INPUT T_CLOB_DELIM)
+ RETURN CLOB
DETERMINISTIC PARALLEL_ENABLE AGGREGATE USING T_GROUP_CONCAT;");
# Create a WORLD_LEXER named BZ_LEX for multilingual fulltext search
@@ -673,7 +673,7 @@ sub bz_setup_database {
if(@$exist_trigger) {
$self->do("DROP TRIGGER $trigger_name");
}
-
+
my $tr_str = "CREATE OR REPLACE TRIGGER $trigger_name"
. " AFTER UPDATE OF $to_column ON $to_table "
. " REFERENCING "
@@ -727,7 +727,7 @@ sub _get_create_trigger_ddl {
package Bugzilla::DB::Oracle::st;
use base qw(DBI::st);
-
+
sub fetchrow_arrayref {
my $self = shift;
my $ref = $self->SUPER::fetchrow_arrayref(@_);
diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm
index b2ee95e08..8bcbc3262 100644
--- a/Bugzilla/DB/Pg.pm
+++ b/Bugzilla/DB/Pg.pm
@@ -36,7 +36,7 @@ use constant BLOB_TYPE => { pg_type => DBD::Pg::PG_BYTEA };
sub new {
my ($class, $params) = @_;
- my ($user, $pass, $host, $dbname, $port) =
+ my ($user, $pass, $host, $dbname, $port) =
@$params{qw(db_user db_pass db_host db_name db_port)};
# The default database name for PostgreSQL. We have
@@ -55,7 +55,7 @@ sub new {
my $attrs = { pg_enable_utf8 => Bugzilla->params->{'utf8'} };
- my $self = $class->db_new({ dsn => $dsn, user => $user,
+ my $self = $class->db_new({ dsn => $dsn, user => $user,
pass => $pass, attrs => $attrs });
# all class local variables stored in DBI derived class needs to have
@@ -118,7 +118,7 @@ sub sql_not_regexp {
$self->bz_check_regexp($real_pattern) if !$nocheck;
- return "${expr}::text !~* $pattern"
+ return "${expr}::text !~* $pattern"
}
sub sql_limit {
@@ -145,7 +145,7 @@ sub sql_to_days {
sub sql_date_format {
my ($self, $date, $format) = @_;
-
+
$format = "%Y.%m.%d %H:%i:%s" if !$format;
$format =~ s/\%Y/YYYY/g;
@@ -162,13 +162,13 @@ sub sql_date_format {
sub sql_date_math {
my ($self, $date, $operator, $interval, $units) = @_;
-
+
return "$date $operator $interval * INTERVAL '1 $units'";
}
sub sql_string_concat {
my ($self, @params) = @_;
-
+
# Postgres 7.3 does not support concatenating of different types, so we
# need to cast both parameters to text. Version 7.4 seems to handle this
# properly, so when we stop support 7.3, this can be removed.
@@ -222,7 +222,7 @@ sub bz_setup_database {
SFUNC = array_append,
BASETYPE = anyelement,
STYPE = anyarray,
- INITCOND = '{}'
+ INITCOND = '{}'
)");
}
@@ -246,12 +246,12 @@ END
$self->bz_drop_index('longdescs', 'longdescs_thetext_idx');
# Same for all the comments fields in the fulltext table.
$self->bz_drop_index('bugs_fulltext', 'bugs_fulltext_comments_idx');
- $self->bz_drop_index('bugs_fulltext',
+ $self->bz_drop_index('bugs_fulltext',
'bugs_fulltext_comments_noprivate_idx');
# PostgreSQL also wants an index for calling LOWER on
# login_name, which we do with sql_istrcmp all over the place.
- $self->bz_add_index('profiles', 'profiles_login_name_lower_idx',
+ $self->bz_add_index('profiles', 'profiles_login_name_lower_idx',
{FIELDS => ['LOWER(login_name)'], TYPE => 'UNIQUE'});
# Now that Bugzilla::Object uses sql_istrcmp, other tables
@@ -328,7 +328,7 @@ sub _fix_case_differences {
my $dbh = Bugzilla->dbh;
my $duplicates = $dbh->selectcol_arrayref(
- "SELECT DISTINCT LOWER($field) FROM $table
+ "SELECT DISTINCT LOWER($field) FROM $table
GROUP BY LOWER($field) HAVING COUNT(LOWER($field)) > 1");
foreach my $name (@$duplicates) {
@@ -357,7 +357,7 @@ sub _fix_case_differences {
# Custom Schema Information Functions
#####################################################################
-# Pg includes the PostgreSQL system tables in table_list_real, so
+# Pg includes the PostgreSQL system tables in table_list_real, so
# we need to remove those.
sub bz_table_list_real {
my $self = shift;
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index e115dd555..2c8778c27 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -97,9 +97,9 @@ The 'version' of the internal schema structure. This version number
is incremented every time the the fundamental structure of Schema
internals changes.
-This is NOT changed every time a table or a column is added. This
-number is incremented only if the internal structures of this
-Schema would be incompatible with the internal structures of a
+This is NOT changed every time a table or a column is added. This
+number is incremented only if the internal structures of this
+Schema would be incompatible with the internal structures of a
previous Schema version.
In general, unless you are messing around with serialization
@@ -118,9 +118,9 @@ Imagine that someday we decide that NOTNULL => 1 is bad, and we want
to change it so that the schema instead uses NULL => 0.
But we have a bunch of Bugzilla installations around the world with a
-serialized schema that has NOTNULL in it! When we deserialize that
+serialized schema that has NOTNULL in it! When we deserialize that
structure, it just WILL NOT WORK properly inside of our new Schema object.
-So, immediately after deserializing, we need to go through the hash
+So, immediately after deserializing, we need to go through the hash
and change all NOTNULLs to NULLs and so on.
We know that we need to do that on deserializing because we know that
@@ -136,12 +136,12 @@ in which each key is the name of a table in the Bugzilla database.
The value for each key is a hash reference containing the keys
C<FIELDS> and C<INDEXES> which in turn point to array references
-containing information on the table's fields and indexes.
+containing information on the table's fields and indexes.
A field hash reference should must contain the key C<TYPE>. Optional field
-keys include C<PRIMARYKEY>, C<NOTNULL>, and C<DEFAULT>.
+keys include C<PRIMARYKEY>, C<NOTNULL>, and C<DEFAULT>.
-The C<INDEXES> array reference contains index names and information
+The C<INDEXES> array reference contains index names and information
regarding the index. If the index name points to an array reference,
then the index is a regular index and the array contains the indexed
columns. If the index name points to a hash reference, then the hash
@@ -173,10 +173,10 @@ The column pointed at in that table.
=item C<DELETE>
What to do if the row in the parent table is deleted. Choices are
-C<RESTRICT>, C<CASCADE>, or C<SET NULL>.
+C<RESTRICT>, C<CASCADE>, or C<SET NULL>.
-C<RESTRICT> means the deletion of the row in the parent table will
-be forbidden by the database if there is a row in I<this> table that
+C<RESTRICT> means the deletion of the row in the parent table will
+be forbidden by the database if there is a row in I<this> table that
still refers to it. This is the default, if you don't specify
C<DELETE>.
@@ -190,7 +190,7 @@ be set to C<NULL>. (That is, the column isn't C<NOT NULL>.)
What to do if the value in the parent table is updated. You can set this
to C<CASCADE> or C<RESTRICT>, which mean the same thing as they do for
-L</DELETE>. This variable defaults to C<CASCADE>, which means "also
+L</DELETE>. This variable defaults to C<CASCADE>, which means "also
update this column in this table."
=back
@@ -238,7 +238,7 @@ use constant ABSTRACT_SCHEMA => {
assigned_to => {TYPE => 'INT3', NOTNULL => 1,
REFERENCES => {TABLE => 'profiles',
COLUMN => 'userid'}},
- bug_file_loc => {TYPE => 'MEDIUMTEXT',
+ bug_file_loc => {TYPE => 'MEDIUMTEXT',
NOTNULL => 1, DEFAULT => "''"},
bug_severity => {TYPE => 'varchar(64)', NOTNULL => 1},
bug_status => {TYPE => 'varchar(64)', NOTNULL => 1},
@@ -325,8 +325,8 @@ use constant ABSTRACT_SCHEMA => {
bugs_activity => {
FIELDS => [
- id => {TYPE => 'INTSERIAL', NOTNULL => 1,
- PRIMARYKEY => 1},
+ id => {TYPE => 'INTSERIAL', NOTNULL => 1,
+ PRIMARYKEY => 1},
bug_id => {TYPE => 'INT3', NOTNULL => 1,
REFERENCES => {TABLE => 'bugs',
COLUMN => 'bug_id',
@@ -344,7 +344,7 @@ use constant ABSTRACT_SCHEMA => {
COLUMN => 'id'}},
added => {TYPE => 'varchar(255)'},
removed => {TYPE => 'varchar(255)'},
- comment_id => {TYPE => 'INT4',
+ comment_id => {TYPE => 'INT4',
REFERENCES => { TABLE => 'longdescs',
COLUMN => 'comment_id',
DELETE => 'CASCADE'}},
@@ -355,7 +355,7 @@ use constant ABSTRACT_SCHEMA => {
bugs_activity_bug_when_idx => ['bug_when'],
bugs_activity_fieldid_idx => ['fieldid'],
bugs_activity_added_idx => ['added'],
- bugs_activity_removed_idx => ['removed'],
+ bugs_activity_removed_idx => ['removed'],
],
},
@@ -543,7 +543,7 @@ use constant ABSTRACT_SCHEMA => {
class => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"},
],
INDEXES => [
- bug_see_also_bug_id_idx => {FIELDS => [qw(bug_id value)],
+ bug_see_also_bug_id_idx => {FIELDS => [qw(bug_id value)],
TYPE => 'UNIQUE'},
],
},
@@ -742,7 +742,7 @@ use constant ABSTRACT_SCHEMA => {
DEFAULT => 'FALSE'},
buglist => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'FALSE'},
- visibility_field_id => {TYPE => 'INT3',
+ visibility_field_id => {TYPE => 'INT3',
REFERENCES => {TABLE => 'fielddefs',
COLUMN => 'id'}},
value_field_id => {TYPE => 'INT3',
@@ -768,7 +768,7 @@ use constant ABSTRACT_SCHEMA => {
field_visibility => {
FIELDS => [
- field_id => {TYPE => 'INT3',
+ field_id => {TYPE => 'INT3',
REFERENCES => {TABLE => 'fielddefs',
COLUMN => 'id',
DELETE => 'CASCADE'}},
@@ -794,7 +794,7 @@ use constant ABSTRACT_SCHEMA => {
REFERENCES => {TABLE => 'products',
COLUMN => 'id',
DELETE => 'CASCADE'}},
- isactive => {TYPE => 'BOOLEAN', NOTNULL => 1,
+ isactive => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'TRUE'},
],
INDEXES => [
@@ -805,7 +805,7 @@ use constant ABSTRACT_SCHEMA => {
milestones => {
FIELDS => [
- id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
+ id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
PRIMARYKEY => 1},
product_id => {TYPE => 'INT2', NOTNULL => 1,
REFERENCES => {TABLE => 'products',
@@ -814,7 +814,7 @@ use constant ABSTRACT_SCHEMA => {
value => {TYPE => 'varchar(20)', NOTNULL => 1},
sortkey => {TYPE => 'INT2', NOTNULL => 1,
DEFAULT => 0},
- isactive => {TYPE => 'BOOLEAN', NOTNULL => 1,
+ isactive => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'TRUE'},
],
INDEXES => [
@@ -894,11 +894,11 @@ use constant ABSTRACT_SCHEMA => {
FIELDS => [
# On bug creation, there is no old value.
old_status => {TYPE => 'INT2',
- REFERENCES => {TABLE => 'bug_status',
+ REFERENCES => {TABLE => 'bug_status',
COLUMN => 'id',
DELETE => 'CASCADE'}},
new_status => {TYPE => 'INT2', NOTNULL => 1,
- REFERENCES => {TABLE => 'bug_status',
+ REFERENCES => {TABLE => 'bug_status',
COLUMN => 'id',
DELETE => 'CASCADE'}},
require_comment => {TYPE => 'INT1', NOTNULL => 1, DEFAULT => 0},
@@ -948,9 +948,9 @@ use constant ABSTRACT_SCHEMA => {
profile_search => {
FIELDS => [
id => {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1},
- user_id => {TYPE => 'INT3', NOTNULL => 1,
- REFERENCES => {TABLE => 'profiles',
- COLUMN => 'userid',
+ user_id => {TYPE => 'INT3', NOTNULL => 1,
+ REFERENCES => {TABLE => 'profiles',
+ COLUMN => 'userid',
DELETE => 'CASCADE'}},
bug_list => {TYPE => 'MEDIUMTEXT', NOTNULL => 1},
list_order => {TYPE => 'MEDIUMTEXT'},
@@ -962,10 +962,10 @@ use constant ABSTRACT_SCHEMA => {
profiles_activity => {
FIELDS => [
- id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
- PRIMARYKEY => 1},
+ id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
+ PRIMARYKEY => 1},
userid => {TYPE => 'INT3', NOTNULL => 1,
- REFERENCES => {TABLE => 'profiles',
+ REFERENCES => {TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'}},
who => {TYPE => 'INT3', NOTNULL => 1,
@@ -1163,9 +1163,9 @@ use constant ABSTRACT_SCHEMA => {
ip_addr => {TYPE => 'varchar(40)', NOTNULL => 1},
],
INDEXES => [
- # We do lookups by every item in the table simultaneously, but
+ # We do lookups by every item in the table simultaneously, but
# having an index with all three items would be the same size as
- # the table. So instead we have an index on just the smallest item,
+ # the table. So instead we have an index on just the smallest item,
# to speed lookups.
login_failure_user_id_idx => ['user_id'],
],
@@ -1557,7 +1557,7 @@ use constant ABSTRACT_SCHEMA => {
id => {TYPE => 'MEDIUMSERIAL', PRIMARYKEY => 1,
NOTNULL => 1},
owner_userid => {TYPE => 'INT3', NOTNULL => 1,
- REFERENCES => {TABLE => 'profiles',
+ REFERENCES => {TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'CASCADE'}},
subject => {TYPE => 'varchar(128)'},
@@ -1575,7 +1575,7 @@ use constant ABSTRACT_SCHEMA => {
quipid => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
PRIMARYKEY => 1},
userid => {TYPE => 'INT3',
- REFERENCES => {TABLE => 'profiles',
+ REFERENCES => {TABLE => 'profiles',
COLUMN => 'userid',
DELETE => 'SET NULL'}},
quip => {TYPE => 'MEDIUMTEXT', NOTNULL => 1},
@@ -1600,7 +1600,7 @@ use constant ABSTRACT_SCHEMA => {
setting => {
FIELDS => [
name => {TYPE => 'varchar(32)', NOTNULL => 1,
- PRIMARYKEY => 1},
+ PRIMARYKEY => 1},
default_value => {TYPE => 'varchar(32)', NOTNULL => 1},
is_enabled => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'TRUE'},
@@ -1612,7 +1612,7 @@ use constant ABSTRACT_SCHEMA => {
setting_value => {
FIELDS => [
name => {TYPE => 'varchar(32)', NOTNULL => 1,
- REFERENCES => {TABLE => 'setting',
+ REFERENCES => {TABLE => 'setting',
COLUMN => 'name',
DELETE => 'CASCADE'}},
value => {TYPE => 'varchar(32)', NOTNULL => 1},
@@ -1668,7 +1668,7 @@ use constant ABSTRACT_SCHEMA => {
funcname => {TYPE => 'varchar(255)', NOTNULL => 1},
],
INDEXES => [
- ts_funcmap_funcname_idx => {FIELDS => ['funcname'],
+ ts_funcmap_funcname_idx => {FIELDS => ['funcname'],
TYPE => 'UNIQUE'},
],
},
@@ -1677,7 +1677,7 @@ use constant ABSTRACT_SCHEMA => {
FIELDS => [
# In a standard TheSchwartz schema, this is a BIGINT, but we
# don't have those and I didn't want to add them just for this.
- jobid => {TYPE => 'INTSERIAL', PRIMARYKEY => 1,
+ jobid => {TYPE => 'INTSERIAL', PRIMARYKEY => 1,
NOTNULL => 1},
funcid => {TYPE => 'INT4', NOTNULL => 1},
# In standard TheSchwartz, this is a MEDIUMBLOB.
@@ -1709,7 +1709,7 @@ use constant ABSTRACT_SCHEMA => {
value => {TYPE => 'LONGBLOB'},
],
INDEXES => [
- ts_note_jobid_idx => {FIELDS => [qw(jobid notekey)],
+ ts_note_jobid_idx => {FIELDS => [qw(jobid notekey)],
TYPE => 'UNIQUE'},
],
},
@@ -1895,10 +1895,10 @@ sub _initialize {
define the database-specific implementation of the all
abstract data types), and then call the C<_adjust_schema>
method.
- Parameters: $abstract_schema (optional) - A reference to a hash. If
+ Parameters: $abstract_schema (optional) - A reference to a hash. If
provided, this hash will be used as the internal
representation of the abstract schema instead of our
- default abstract schema. This is intended for internal
+ default abstract schema. This is intended for internal
use only by deserialize_abstract.
Returns: the instance of the Schema class
@@ -1916,11 +1916,11 @@ sub _initialize {
# tables. If we don't lock/unlock keys, lock_value complains.
lock_keys(%$abstract_schema);
foreach my $table (keys %{ABSTRACT_SCHEMA()}) {
- lock_value(%$abstract_schema, $table)
+ lock_value(%$abstract_schema, $table)
if exists $abstract_schema->{$table};
}
unlock_keys(%$abstract_schema);
- Bugzilla::Hook::process('db_schema_abstract_schema',
+ Bugzilla::Hook::process('db_schema_abstract_schema',
{ schema => $abstract_schema });
unlock_hash(%$abstract_schema);
}
@@ -1986,7 +1986,7 @@ sub get_type_ddl {
=item B<Description>
Public method to convert abstract (database-generic) field specifiers to
-database-specific data types suitable for use in a C<CREATE TABLE> or
+database-specific data types suitable for use in a C<CREATE TABLE> or
C<ALTER TABLE> SQL statment. If no database-specific field type has been
defined for the given field type, then it will just return the same field type.
@@ -1995,14 +1995,14 @@ defined for the given field type, then it will just return the same field type.
=over
=item C<$def> - A reference to a hash of a field containing the following keys:
-C<TYPE> (required), C<NOTNULL> (optional), C<DEFAULT> (optional),
+C<TYPE> (required), C<NOTNULL> (optional), C<DEFAULT> (optional),
C<PRIMARYKEY> (optional), C<REFERENCES> (optional)
=back
=item B<Returns>
-A DDL string suitable for describing a field in a C<CREATE TABLE> or
+A DDL string suitable for describing a field in a C<CREATE TABLE> or
C<ALTER TABLE> SQL statement
=back
@@ -2012,7 +2012,7 @@ C<ALTER TABLE> SQL statement
my $self = shift;
my $finfo = (@_ == 1 && ref($_[0]) eq 'HASH') ? $_[0] : { @_ };
my $type = $finfo->{TYPE};
- confess "A valid TYPE was not specified for this column (got "
+ confess "A valid TYPE was not specified for this column (got "
. Dumper($finfo) . ")" unless ($type);
my $default = $finfo->{DEFAULT};
@@ -2059,7 +2059,7 @@ Protected method. Translates the C<REFERENCES> item of a column into SQL.
=item B<Returns>
-SQL for to define the foreign key, or an empty string if C<$references>
+SQL for to define the foreign key, or an empty string if C<$references>
is undefined.
=back
@@ -2085,7 +2085,7 @@ is undefined.
# other reasons).
sub _get_fk_name {
my ($self, $table, $column, $references) = @_;
- my $to_table = $references->{TABLE};
+ my $to_table = $references->{TABLE};
my $to_column = $references->{COLUMN};
my $name = "fk_${table}_${column}_${to_table}_${to_column}";
@@ -2133,7 +2133,7 @@ sub _column_fks_to_ddl {
return @ddl;
}
-sub get_drop_fk_sql {
+sub get_drop_fk_sql {
my ($self, $table, $column, $references) = @_;
my $fk_name = $self->_get_fk_name($table, $column, $references);
@@ -2191,7 +2191,7 @@ sub get_table_list {
=cut
my $self = shift;
- return sort keys %{$self->{schema}};
+ return sort keys %{$self->{schema}};
}
sub get_table_columns {
@@ -2262,7 +2262,7 @@ sub get_table_ddl {
while (@indexes) {
my $index_name = shift(@indexes);
my $index_info = shift(@indexes);
- my $index_sql = $self->get_add_index_ddl($table, $index_name,
+ my $index_sql = $self->get_add_index_ddl($table, $index_name,
$index_info);
push(@ddl, $index_sql) if $index_sql;
}
@@ -2303,12 +2303,12 @@ sub _get_create_table_ddl {
push(@fk_lines, $fk_ddl);
}
}
-
+
my $sql = "CREATE TABLE $table (\n" . join(",\n", @col_lines, @fk_lines)
. "\n)";
return $sql
-}
+}
sub _get_create_index_ddl {
@@ -2345,7 +2345,7 @@ sub get_add_column_ddl {
$column - The name of the column being added.
\%definition - The new definition for the column,
in standard C<ABSTRACT_SCHEMA> format.
- $init_value - (optional) An initial value to set
+ $init_value - (optional) An initial value to set
the column to. Should already be SQL-quoted
if necessary.
Returns: An array of SQL statements.
@@ -2376,14 +2376,14 @@ sub get_add_index_ddl {
Description: Gets SQL for creating an index.
NOTE: Subclasses should not override this function. Instead,
- if they need to specify a custom CREATE INDEX statement,
+ if they need to specify a custom CREATE INDEX statement,
they should override C<_get_create_index_ddl>
Params: $table - The name of the table the index will be on.
$name - The name of the new index.
- $definition - An index definition. Either a hashref
- with FIELDS and TYPE or an arrayref
+ $definition - An index definition. Either a hashref
+ with FIELDS and TYPE or an arrayref
containing a list of columns.
- Returns: An array of SQL statements that will create the
+ Returns: An array of SQL statements that will create the
requested index.
=cut
@@ -2399,8 +2399,8 @@ sub get_add_index_ddl {
$index_fields = $definition;
$index_type = '';
}
-
- return $self->_get_create_index_ddl($table, $name, $index_fields,
+
+ return $self->_get_create_index_ddl($table, $name, $index_fields,
$index_type);
}
@@ -2433,7 +2433,7 @@ sub get_alter_column_ddl {
# If the types have changed, we have to deal with that.
if (uc(trim($old_def->{TYPE})) ne uc(trim($new_def->{TYPE}))) {
- push(@statements, $self->_get_alter_type_sql($table, $column,
+ push(@statements, $self->_get_alter_type_sql($table, $column,
$new_def, $old_def));
}
@@ -2453,8 +2453,8 @@ sub get_alter_column_ddl {
. " DROP DEFAULT");
}
# If we went from no default to a default, or we changed the default.
- elsif ( (defined $default && !defined $default_old) ||
- ($default ne $default_old) )
+ elsif ( (defined $default && !defined $default_old) ||
+ ($default ne $default_old) )
{
push(@statements, "ALTER TABLE $table ALTER COLUMN $column "
. " SET DEFAULT $default");
@@ -2489,8 +2489,8 @@ sub get_alter_column_ddl {
sub _set_nulls_sql {
my ($self, $table, $column, $new_def, $set_nulls_to) = @_;
my $default = $new_def->{DEFAULT};
- # If we have a set_nulls_to, that overrides the DEFAULT
- # (although nobody would usually specify both a default and
+ # If we have a set_nulls_to, that overrides the DEFAULT
+ # (although nobody would usually specify both a default and
# a set_nulls_to.)
$default = $set_nulls_to if defined $set_nulls_to;
if (defined $default) {
@@ -2785,7 +2785,7 @@ sub delete_column {
my $abstract_fields = $self->{abstract_schema}{$table}{FIELDS};
my $name_position = firstidx { $_ eq $column } @$abstract_fields;
- die "Attempted to delete nonexistent column ${table}.${column}"
+ die "Attempted to delete nonexistent column ${table}.${column}"
if $name_position == -1;
# Delete the key/value pair from the array.
splice(@$abstract_fields, $name_position, 2);
@@ -2826,7 +2826,7 @@ sub set_column {
if you want to do that.
Params: $table - The name of the table that the column is on.
$column - The name of the column.
- \%new_def - The new definition for the column, in
+ \%new_def - The new definition for the column, in
C<ABSTRACT_SCHEMA> format.
Returns: nothing
@@ -2872,7 +2872,7 @@ sub set_index {
if you want to do that.
Params: $table - The table the index is on.
$name - The name of the index.
- $definition - A hashref or an arrayref. An index
+ $definition - A hashref or an arrayref. An index
definition in C<ABSTRACT_SCHEMA> format.
Returns: nothing
@@ -2929,7 +2929,7 @@ sub delete_index {
my $indexes = $self->{abstract_schema}{$table}{INDEXES};
my $name_position = firstidx { $_ eq $name } @$indexes;
- die "Attempted to delete nonexistent index $name on the $table table"
+ die "Attempted to delete nonexistent index $name on the $table table"
if $name_position == -1;
# Delete the key/value pair from the array.
splice(@$indexes, $name_position, 2);
@@ -2944,7 +2944,7 @@ sub columns_equal {
Description: Tells you if two columns have entirely identical definitions.
The TYPE field's value will be compared case-insensitive.
However, all other fields will be case-sensitive.
- Params: $col_one, $col_two - The columns to compare. Hash
+ Params: $col_one, $col_two - The columns to compare. Hash
references, in C<ABSTRACT_SCHEMA> format.
Returns: C<1> if the columns are identical, C<0> if they are not.
@@ -2987,23 +2987,23 @@ sub columns_equal {
Do not attempt to manipulate this data directly,
as the format may change at any time in the future.
The only thing you should do with the returned value
- is either store it somewhere (coupled with appropriate
+ is either store it somewhere (coupled with appropriate
SCHEMA_VERSION) or deserialize it.
=cut
sub serialize_abstract {
my ($self) = @_;
-
+
# Make it ok to eval
local $Data::Dumper::Purity = 1;
-
+
# Avoid cross-refs
local $Data::Dumper::Deepcopy = 1;
-
+
# Always sort keys to allow textual compare
local $Data::Dumper::Sortkeys = 1;
-
+
return Dumper($self->{abstract_schema});
}
@@ -3015,8 +3015,8 @@ sub serialize_abstract {
$version - A number. The "version"
of the Schema that did the serialization.
See the docs for C<SCHEMA_VERSION> for more details.
- Returns: A Schema object. It will have the methods of (and work
- in the same fashion as) the current version of Schema.
+ Returns: A Schema object. It will have the methods of (and work
+ in the same fashion as) the current version of Schema.
However, it will represent the serialized data instead of
ABSTRACT_SCHEMA.
@@ -3040,7 +3040,7 @@ sub deserialize_abstract {
if ($version < 3) {
my $standard = $class->new()->{abstract_schema};
foreach my $table_name (keys %$thawed_hash) {
- my %standard_fields =
+ my %standard_fields =
@{ $standard->{$table_name}->{FIELDS} || [] };
my $table = $thawed_hash->{$table_name};
my %fields = @{ $table->{FIELDS} || [] };
@@ -3116,7 +3116,7 @@ Integer values (-8,388,608 - 8,388,607 or 0 - 16,777,215 unsigned)
=item C<INT4>
-Integer values (-2,147,483,648 - 2,147,483,647 or 0 - 4,294,967,295
+Integer values (-2,147,483,648 - 2,147,483,647 or 0 - 4,294,967,295
unsigned)
=item C<SMALLSERIAL>
@@ -3150,11 +3150,11 @@ Variable length string of binary data up to 4M (2^32 - 1) bytes wide
=item C<DATETIME>
-DATETIME support varies from database to database, however, it's generally
+DATETIME support varies from database to database, however, it's generally
safe to say that DATETIME entries support all date/time combinations greater
than 1900-01-01 00:00:00. Note that the format used is C<YYYY-MM-DD hh:mm:ss>
to be safe, though it's possible that your database may not require
-leading zeros. For greatest compatibility, however, please make sure dates
+leading zeros. For greatest compatibility, however, please make sure dates
are formatted as above for queries to guarantee consistent results.
=back
diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm
index 2e40e38cf..ec25bbac6 100644
--- a/Bugzilla/DB/Schema/Mysql.pm
+++ b/Bugzilla/DB/Schema/Mysql.pm
@@ -21,7 +21,7 @@ use Bugzilla::Error;
use base qw(Bugzilla::DB::Schema);
-# This is for column_info_to_column, to know when a tinyint is a
+# This is for column_info_to_column, to know when a tinyint is a
# boolean and when it's really a tinyint. This only has to be accurate
# up to and through 2.19.3, because that's the only time we need
# column_info_to_column.
@@ -30,7 +30,7 @@ use base qw(Bugzilla::DB::Schema);
# that should be interpreted as a BOOLEAN instead of as an INT1 when
# reading in the Schema from the disk. The values are discarded; I just
# used "1" for simplicity.
-#
+#
# THIS CONSTANT IS ONLY USED FOR UPGRADES FROM 2.18 OR EARLIER. DON'T
# UPDATE IT TO MODERN COLUMN NAMES OR DEFINITIONS.
use constant BOOLEAN_MAP => {
@@ -40,7 +40,7 @@ use constant BOOLEAN_MAP => {
longdescs => {isprivate => 1, already_wrapped => 1},
attachments => {ispatch => 1, isobsolete => 1, isprivate => 1},
flags => {is_active => 1},
- flagtypes => {is_active => 1, is_requestable => 1,
+ flagtypes => {is_active => 1, is_requestable => 1,
is_requesteeble => 1, is_multiplicable => 1},
fielddefs => {mailhead => 1, obsolete => 1},
bug_status => {isactive => 1},
@@ -88,7 +88,7 @@ sub _initialize {
$self->{db_specific} = {
BOOLEAN => 'tinyint',
- FALSE => '0',
+ FALSE => '0',
TRUE => '1',
INT1 => 'tinyint',
@@ -124,7 +124,7 @@ sub _get_create_table_ddl {
my $charset = Bugzilla->dbh->bz_db_is_utf8 ? "CHARACTER SET utf8" : '';
my $type = grep($_ eq $table, MYISAM_TABLES) ? 'MYISAM' : 'InnoDB';
- return($self->SUPER::_get_create_table_ddl($table)
+ return($self->SUPER::_get_create_table_ddl($table)
. " ENGINE = $type $charset");
} #eosub--_get_create_table_ddl
@@ -150,7 +150,7 @@ sub get_create_database_sql {
my ($self, $name) = @_;
# We only create as utf8 if we have no params (meaning we're doing
# a new installation) or if the utf8 param is on.
- my $create_utf8 = Bugzilla->params->{'utf8'}
+ my $create_utf8 = Bugzilla->params->{'utf8'}
|| !defined Bugzilla->params->{'utf8'};
my $charset = $create_utf8 ? "CHARACTER SET utf8" : '';
return ("CREATE DATABASE $name $charset");
@@ -180,7 +180,7 @@ sub get_alter_column_ddl {
delete $old_defaultless{DEFAULT};
delete $new_defaultless{DEFAULT};
if (!$self->columns_equal($old_def, $new_def)
- && $self->columns_equal(\%new_defaultless, \%old_defaultless))
+ && $self->columns_equal(\%new_defaultless, \%old_defaultless))
{
if (!defined $new_def->{DEFAULT}) {
push(@statements,
@@ -193,7 +193,7 @@ sub get_alter_column_ddl {
}
else {
my $new_ddl = $self->get_type_ddl(\%new_def_copy);
- push(@statements, "ALTER TABLE $table CHANGE COLUMN
+ push(@statements, "ALTER TABLE $table CHANGE COLUMN
$column $column $new_ddl");
}
@@ -213,7 +213,7 @@ sub get_drop_fk_sql {
# MySQL requires, and will create, an index on any column with
# an FK. It will name it after the fk, which we never do.
- # So if there's an index named after the fk, we also have to delete it.
+ # So if there's an index named after the fk, we also have to delete it.
if ($dbh->bz_index_info_real($table, $fk_name)) {
push(@sql, $self->get_drop_index_ddl($table, $fk_name));
}
@@ -227,7 +227,7 @@ sub get_drop_index_ddl {
}
# A special function for MySQL, for renaming a lot of indexes.
-# Index renames is a hash, where the key is a string - the
+# Index renames is a hash, where the key is a string - the
# old names of the index, and the value is a hash - the index
# definition that we're renaming to, with an extra key of "NAME"
# that contains the new index name.
@@ -305,14 +305,14 @@ sub column_info_to_column {
# be dropping it soon, or it's a custom end-user column, in which
# case having a bogus default won't harm anything.
my $schema_column = $self->get_column($table, $col_name);
- unless ( (!$column_info->{COLUMN_DEF}
+ unless ( (!$column_info->{COLUMN_DEF}
|| $column_info->{COLUMN_DEF} eq '0000-00-00 00:00:00'
|| $column_info->{COLUMN_DEF} eq '0.00')
- && $schema_column
+ && $schema_column
&& !exists $schema_column->{DEFAULT}) {
-
+
my $default = $column_info->{COLUMN_DEF};
- # Schema uses '0' for the defaults for decimal fields.
+ # Schema uses '0' for the defaults for decimal fields.
$default = 0 if $default =~ /^0\.0+$/;
# If we're not a number, we're a string and need to be
# quoted.
@@ -353,7 +353,7 @@ sub column_info_to_column {
}
elsif ($type eq 'SMALLINT') {
$type = 'SMALLSERIAL';
- }
+ }
else {
$type = 'INTSERIAL';
}
@@ -362,7 +362,7 @@ sub column_info_to_column {
}
- # For all other db-specific types, check if they exist in
+ # For all other db-specific types, check if they exist in
# REVERSE_MAPPING and use the type found there.
if (exists REVERSE_MAPPING->{$type}) {
$type = REVERSE_MAPPING->{$type};
diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm
index 7572f80cf..b67ddfd59 100644
--- a/Bugzilla/DB/Schema/Oracle.pm
+++ b/Bugzilla/DB/Schema/Oracle.pm
@@ -38,7 +38,7 @@ sub _initialize {
$self->{db_specific} = {
BOOLEAN => 'integer',
- FALSE => '0',
+ FALSE => '0',
TRUE => '1',
INT1 => 'integer',
@@ -77,8 +77,8 @@ sub get_table_ddl {
while (@fields) {
my $field_name = shift @fields;
my $field_info = shift @fields;
- # Create triggers to deal with empty string.
- if ( $field_info->{TYPE} =~ /varchar|TEXT/i
+ # Create triggers to deal with empty string.
+ if ( $field_info->{TYPE} =~ /varchar|TEXT/i
&& $field_info->{NOTNULL} ) {
push (@ddl, _get_notnull_trigger_ddl($table, $field_name));
}
@@ -91,21 +91,21 @@ sub get_table_ddl {
} #eosub--get_table_ddl
-# Extend superclass method to create Oracle Text indexes if index type
+# Extend superclass method to create Oracle Text indexes if index type
# is FULLTEXT from schema. Returns a "create index" SQL statement.
sub _get_create_index_ddl {
my ($self, $table_name, $index_name, $index_fields, $index_type) = @_;
$index_name = "idx_" . $self->_hash_identifier($index_name);
if ($index_type eq 'FULLTEXT') {
- my $sql = "CREATE INDEX $index_name ON $table_name ("
+ my $sql = "CREATE INDEX $index_name ON $table_name ("
. join(',',@$index_fields)
. ") INDEXTYPE IS CTXSYS.CONTEXT "
. " PARAMETERS('LEXER BZ_LEX SYNC(ON COMMIT)')" ;
return $sql;
}
- return($self->SUPER::_get_create_index_ddl($table_name, $index_name,
+ return($self->SUPER::_get_create_index_ddl($table_name, $index_name,
$index_fields, $index_type));
}
@@ -118,7 +118,7 @@ sub get_drop_index_ddl {
return $self->SUPER::get_drop_index_ddl($table, $name);
}
-# Oracle supports the use of FOREIGN KEY integrity constraints
+# Oracle supports the use of FOREIGN KEY integrity constraints
# to define the referential integrity actions, including:
# - Update and delete No Action (default)
# - Delete CASCADE
@@ -182,7 +182,7 @@ sub _get_fk_name {
my $to_column = $references->{COLUMN};
my $fk_name = "${table}_${column}_${to_table}_${to_column}";
$fk_name = "fk_" . $self->_hash_identifier($fk_name);
-
+
return $fk_name;
}
@@ -206,7 +206,7 @@ sub get_add_column_ddl {
}
else {
@sql = $self->SUPER::get_add_column_ddl(@_);
- # Create triggers to deal with empty string.
+ # Create triggers to deal with empty string.
if ($definition->{TYPE} =~ /varchar|TEXT/i && $definition->{NOTNULL}) {
push(@sql, _get_notnull_trigger_ddl($table, $column));
}
@@ -224,7 +224,7 @@ sub get_alter_column_ddl {
# If the types have changed, we have to deal with that.
if (uc(trim($old_def->{TYPE})) ne uc(trim($new_def->{TYPE}))) {
- push(@statements, $self->_get_alter_type_sql($table, $column,
+ push(@statements, $self->_get_alter_type_sql($table, $column,
$new_def, $old_def));
}
@@ -244,8 +244,8 @@ sub get_alter_column_ddl {
. " DEFAULT NULL");
}
# If we went from no default to a default, or we changed the default.
- elsif ( (defined $default && !defined $default_old) ||
- ($default ne $default_old) )
+ elsif ( (defined $default && !defined $default_old) ||
+ ($default ne $default_old) )
{
push(@statements, "ALTER TABLE $table MODIFY $column "
. " DEFAULT $default");
@@ -256,8 +256,8 @@ sub get_alter_column_ddl {
my $setdefault;
# Handle any fields that were NULL before, if we have a default,
$setdefault = $default if defined $default;
- # But if we have a set_nulls_to, that overrides the DEFAULT
- # (although nobody would usually specify both a default and
+ # But if we have a set_nulls_to, that overrides the DEFAULT
+ # (although nobody would usually specify both a default and
# a set_nulls_to.)
$setdefault = $set_nulls_to if defined $set_nulls_to;
if (defined $setdefault) {
@@ -275,7 +275,7 @@ sub get_alter_column_ddl {
push(@statements, "ALTER TABLE $table MODIFY $column"
. " NULL");
push(@statements, "DROP TRIGGER ${table}_${column}")
- if $new_def->{TYPE} =~ /varchar|text/i
+ if $new_def->{TYPE} =~ /varchar|text/i
&& $old_def->{TYPE} =~ /varchar|text/i;
}
@@ -296,34 +296,34 @@ sub _get_alter_type_sql {
my @statements;
my $type = $new_def->{TYPE};
- $type = $self->{db_specific}->{$type}
+ $type = $self->{db_specific}->{$type}
if exists $self->{db_specific}->{$type};
if ($type =~ /serial/i && $old_def->{TYPE} !~ /serial/i) {
- die("You cannot specify a DEFAULT on a SERIAL-type column.")
+ die("You cannot specify a DEFAULT on a SERIAL-type column.")
if $new_def->{DEFAULT};
}
- if ( ($old_def->{TYPE} =~ /LONGTEXT/i && $new_def->{TYPE} !~ /LONGTEXT/i)
+ if ( ($old_def->{TYPE} =~ /LONGTEXT/i && $new_def->{TYPE} !~ /LONGTEXT/i)
|| ($old_def->{TYPE} !~ /LONGTEXT/i && $new_def->{TYPE} =~ /LONGTEXT/i)
) {
- # LONG to VARCHAR or VARCHAR to LONG is not allowed in Oracle,
+ # LONG to VARCHAR or VARCHAR to LONG is not allowed in Oracle,
# just a way to work around.
# Determine whether column_temp is already exist.
my $dbh=Bugzilla->dbh;
my $column_exist = $dbh->selectcol_arrayref(
- "SELECT CNAME FROM COL WHERE TNAME = UPPER(?) AND
+ "SELECT CNAME FROM COL WHERE TNAME = UPPER(?) AND
CNAME = UPPER(?)", undef,$table,$column . "_temp");
if(!@$column_exist) {
- push(@statements,
- "ALTER TABLE $table ADD ${column}_temp $type");
+ push(@statements,
+ "ALTER TABLE $table ADD ${column}_temp $type");
}
push(@statements, "UPDATE $table SET ${column}_temp = $column");
push(@statements, "COMMIT");
push(@statements, "ALTER TABLE $table DROP COLUMN $column");
- push(@statements,
+ push(@statements,
"ALTER TABLE $table RENAME COLUMN ${column}_temp TO $column");
- } else {
+ } else {
push(@statements, "ALTER TABLE $table MODIFY $column $type");
}
@@ -337,15 +337,15 @@ sub _get_alter_type_sql {
push(@statements, "DROP SEQUENCE ${table}_${column}_SEQ");
push(@statements, "DROP TRIGGER ${table}_${column}_TR");
}
-
+
# If this column is changed to type TEXT/VARCHAR, we need to deal with
# empty string.
- if ( $old_def->{TYPE} !~ /varchar|text/i
- && $new_def->{TYPE} =~ /varchar|text/i
+ if ( $old_def->{TYPE} !~ /varchar|text/i
+ && $new_def->{TYPE} =~ /varchar|text/i
&& $new_def->{NOTNULL} )
{
push (@statements, _get_notnull_trigger_ddl($table, $column));
- }
+ }
# If this column is no longer TEXT/VARCHAR, we need to drop the trigger
# that went along with it.
if ( $old_def->{TYPE} =~ /varchar|text/i
@@ -353,7 +353,7 @@ sub _get_alter_type_sql {
&& $new_def->{TYPE} !~ /varchar|text/i )
{
push(@statements, "DROP TRIGGER ${table}_${column}");
- }
+ }
return @statements;
}
@@ -495,13 +495,13 @@ sub _get_create_trigger_ddl {
return $serial_sql;
}
-sub get_set_serial_sql {
- my ($self, $table, $column, $value) = @_;
+sub get_set_serial_sql {
+ my ($self, $table, $column, $value) = @_;
my @sql;
my $seq_name = "${table}_${column}_SEQ";
push(@sql, "DROP SEQUENCE ${seq_name}");
- push(@sql, $self->_get_create_seq_ddl($table, $column, $value));
+ push(@sql, $self->_get_create_seq_ddl($table, $column, $value));
return @sql;
-}
+}
1;
diff --git a/Bugzilla/DB/Schema/Pg.pm b/Bugzilla/DB/Schema/Pg.pm
index d8550e2e8..7606faa3d 100644
--- a/Bugzilla/DB/Schema/Pg.pm
+++ b/Bugzilla/DB/Schema/Pg.pm
@@ -32,13 +32,13 @@ sub _initialize {
if ($self->{schema}{$table}{INDEXES}) {
foreach my $index (@{ $self->{schema}{$table}{INDEXES} }) {
if (ref($index) eq 'HASH') {
- delete($index->{TYPE}) if (exists $index->{TYPE}
+ delete($index->{TYPE}) if (exists $index->{TYPE}
&& $index->{TYPE} eq 'FULLTEXT');
}
}
foreach my $index (@{ $self->{abstract_schema}{$table}{INDEXES} }) {
if (ref($index) eq 'HASH') {
- delete($index->{TYPE}) if (exists $index->{TYPE}
+ delete($index->{TYPE}) if (exists $index->{TYPE}
&& $index->{TYPE} eq 'FULLTEXT');
}
}
@@ -48,7 +48,7 @@ sub _initialize {
$self->{db_specific} = {
BOOLEAN => 'smallint',
- FALSE => '0',
+ FALSE => '0',
TRUE => '1',
INT1 => 'integer',
@@ -98,7 +98,7 @@ sub get_rename_column_ddl {
my $def = $self->get_column_abstract($table, $old_name);
if ($def->{TYPE} =~ /SERIAL/i) {
# We have to rename the series also.
- push(@sql, "ALTER SEQUENCE ${table}_${old_name}_seq
+ push(@sql, "ALTER SEQUENCE ${table}_${old_name}_seq
RENAME TO ${table}_${new_name}_seq");
}
return @sql;
@@ -148,11 +148,11 @@ sub _get_alter_type_sql {
my @statements;
my $type = $new_def->{TYPE};
- $type = $self->{db_specific}->{$type}
+ $type = $self->{db_specific}->{$type}
if exists $self->{db_specific}->{$type};
if ($type =~ /serial/i && $old_def->{TYPE} !~ /serial/i) {
- die("You cannot specify a DEFAULT on a SERIAL-type column.")
+ die("You cannot specify a DEFAULT on a SERIAL-type column.")
if $new_def->{DEFAULT};
}
@@ -171,16 +171,16 @@ sub _get_alter_type_sql {
push(@statements, "SELECT setval('${table}_${column}_seq',
MAX($table.$column))
FROM $table");
- push(@statements, "ALTER TABLE $table ALTER COLUMN $column
+ push(@statements, "ALTER TABLE $table ALTER COLUMN $column
SET DEFAULT nextval('${table}_${column}_seq')");
}
# If this column is no longer SERIAL, we need to drop the sequence
# that went along with it.
if ($old_def->{TYPE} =~ /serial/i && $new_def->{TYPE} !~ /serial/i) {
- push(@statements, "ALTER TABLE $table ALTER COLUMN $column
+ push(@statements, "ALTER TABLE $table ALTER COLUMN $column
DROP DEFAULT");
- push(@statements, "ALTER SEQUENCE ${table}_${column}_seq
+ push(@statements, "ALTER SEQUENCE ${table}_${column}_seq
OWNED BY NONE");
push(@statements, "DROP SEQUENCE ${table}_${column}_seq");
}
diff --git a/Bugzilla/DB/Schema/Sqlite.pm b/Bugzilla/DB/Schema/Sqlite.pm
index 471df340c..6d524db59 100644
--- a/Bugzilla/DB/Schema/Sqlite.pm
+++ b/Bugzilla/DB/Schema/Sqlite.pm
@@ -28,7 +28,7 @@ sub _initialize {
$self->{db_specific} = {
BOOLEAN => 'integer',
- FALSE => '0',
+ FALSE => '0',
TRUE => '1',
INT1 => 'integer',
@@ -79,15 +79,15 @@ sub _sqlite_table_lines {
# This does most of the "heavy lifting" of the schema-altering functions.
sub _sqlite_alter_schema {
my ($self, $table, $create_table, $options) = @_;
-
+
# $create_table is sometimes an array in the form that _sqlite_table_lines
# returns.
if (ref $create_table) {
$create_table = join(',', @$create_table) . "\n)";
}
-
+
my $dbh = Bugzilla->dbh;
-
+
my $random = generate_random_password(5);
my $rename_to = "${table}_$random";
@@ -104,12 +104,12 @@ sub _sqlite_alter_schema {
@insert_cols = map { $_ eq $from ? $to : $_ } @insert_cols;
}
}
-
+
my $insert_str = join(',', @insert_cols);
my $select_str = join(',', @select_cols);
my $copy_sql = "INSERT INTO $table ($insert_str)"
. " SELECT $select_str FROM $rename_to";
-
+
# We have to turn FKs off before doing this. Otherwise, when we rename
# the table, all of the FKs in the other tables will be automatically
# updated to point to the renamed table. Note that PRAGMA foreign_keys
@@ -127,7 +127,7 @@ sub _sqlite_alter_schema {
"DROP TABLE $rename_to",
'COMMIT TRANSACTION',
'PRAGMA foreign_keys = ON',
- );
+ );
}
# For finding a particular column's definition in a CREATE TABLE statement.
@@ -173,7 +173,7 @@ sub _get_create_table_ddl {
sub get_type_ddl {
my $self = shift;
my $def = dclone($_[0]);
-
+
my $ddl = $self->SUPER::get_type_ddl(@_);
if ($def->{PRIMARYKEY} and $def->{TYPE} =~ /SERIAL/i) {
$ddl =~ s/\bSERIAL\b/integer/;
@@ -193,7 +193,7 @@ sub get_alter_column_ddl {
my $self = shift;
my ($table, $column, $new_def, $set_nulls_to) = @_;
my $dbh = Bugzilla->dbh;
-
+
my $table_sql = $self->_sqlite_create_table($table);
my $new_ddl = $self->get_type_ddl($new_def);
# When we do ADD COLUMN, columns can show up all on one line separated
@@ -237,7 +237,7 @@ sub get_add_column_ddl {
return $self->_sqlite_alter_schema($table, $table_sql,
{ pre_sql => \@pre_sql, extra_column => $column });
}
-
+
return $self->SUPER::get_add_column_ddl(@_);
}
@@ -290,12 +290,12 @@ sub get_drop_fk_sql {
my ($self, $table, $column, $references) = @_;
my @clauses = $self->_sqlite_table_lines($table);
my $fk_name = $self->_get_fk_name($table, $column, $references);
-
+
my $line_re = qr/^\s+CONSTRAINT $fk_name /s;
grep { $line_re } @clauses
or die "Can't find $fk_name: " . join(',', @clauses);
@clauses = grep { $_ !~ $line_re } @clauses;
-
+
return $self->_sqlite_alter_schema($table, \@clauses);
}
diff --git a/Bugzilla/DB/Sqlite.pm b/Bugzilla/DB/Sqlite.pm
index 4feb78a74..87f45415b 100644
--- a/Bugzilla/DB/Sqlite.pm
+++ b/Bugzilla/DB/Sqlite.pm
@@ -72,7 +72,7 @@ sub _sqlite_position_ci {
sub new {
my ($class, $params) = @_;
my $db_name = $params->{db_name};
-
+
# Let people specify paths intead of data/ for the DB.
if ($db_name and $db_name !~ m{[\\/]}) {
# When the DB is first created, there's a chance that the
@@ -97,11 +97,11 @@ sub new {
sqlite_unicode => Bugzilla->params->{'utf8'},
};
- my $self = $class->db_new({ dsn => $dsn, user => '',
+ my $self = $class->db_new({ dsn => $dsn, user => '',
pass => '', attrs => $attrs });
# Needed by TheSchwartz
$self->{private_bz_dsn} = $dsn;
-
+
my %pragmas = (
# Make sure that the sqlite file doesn't grow without bound.
auto_vacuum => 1,
@@ -120,11 +120,11 @@ sub new {
# uncomment this line.
#journal_mode => "'WAL'",
);
-
+
while (my ($name, $value) = each %pragmas) {
$self->do("PRAGMA $name = $value");
}
-
+
$self->sqlite_create_collation('bugzilla', \&_sqlite_collate_ci);
$self->sqlite_create_function('position', 2, \&_sqlite_position);
$self->sqlite_create_function('iposition', 2, \&_sqlite_position_ci);