Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
91b55fc9
Commit
91b55fc9
authored
Mar 25, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 419979: Bugzilla::DB::bz_add_field_table directly modifies the FIELD_TABLE_SCHEMA constant
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=mkanat
parent
2429c5da
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
DB.pm
Bugzilla/DB.pm
+13
-8
No files found.
Bugzilla/DB.pm
View file @
91b55fc9
...
...
@@ -660,18 +660,23 @@ sub _bz_add_table_raw {
}
sub
_bz_add_field_table
{
my
(
$self
,
$name
,
$
table_schema
)
=
@_
;
my
(
$self
,
$name
,
$
schema_ref
)
=
@_
;
# We do nothing if the table already exists.
return
if
$self
->
bz_table_info
(
$name
);
my
$indexes
=
$table_schema
->
{
INDEXES
};
# $indexes is an arrayref, not a hash. In order to fix the keys,
# we have to fix every other item.
for
(
my
$i
=
0
;
$i
<
scalar
@$indexes
;
$i
++
)
{
next
if
(
$i
%
2
&&
$i
!=
0
);
# We skip 1, 3, 5, 7, etc.
$indexes
->
[
$i
]
=
$name
.
"_"
.
$indexes
->
[
$i
];
# Copy this so that we're not modifying the passed reference.
# (This avoids modifying a constant in Bugzilla::DB::Schema.)
my
%
table_schema
=
%
$schema_ref
;
my
%
indexes
=
@
{
$table_schema
{
INDEXES
}
};
my
%
fixed_indexes
;
foreach
my
$key
(
keys
%
indexes
)
{
$fixed_indexes
{
$name
.
"_"
.
$key
}
=
$indexes
{
$key
};
}
# INDEXES is supposed to be an arrayref, so we have to convert back.
my
@indexes_array
=
%
fixed_indexes
;
$table_schema
{
INDEXES
}
=
\
@indexes_array
;
# We add this to the abstract schema so that bz_add_table can find it.
$self
->
_bz_schema
->
add_table
(
$name
,
$
table_schema
);
$self
->
_bz_schema
->
add_table
(
$name
,
\%
table_schema
);
$self
->
bz_add_table
(
$name
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment