Fix concatenation for MySQL

Signed-off-by: Etzelia <etzelia@hotmail.com>
concat
Etzelia 2019-10-02 22:15:11 -05:00
parent 10dff6e266
commit 86eb8992cd
No known key found for this signature in database
GPG Key ID: 708511AE7ABC5314
1 changed files with 6 additions and 2 deletions

8
gui.py
View File

@ -1,6 +1,7 @@
from django_coreprotect.models import CoWorld, GUIResult
from django_coreprotect.utils import safe_int, checkbox
from datetime import datetime
from django.db import connection
class GUIForm:
@ -173,8 +174,11 @@ def gui_results(form):
# Chest Use
if form.chest_use:
concat = 'CONCAT(cc.amount, " ", cmm.material)'
if connection.vendor == "sqlite":
concat = 'cc.amount || " " || cmm.material'
queries.append('''SELECT
0 AS id, "container" AS type, cc.time AS unix, cu.user AS player, cc.action, cc.amount || " " || cmm.material AS data, cc.x, cc.y, cc.z, cw.world
0 AS id, "container" AS type, cc.time AS unix, cu.user AS player, cc.action, {concat} AS data, cc.x, cc.y, cc.z, cw.world
FROM co_container cc
JOIN co_user cu ON cc.user = cu.rowid
JOIN co_material_map cmm ON cc.type = cmm.rowid
@ -185,7 +189,7 @@ def gui_results(form):
{coords}
{blocks}
{time}
'''.format(worlds=worlds_clause, players=players_clause, coords=coords_clause, blocks=blocks_clause, time=time_clause))
'''.format(concat=concat, worlds=worlds_clause, players=players_clause, coords=coords_clause, blocks=blocks_clause, time=time_clause))
# Commands
if form.command: