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
62eecf24
Commit
62eecf24
authored
Feb 19, 2005
by
mkanat%kerio.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 280494: Replace "SELECT LAST_INSERT_ID()" with Bugzilla::DB function call
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=mkanat, a=justdave
parent
c720bf60
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
21 additions
and
34 deletions
+21
-34
CGI.pm
Bugzilla/Auth/Login/WWW/CGI.pm
+1
-1
Env.pm
Bugzilla/Auth/Login/WWW/Env.pm
+1
-3
attachment.cgi
attachment.cgi
+3
-3
checksetup.pl
checksetup.pl
+5
-12
bug_email.pl
contrib/bug_email.pl
+2
-3
editgroups.cgi
editgroups.cgi
+1
-2
editproducts.cgi
editproducts.cgi
+2
-4
editusers.cgi
editusers.cgi
+1
-2
importxml.pl
importxml.pl
+2
-2
post_bug.cgi
post_bug.cgi
+3
-2
No files found.
Bugzilla/Auth/Login/WWW/CGI.pm
View file @
62eecf24
...
...
@@ -72,7 +72,7 @@ sub login {
VALUES (?, ?, NOW())"
,
undef
,
$userid
,
$ipaddr
);
my
$logincookie
=
$dbh
->
selectrow_array
(
"SELECT LAST_INSERT_ID()"
);
my
$logincookie
=
$dbh
->
bz_last_key
(
'logincookies'
,
'cookie'
);
# Remember cookie only if admin has told so
# or admin didn't forbid it and user told to remember.
...
...
Bugzilla/Auth/Login/WWW/Env.pm
View file @
62eecf24
...
...
@@ -116,9 +116,7 @@ sub login {
"realname, disabledtext "
.
") VALUES ( ?, ?, ?, '' )"
);
$sth
->
execute
(
$env_email
,
'*'
,
$env_realname
);
$sth
=
$dbh
->
prepare
(
"SELECT last_insert_id()"
);
$sth
->
execute
();
$matched_userid
=
$sth
->
fetch
->
[
0
];
$matched_userid
=
$dbh
->
bz_last_key
(
'profiles'
,
'userid'
);
}
}
}
...
...
attachment.cgi
View file @
62eecf24
...
...
@@ -869,7 +869,8 @@ sub insert
my
(
$data
)
=
@_
;
# Insert a new attachment into the database.
my
$dbh
=
Bugzilla
->
dbh
;
# Escape characters in strings that will be used in SQL statements.
$filename
=
SqlQuote
(
$filename
);
my
$description
=
SqlQuote
(
$::FORM
{
'description'
});
...
...
@@ -886,8 +887,7 @@ sub insert
VALUES ($::FORM{'bugid'}, $sql_timestamp, $filename, $description, $contenttype, $::FORM{'ispatch'}, $isprivate, $::userid, $thedata)"
);
# Retrieve the ID of the newly created attachment record.
SendSQL
(
"SELECT LAST_INSERT_ID()"
);
my
$attachid
=
FetchOneColumn
();
my
$attachid
=
$dbh
->
bz_last_key
(
'attachments'
,
'attach_id'
);
# Insert a comment about the new attachment into the database.
my
$comment
=
"Created an attachment (id=$attachid)\n$::FORM{'description'}\n"
;
...
...
checksetup.pl
View file @
62eecf24
...
...
@@ -2232,9 +2232,7 @@ sub AddGroup {
VALUES (?, ?, ?, ?)'
);
$sth
->
execute
(
$name
,
$desc
,
$userregexp
,
0
);
$sth
=
$dbh
->
prepare
(
"select last_insert_id()"
);
$sth
->
execute
();
my
(
$last
)
=
$sth
->
fetchrow_array
();
my
$last
=
$dbh
->
bz_last_key
(
'groups'
,
'id'
);
return
$last
;
}
...
...
@@ -2459,9 +2457,8 @@ unless ($sth->rows) {
'bugzilla.", "", 0, 0, 0)'
);
# We could probably just assume that this is "1", but better
# safe than sorry...
$sth
=
$dbh
->
prepare
(
"SELECT LAST_INSERT_ID()"
);
$sth
->
execute
;
my
(
$product_id
)
=
$sth
->
fetchrow_array
;
my
$product_id
=
$dbh
->
bz_last_key
(
'products'
,
'id'
);
$dbh
->
do
(
qq{INSERT INTO versions (value, product_id) VALUES ("other", $product_id)}
);
# note: since admin user is not yet known, components gets a 0 for
# initialowner and this is fixed during final checks.
...
...
@@ -2801,9 +2798,7 @@ if (GetFieldDef('bugs', 'long_desc')) {
$dbh
->
quote
(
$name
)
.
", "
.
$dbh
->
quote
(
bz_crypt
(
'okthen'
))
.
", "
.
"'Account created only to maintain database integrity')"
);
$s2
=
$dbh
->
prepare
(
"SELECT LAST_INSERT_ID()"
);
$s2
->
execute
();
(
$who
)
=
(
$s2
->
fetchrow_array
());
$who
=
$dbh
->
bz_last_key
(
'profiles'
,
'userid'
);
}
next
;
}
else
{
...
...
@@ -2850,9 +2845,7 @@ if (GetFieldDef('bugs_activity', 'field')) {
if
(
!
$id
)
{
$dbh
->
do
(
"INSERT INTO fielddefs (name, description) VALUES "
.
"($q, $q)"
);
$s2
=
$dbh
->
prepare
(
"SELECT LAST_INSERT_ID()"
);
$s2
->
execute
();
(
$id
)
=
(
$s2
->
fetchrow_array
());
$id
=
$dbh
->
bz_last_key
(
'fielddefs'
,
'fieldid'
);
}
$dbh
->
do
(
"UPDATE bugs_activity SET fieldid = $id WHERE field = $q"
);
}
...
...
contrib/bug_email.pl
View file @
62eecf24
...
...
@@ -38,7 +38,7 @@
#
# You need to work with bug_email.pl the MIME::Parser installed.
#
# $Id: bug_email.pl,v 1.2
3 2005/02/08 16:51:03 travis%sedsystems.ca
Exp $
# $Id: bug_email.pl,v 1.2
4 2005/02/18 16:01:48 mkanat%kerio.com
Exp $
###############################################################
# 02/12/2000 (SML)
...
...
@@ -1151,8 +1151,7 @@ END
if
(
!
$test
)
{
SendSQL
(
$query
);
SendSQL
(
"select LAST_INSERT_ID()"
);
$id
=
FetchOneColumn
();
$id
=
Bugzilla
->
dbh
->
bz_last_key
(
'bugs'
,
'bug_id'
);
my
$long_desc_query
=
"INSERT INTO longdescs SET bug_id=$id, who=$userid, bug_when=\'$bug_when\', thetext="
.
SqlQuote
(
$comment
);
SendSQL
(
$long_desc_query
);
...
...
editgroups.cgi
View file @
62eecf24
...
...
@@ -274,8 +274,7 @@ if ($action eq 'new') {
"1,"
.
SqlQuote
(
$regexp
)
.
", "
.
$isactive
.
", NOW())"
);
SendSQL
(
"SELECT last_insert_id()"
);
my
$gid
=
FetchOneColumn
();
my
$gid
=
$dbh
->
bz_last_key
(
'groups'
,
'id'
);
my
$admin
=
GroupNameToId
(
'admin'
);
# Since we created a new group, give the "admin" group all privileges
# initially.
...
...
editproducts.cgi
View file @
62eecf24
...
...
@@ -506,8 +506,7 @@ if ($action eq 'new') {
SqlQuote
(
$votestoconfirm
)
.
","
.
SqlQuote
(
$defaultmilestone
)
.
","
.
SqlQuote
(
$classification_id
)
.
")"
);
SendSQL
(
"SELECT LAST_INSERT_ID()"
);
my
$product_id
=
FetchOneColumn
();
my
$product_id
=
$dbh
->
bz_last_key
(
'products'
,
'id'
);
SendSQL
(
"INSERT INTO versions ( "
.
"value, product_id"
.
...
...
@@ -531,8 +530,7 @@ if ($action eq 'new') {
"VALUES ("
.
SqlQuote
(
$productgroup
)
.
", "
.
SqlQuote
(
"Access to bugs in the $product product"
)
.
", 1, NOW())"
);
SendSQL
(
"SELECT last_insert_id()"
);
my
$gid
=
FetchOneColumn
();
my
$gid
=
$dbh
->
bz_last_key
(
'groups'
,
'id'
);
my
$admin
=
GroupNameToId
(
'admin'
);
# If we created a new group, give the "admin" group priviledges
# initially.
...
...
editusers.cgi
View file @
62eecf24
...
...
@@ -461,8 +461,7 @@ if ($action eq 'new') {
#+++ send e-mail away
print
"OK, done.<br>\n"
;
SendSQL
(
"SELECT last_insert_id()"
);
my
(
$newuserid
)
=
FetchSQLData
();
my
$newuserid
=
$dbh
->
bz_last_key
(
'profiles'
,
'userid'
);
my
$changeduser
=
new
Bugzilla::
User
(
$newuserid
);
$changeduser
->
derive_groups
();
...
...
importxml.pl
View file @
62eecf24
...
...
@@ -162,6 +162,7 @@ $xml =~ s/^.+(<\?xml version.+)$/$1/s;
my
$parser
=
new
XML::
Parser
(
Style
=>
'Tree'
);
my
$tree
=
$parser
->
parse
(
$xml
);
my
$dbh
=
Bugzilla
->
dbh
;
my
$maintainer
;
if
(
defined
$tree
->
[
1
][
0
]
->
{
'maintainer'
})
{
...
...
@@ -609,8 +610,7 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
.
join
(
",\n"
,
@values
)
.
"\n)\n"
;
SendSQL
(
$query
);
SendSQL
(
"select LAST_INSERT_ID()"
);
my
$id
=
FetchOneColumn
();
my
$id
=
$dbh
->
bz_last_key
(
'bugs'
,
'bug_id'
);
if
(
defined
$bug_fields
{
'cc'
})
{
foreach
my
$person
(
split
(
/[ ,]/
,
$bug_fields
{
'cc'
}))
{
...
...
post_bug.cgi
View file @
62eecf24
...
...
@@ -56,6 +56,8 @@ my $user = Bugzilla->login(LOGIN_REQUIRED);
my
$cgi
=
Bugzilla
->
cgi
;
my
$dbh
=
Bugzilla
->
dbh
;
# do a match on the fields if applicable
&
Bugzilla::User::
match_field
({
...
...
@@ -420,8 +422,7 @@ while (MoreSQLData()) {
SendSQL
(
$sql
);
# Get the bug ID back.
SendSQL
(
"select LAST_INSERT_ID()"
);
my
$id
=
FetchOneColumn
();
my
$id
=
$dbh
->
bz_last_key
(
'bugs'
,
'bug_id'
);
# Add the group restrictions
foreach
my
$grouptoadd
(
@groupstoadd
)
{
...
...
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