mirror of
https://github.com/miniflux/v2.git
synced 2024-09-28 05:11:51 +02:00
Use prepared statement for intervals
This commit is contained in:
parent
b054506e3a
commit
7660910232
@ -128,9 +128,9 @@ func (s *Storage) CleanOldSessions(days int) int64 {
|
||||
DELETE FROM
|
||||
sessions
|
||||
WHERE
|
||||
created_at < now() - interval '%d days'
|
||||
created_at < now() - $1::interval
|
||||
`
|
||||
result, err := s.db.Exec(fmt.Sprintf(query, days))
|
||||
result, err := s.db.Exec(query, fmt.Sprintf("%d days", days))
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
|
@ -170,9 +170,9 @@ func (s *Storage) CleanOldUserSessions(days int) int64 {
|
||||
DELETE FROM
|
||||
user_sessions
|
||||
WHERE
|
||||
created_at < now() - interval '%d days'
|
||||
created_at < now() - $1::interval
|
||||
`
|
||||
result, err := s.db.Exec(fmt.Sprintf(query, days))
|
||||
result, err := s.db.Exec(query, fmt.Sprintf("%d days", days))
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user