From 86eb8992cd8c84a6d334a4dbb50ebae6c8578ff3 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Wed, 2 Oct 2019 22:15:11 -0500 Subject: [PATCH] Fix concatenation for MySQL Signed-off-by: Etzelia --- gui.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gui.py b/gui.py index c17178e..1ed19d6 100644 --- a/gui.py +++ b/gui.py @@ -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: