mirror of
https://github.com/dkmstr/openuds.git
synced 2025-02-27 09:57:46 +03:00
Removed ceil creating function on sqlite
This commit is contained in:
parent
9b4d1139d1
commit
c8982cf677
@ -95,5 +95,4 @@ def extend_sqlite(connection=None, **kwargs):
|
||||
cursor.execute('PRAGMA journal_mode=WAL')
|
||||
connection.connection.create_function("MIN", 2, min)
|
||||
connection.connection.create_function("MAX", 2, max)
|
||||
connection.connection.create_function("CEIL", 1, math.ceil)
|
||||
|
||||
|
@ -36,8 +36,6 @@ import logging
|
||||
|
||||
from django.db import models
|
||||
|
||||
from .util import getSqlFnc
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -117,7 +115,7 @@ class StatsCounters(models.Model):
|
||||
max_intervals = max(min(max_intervals, count), 2)
|
||||
interval = int(to - since) / max_intervals
|
||||
|
||||
floor = getSqlFnc('FLOOR')
|
||||
floor = 'FLOOR'
|
||||
if interval > 0:
|
||||
q = q.extra( # nosec: SQL injection is not possible here
|
||||
select={
|
||||
|
@ -37,7 +37,6 @@ import logging
|
||||
|
||||
from django.db import models
|
||||
|
||||
from .util import getSqlFnc
|
||||
from .stats_counters import StatsCounters
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
|
@ -85,12 +85,3 @@ def getSqlDatetime() -> datetime:
|
||||
def getSqlDatetimeAsUnix() -> int:
|
||||
return int(mktime(getSqlDatetime().timetuple()))
|
||||
|
||||
|
||||
def getSqlFnc(fncName: str) -> str:
|
||||
"""
|
||||
Convert different sql functions for different platforms
|
||||
"""
|
||||
if connection.vendor == 'microsoft':
|
||||
return {'CEIL': 'CEILING'}.get(fncName, fncName)
|
||||
|
||||
return fncName
|
||||
|
Loading…
x
Reference in New Issue
Block a user