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
9e865838
Commit
9e865838
authored
Feb 02, 2005
by
travis%sedsystems.ca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 279748 : Move GetFieldDefs out of globals.pl (to Bugzilla::DB)
Patch by Max Kanat-Alexander <mkanat@kerio.com> r=vladd a=justdave
parent
b21f214c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
22 deletions
+43
-22
DB.pm
Bugzilla/DB.pm
+40
-0
config.cgi
config.cgi
+2
-1
globals.pl
globals.pl
+0
-20
query.cgi
query.cgi
+1
-1
No files found.
Bugzilla/DB.pm
View file @
9e865838
...
@@ -183,6 +183,26 @@ sub server_version {
...
@@ -183,6 +183,26 @@ sub server_version {
return
$cached_server_version
;
return
$cached_server_version
;
}
}
sub
GetFieldDefs
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$extra
=
""
;
if
(
!&::
UserInGroup
(
Param
(
'timetrackinggroup'
)))
{
$extra
=
"WHERE name NOT IN ('estimated time', 'remaining_time', "
.
"'work_time', 'percentage_complete', 'deadline')"
;
}
my
@fields
;
my
$sth
=
$dbh
->
prepare
(
"SELECT name, description
FROM fielddefs $extra
ORDER BY sortkey"
);
$sth
->
execute
();
while
(
my
$field_ref
=
$sth
->
fetchrow_hashref
())
{
push
(
@fields
,
$field_ref
);
}
return
(
@fields
);
}
1
;
1
;
__END__
__END__
...
@@ -193,9 +213,14 @@ Bugzilla::DB - Database access routines, using L<DBI>
...
@@ -193,9 +213,14 @@ Bugzilla::DB - Database access routines, using L<DBI>
=head1 SYNOPSIS
=head1 SYNOPSIS
# Connection
my $dbh = Bugzilla::DB->connect_main;
my $dbh = Bugzilla::DB->connect_main;
my $shadow = Bugzilla::DB->connect_shadow;
my $shadow = Bugzilla::DB->connect_shadow;
# Schema Information
my @fields = GetFieldDefs();
# Deprecated
SendSQL("SELECT COUNT(*) FROM bugs");
SendSQL("SELECT COUNT(*) FROM bugs");
my $cnt = FetchOneColumn();
my $cnt = FetchOneColumn();
...
@@ -209,6 +234,9 @@ Access to the old SendSQL-based database routines are also provided by
...
@@ -209,6 +234,9 @@ Access to the old SendSQL-based database routines are also provided by
importing the C<:deprecated> tag. These routines should not be used in new
importing the C<:deprecated> tag. These routines should not be used in new
code.
code.
The only functions that should be used by modern, regular Bugzilla code
are the "Schema Information" functions.
=head1 CONNECTION
=head1 CONNECTION
A new database handle to the required database can be created using this
A new database handle to the required database can be created using this
...
@@ -228,6 +256,18 @@ no shadow database is configured.
...
@@ -228,6 +256,18 @@ no shadow database is configured.
=back
=back
=head1 SCHEMA INFORMATION
Bugzilla::DB also contains routines to get schema information about the
database.
=over 4
=item C<GetFieldDefs>
Returns a list of all the "bug" fields in Bugzilla. The list contains
hashes, with a 'name' key and a 'description' key.
=head1 DEPRECATED ROUTINES
=head1 DEPRECATED ROUTINES
Several database routines are deprecated. They should not be used in new code,
Several database routines are deprecated. They should not be used in new code,
...
...
config.cgi
View file @
9e865838
...
@@ -32,6 +32,7 @@ use strict;
...
@@ -32,6 +32,7 @@ use strict;
# Include the Bugzilla CGI and general utility library.
# Include the Bugzilla CGI and general utility library.
use
lib
qw(.)
;
use
lib
qw(.)
;
require
"CGI.pl"
;
require
"CGI.pl"
;
use
Bugzilla::
DB
;
# Retrieve this installation's configuration.
# Retrieve this installation's configuration.
GetVersionTable
();
GetVersionTable
();
...
@@ -82,7 +83,7 @@ $vars->{'open_status'} = \@open_status;
...
@@ -82,7 +83,7 @@ $vars->{'open_status'} = \@open_status;
$vars
->
{
'closed_status'
}
=
\
@closed_status
;
$vars
->
{
'closed_status'
}
=
\
@closed_status
;
# Generate a list of fields that can be queried.
# Generate a list of fields that can be queried.
$vars
->
{
'field'
}
=
[
GetFieldDefs
()];
$vars
->
{
'field'
}
=
[
Bugzilla::DB::
GetFieldDefs
()];
# Determine how the user would like to receive the output;
# Determine how the user would like to receive the output;
# default is JavaScript.
# default is JavaScript.
...
...
globals.pl
View file @
9e865838
...
@@ -636,26 +636,6 @@ sub GetSelectableClassifications {
...
@@ -636,26 +636,6 @@ sub GetSelectableClassifications {
return
(
@selectable_classes
);
return
(
@selectable_classes
);
}
}
sub
GetFieldDefs
{
my
$extra
=
""
;
if
(
!
UserInGroup
(
Param
(
'timetrackinggroup'
)))
{
$extra
=
"WHERE name NOT IN ('estimated time', 'remaining_time', "
.
"'work_time', 'percentage_complete', 'deadline')"
;
}
my
@fields
;
PushGlobalSQLState
();
SendSQL
(
"SELECT name, description FROM fielddefs $extra ORDER BY sortkey"
);
while
(
MoreSQLData
())
{
my
(
$name
,
$description
)
=
FetchSQLData
();
push
(
@fields
,
{
name
=>
$name
,
description
=>
$description
});
}
PopGlobalSQLState
();
return
(
@fields
);
}
sub
ValidatePassword
{
sub
ValidatePassword
{
# Determines whether or not a password is valid (i.e. meets Bugzilla's
# Determines whether or not a password is valid (i.e. meets Bugzilla's
...
...
query.cgi
View file @
9e865838
...
@@ -351,7 +351,7 @@ $vars->{'bug_severity'} = \@::legal_severity;
...
@@ -351,7 +351,7 @@ $vars->{'bug_severity'} = \@::legal_severity;
# Boolean charts
# Boolean charts
my
@fields
;
my
@fields
;
push
(
@fields
,
{
name
=>
"noop"
,
description
=>
"---"
});
push
(
@fields
,
{
name
=>
"noop"
,
description
=>
"---"
});
push
(
@fields
,
GetFieldDefs
());
push
(
@fields
,
Bugzilla::DB::
GetFieldDefs
());
$vars
->
{
'fields'
}
=
\
@fields
;
$vars
->
{
'fields'
}
=
\
@fields
;
# Creating new charts - if the cmd-add value is there, we define the field
# Creating new charts - if the cmd-add value is there, we define the field
...
...
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