Bugzilla – Attachment 22816 Details for
Bug 7802
A MySQLism is used to get the current date.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7802: Remove CUR_DATE() and CURRENT_DATE() MySQLisms, replace by CAST(now() AS date).
Bug-7802-Remove-CURDATE-and-CURRENTDATE-MySQLisms-.patch (text/plain), 4.30 KB, created by
Kyle M Hall (khall)
on 2013-11-08 13:14:04 UTC
(
hide
)
Description:
Bug 7802: Remove CUR_DATE() and CURRENT_DATE() MySQLisms, replace by CAST(now() AS date).
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-11-08 13:14:04 UTC
Size:
4.30 KB
patch
obsolete
>From 483b090684559c7bf76da8eb9b225077a89ceb13 Mon Sep 17 00:00:00 2001 >From: Marc Balmer <marc@msys.ch> >Date: Mon, 15 Jul 2013 12:28:43 +0200 >Subject: [PATCH] Bug 7802: Remove CUR_DATE() and CURRENT_DATE() MySQLisms, replace by CAST(now() AS date). > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Acquisition.pm | 4 ++-- > C4/NewsChannels.pm | 4 ++-- > C4/Reserves.pm | 4 ++-- > circ/overdue.pl | 2 +- > misc/cronjobs/longoverdue.pl | 6 +++--- > 5 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index aabc0ed..655ee61 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -2382,7 +2382,7 @@ sub GetContracts { > $query = "SELECT * > FROM aqcontract > WHERE booksellerid=? >- AND contractenddate >= CURDATE( )"; >+ AND contractenddate >= CAST(now() AS date)"; > } > my $sth = $dbh->prepare($query); > $sth->execute( $booksellerid ); >@@ -2439,7 +2439,7 @@ sub AddClaim { > my $query = " > UPDATE aqorders SET > claims_count = claims_count + 1, >- claimed_date = CURDATE() >+ claimed_date = CAST(now() AS date) > WHERE ordernumber = ? > "; > my $sth = $dbh->prepare($query); >diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm >index 0201729..7698802 100644 >--- a/C4/NewsChannels.pm >+++ b/C4/NewsChannels.pm >@@ -141,11 +141,11 @@ sub GetNewsToDisplay { > SELECT *,timestamp AS newdate > FROM opac_news > WHERE ( >- expirationdate >= CURRENT_DATE() >+ expirationdate >= CAST(now() AS date) > OR expirationdate IS NULL > OR expirationdate = '00-00-0000' > ) >- AND `timestamp` <= CURRENT_DATE() >+ AND `timestamp` <= CAST(now() AS date) > AND lang = ? > ORDER BY number > "; # expirationdate field is NOT in ISO format? >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index d1bca25..bed6954 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -372,7 +372,7 @@ sub GetReservesFromItemnumber { > WHERE itemnumber=? > "; > unless ( $all_dates ) { >- $query .= " AND reservedate <= CURRENT_DATE()"; >+ $query .= " AND reservedate <= CAST(now() AS date)"; > } > my $sth_res = $dbh->prepare($query); > $sth_res->execute($itemnumber); >@@ -942,7 +942,7 @@ sub CancelExpiredReserves { > # Cancel reserves that have passed their expiration date. > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare( " >- SELECT * FROM reserves WHERE DATE(expirationdate) < DATE( CURDATE() ) >+ SELECT * FROM reserves WHERE DATE(expirationdate) < CAST(now() AS date) > AND expirationdate IS NOT NULL > AND found IS NULL > " ); >diff --git a/circ/overdue.pl b/circ/overdue.pl >index 4343592..d73f7b1 100755 >--- a/circ/overdue.pl >+++ b/circ/overdue.pl >@@ -297,7 +297,7 @@ if ($noreport) { > $strsth .= " AND borrowers.gonenoaddress <> 0"; > } > elsif ( $borflagsfilter eq 'debarred' ) { >- $strsth .= " AND borrowers.debarred >= CURDATE()" ; >+ $strsth .= " AND borrowers.debarred >= CAST(now() AS date)" ; > } > elsif ( $borflagsfilter eq 'lost') { > $strsth .= " AND borrowers.lost <> 0"; >diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl >index 0f64712..4edcda0 100755 >--- a/misc/cronjobs/longoverdue.pl >+++ b/misc/cronjobs/longoverdue.pl >@@ -117,7 +117,7 @@ unless ($confirm) { > } > > # In my opinion, this line is safe SQL to have outside the API. --atz >-our $bounds_sth = C4::Context->dbh->prepare("SELECT DATE_SUB(CURDATE(), INTERVAL ? DAY)"); >+our $bounds_sth = C4::Context->dbh->prepare("SELECT DATE_SUB(CAST(now() AS date), INTERVAL ? DAY)"); > > sub bounds ($) { > $bounds_sth->execute(shift); >@@ -130,8 +130,8 @@ sub longoverdue_sth { > SELECT items.itemnumber, borrowernumber, date_due > FROM issues, items > WHERE items.itemnumber = issues.itemnumber >- AND DATE_SUB(CURDATE(), INTERVAL ? DAY) > date_due >- AND DATE_SUB(CURDATE(), INTERVAL ? DAY) <= date_due >+ AND DATE_SUB(CAST(now() AS date), INTERVAL ? DAY) > date_due >+ AND DATE_SUB(CAST(now() AS date), INTERVAL ? DAY) <= date_due > AND itemlost <> ? > ORDER BY date_due > "; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7802
:
8526
|
8616
|
8901
|
8952
|
8953
|
19643
|
19644
|
20057
|
20058
|
20733
|
22755
|
22756
|
22760
|
22761
|
22816
|
22817