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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
7cb62ca9
Commit
7cb62ca9
authored
Mar 03, 2005
by
mkanat%kerio.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug: 284244: DATE_SUB and DATE_ADD are not ANSI SQL
Patch By Tomas Kopal <Tomas.Kopal@altap.cz> r=wicked, a=justdave
parent
0e8f16e1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
28 deletions
+27
-28
Search.pm
Bugzilla/Search.pm
+1
-1
Token.pm
Bugzilla/Token.pm
+2
-2
sendunsentbugmail.pl
contrib/sendunsentbugmail.pl
+1
-1
sanitycheck.cgi
sanitycheck.cgi
+4
-4
whine.pl
whine.pl
+19
-20
No files found.
Bugzilla/Search.pm
View file @
7cb62ca9
...
...
@@ -922,7 +922,7 @@ sub init {
}
elsif
(
$unit
eq
'y'
)
{
$unitinterval
=
'YEAR'
;
}
my
$cutoff
=
"
DATE_SUB(NOW(),
"
.
my
$cutoff
=
"
NOW() -
"
.
$dbh
->
sql_interval
(
"$quantity $unitinterval"
);
my
$assigned_fieldid
=
&::
GetFieldID
(
'assigned_to'
);
push
(
@supptables
,
"LEFT JOIN longdescs comment_$table "
.
...
...
Bugzilla/Token.pm
View file @
7cb62ca9
...
...
@@ -119,8 +119,8 @@ sub IssuePasswordToken {
LEFT JOIN tokens
ON tokens.userid = profiles.userid
AND tokens.tokentype = 'password'
AND tokens.issuedate >
DATE_SUB(NOW(),
"
.
$dbh
->
sql_interval
(
'10 MINUTE'
)
.
"
)
AND tokens.issuedate >
NOW() -
"
.
$dbh
->
sql_interval
(
'10 MINUTE'
)
.
"
WHERE login_name = $quotedloginname"
);
my
(
$userid
,
$toosoon
)
=
&::
FetchSQLData
();
...
...
contrib/sendunsentbugmail.pl
View file @
7cb62ca9
...
...
@@ -31,7 +31,7 @@ use Bugzilla::BugMail;
my
$dbh
=
Bugzilla
->
dbh
;
SendSQL
(
"SELECT bug_id FROM bugs WHERE lastdiffed < delta_ts AND
delta_ts <
date_sub(now(),
"
.
$dbh
->
sql_interval
(
'30 minute'
)
.
delta_ts <
NOW() -
"
.
$dbh
->
sql_interval
(
'30 minute'
)
.
" ORDER BY bug_id"
);
my
@list
;
while
(
MoreSQLData
())
{
...
...
sanitycheck.cgi
View file @
7cb62ca9
...
...
@@ -177,8 +177,8 @@ if (defined $cgi->param('rescanallBugMail')) {
Status
(
"OK, now attempting to send unsent mail"
);
SendSQL
(
"SELECT bug_id FROM bugs WHERE lastdiffed < delta_ts AND
delta_ts <
date_sub(now(),
"
.
$dbh
->
sql_interval
(
'30 minute'
)
.
"
)
ORDER BY bug_id"
);
delta_ts <
now() -
"
.
$dbh
->
sql_interval
(
'30 minute'
)
.
" ORDER BY bug_id"
);
my
@list
;
while
(
MoreSQLData
())
{
push
(
@list
,
FetchOneColumn
());
...
...
@@ -736,8 +736,8 @@ Status("Checking for unsent mail");
SendSQL
(
"SELECT bug_id "
.
"FROM bugs WHERE lastdiffed < delta_ts AND "
.
"delta_ts <
date_sub(now(),
"
.
$dbh
->
sql_interval
(
'30 minute'
)
.
"
)
ORDER BY bug_id"
);
"delta_ts <
now() -
"
.
$dbh
->
sql_interval
(
'30 minute'
)
.
" ORDER BY bug_id"
);
while
(
@row
=
FetchSQLData
())
{
my
(
$id
)
=
(
@row
);
...
...
whine.pl
View file @
7cb62ca9
...
...
@@ -172,18 +172,18 @@ while (my ($schedule_id, $day, $time) = $sched_h->fetchrow_array) {
elsif
(
$time
>=
$now_hour
)
{
# set it to today + number of hours
$sth
=
$dbh
->
prepare
(
"UPDATE whine_schedules "
.
"SET run_next
=DATE_ADD(CURRENT_DATE(),
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
") "
.
"
WHERE id=
?"
);
"SET run_next
= CURRENT_DATE() +
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
"
WHERE id =
?"
);
$sth
->
execute
(
$time
,
$schedule_id
);
}
# the target time is less than the current time
else
{
# set it for the next applicable day
my
$nextdate
=
&
get_next_date
(
$day
);
$sth
=
$dbh
->
prepare
(
"UPDATE whine_schedules "
.
"SET run_next
=
"
.
"DATE_ADD(?, "
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
") "
.
"
WHERE id=
?"
);
"SET run_next
= ? +
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
"
WHERE id =
?"
);
$sth
->
execute
(
$nextdate
,
$time
,
$schedule_id
);
}
...
...
@@ -197,9 +197,9 @@ while (my ($schedule_id, $day, $time) = $sched_h->fetchrow_array) {
my
$target_time
=
(
$time
=~
/^\d+$/
)
?
$time
:
0
;
$sth
=
$dbh
->
prepare
(
"UPDATE whine_schedules "
.
"SET run_next
=DATE_ADD(?,
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
") "
.
"
WHERE id=
?"
);
"SET run_next
= ? +
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
"
WHERE id =
?"
);
$sth
->
execute
(
$target_date
,
$target_time
,
$schedule_id
);
}
}
...
...
@@ -596,22 +596,21 @@ sub reset_timer {
my
$nextdate
=
&
get_next_date
(
$run_day
);
$sth
=
$dbh
->
prepare
(
"UPDATE whine_schedules "
.
"SET run_next
=DATE_ADD(?,
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
") "
.
"
WHERE id=
?"
);
"SET run_next
= ? +
"
.
$dbh
->
sql_interval
(
'? HOUR'
)
.
"
WHERE id =
?"
);
$sth
->
execute
(
$nextdate
,
$target_time
,
$schedule_id
);
return
;
}
# Scheduling is done in terms of whole minutes, so we use
DATE_SUB()
to
# Scheduling is done in terms of whole minutes, so we use
subtraction
to
# drop the seconds from the time.
if
(
$minute_offset
>
0
)
{
$sth
=
$dbh
->
prepare
(
"UPDATE whine_schedules "
.
"SET run_next = "
.
"DATE_SUB(DATE_ADD(NOW(), "
.
$dbh
->
sql_interval
(
'? MINUTE'
)
.
"), "
.
$dbh
->
sql_interval
(
'SECOND(NOW()) SECOND'
)
.
") "
.
"WHERE id=?"
);
"SET run_next = NOW() + "
.
$dbh
->
sql_interval
(
'? MINUTE'
)
.
" - "
.
$dbh
->
sql_interval
(
'SECOND(NOW()) SECOND'
)
.
" WHERE id = ?"
);
$sth
->
execute
(
$minute_offset
,
$schedule_id
);
}
else
{
# The minute offset is zero or less, which is not supposed to happen.
...
...
@@ -691,8 +690,8 @@ sub get_next_date {
}
# Get a date in whatever format the database will accept
$sth
=
$dbh
->
prepare
(
"SELECT
DATE_ADD(CURRENT_DATE(),
"
.
$dbh
->
sql_interval
(
'? DAY'
)
.
")"
);
$sth
=
$dbh
->
prepare
(
"SELECT
CURRENT_DATE() +
"
.
$dbh
->
sql_interval
(
'? DAY'
));
$sth
->
execute
(
$add_days
);
return
$sth
->
fetch
->
[
0
];
}
...
...
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