[Asterisk-code-review] res_musiconhold: Load all realtime entries, not just the first (asterisk[16])

Sean Bright asteriskteam at digium.com
Mon Sep 28 09:38:49 CDT 2020


Sean Bright has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/14940 )

Change subject: res_musiconhold: Load all realtime entries, not just the first
......................................................................


Patch Set 2: Code-Review-1

(1 comment)

Looks good other than the issue I mention below. Not sure how this got missed in the original implementation.

https://gerrit.asterisk.org/c/asterisk/+/14940/2/res/res_musiconhold.c 
File res/res_musiconhold.c:

https://gerrit.asterisk.org/c/asterisk/+/14940/2/res/res_musiconhold.c@1612 
PS2, Line 1612: 			struct ast_config *entries = ast_load_realtime_multientry("musiconhold_entry", "name", name, SENTINEL);
So the 'position' column is part of the musiconhold_entry table's PK so I assume most databases will do the right thing, but to be sure you can change this to:

 struct ast_config *entries = ast_load_realtime_multientry(
    "musiconhold_entry",
    "position >=", "0",
    "name", name,
    SENTINEL);

This will result in the following query (note the 'ORDER BY'):

 SELECT * FROM musiconhold_entry WHERE position >= ? AND name = ? ORDER BY position



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14940
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I45636679c0fb5a5f59114c8741626631a604e8a6
Gerrit-Change-Number: 14940
Gerrit-PatchSet: 2
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-CC: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Mon, 28 Sep 2020 14:38:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200928/6dd26939/attachment.html>


More information about the asterisk-code-review mailing list