Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 585d5ff

Browse files
committed
Notifications queuing: fix SQL implementation that fails selecting the max value as the column is varchar (use sql CAST expression). Remove unnecessary create.sql scripts.
1 parent 2012b54 commit 585d5ff

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

core/src/plugins/mq.sql/class.AJXP_SqlMessageExchanger.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ public function consumeInstantChannel($channelName, $clientId, $userId, $userGro
217217
public function consumeWorkerChannel($channelName, $filter = null)
218218
{
219219
dibi::connect($this->sqlDriver);
220-
$results = dibi::query("SELECT * FROM [ajxp_simple_store] WHERE [store_id]=%s ORDER BY [object_id] ASC", "queues.$channelName");
220+
$castType = "UNSIGNED";
221+
if($this->sqlDriver["driver"] == "postgre") $castType = "INTEGER";
222+
$results = dibi::query("SELECT * FROM [ajxp_simple_store] WHERE [store_id]=%s ORDER BY CAST([object_id] AS ".$castType.") ASC", "queues.$channelName");
221223
$rows = $results->fetchAll();
222224
$arr = array();
223225
$deleted = array();
@@ -240,7 +242,9 @@ public function consumeWorkerChannel($channelName, $filter = null)
240242
public function publishWorkerMessage($channel, $message)
241243
{
242244
dibi::connect($this->sqlDriver);
243-
$r = dibi::query("SELECT MAX( [object_id] ) FROM [ajxp_simple_store] WHERE [store_id]=%s", "queues.$channel");
245+
$castType = "UNSIGNED";
246+
if($this->sqlDriver["driver"] == "postgre") $castType = "INTEGER";
247+
$r = dibi::query("SELECT MAX( CAST( [object_id] AS ".$castType." ) ) FROM [ajxp_simple_store] WHERE [store_id]=%s", "queues.$channel");
244248
$index = $r->fetchSingle();
245249
if($index == null) $index = 1;
246250
else $index = intval($index)+1;

core/src/plugins/mq.sql/create.mysql

Whitespace-only changes.

core/src/plugins/mq.sql/create.pgsql

Whitespace-only changes.

core/src/plugins/mq.sql/create.sqlite

Whitespace-only changes.

0 commit comments

Comments
 (0)