User:Taylan/CargoBugTest: Difference between revisions

From Baldur's Gate 3 Wiki
Jump to navigation Jump to search
(Created page with "{{#cargo_query: tables = item_icon |fields=TRIM(icon),CONCAT('', '40'),LOWER(rarity),CONCAT('', '{{{show_rarity|}}}'),CONCAT('', "{{{name|Confessions, Vol. 1, Father Lorgan}}}") |where={{#if:{{{uid|}}}|item_icon.uid = "{{{uid}}}"|item_icon._pageName="{{{name|Confessions, Vol. 1, Father Lorgan}}}"}} |limit=1 |order by=item_icon._pageName |default={{ItemIcon Internal|{{{name|Confessions, Vol. 1, Father Lorgan}}} Unfaded Icon.png|40|common| true|{{{name|Confessions, Vol. 1,...")
 
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#cargo_query: tables = item_icon
This page showcases a bug in the Cargo extension. Auto-generated column names break upon the presence of a period.
|fields=TRIM(icon),CONCAT('', '40'),LOWER(rarity),CONCAT('', '{{{show_rarity|}}}'),CONCAT('', "{{{name|Confessions, Vol. 1, Father Lorgan}}}")
 
|where={{#if:{{{uid|}}}|item_icon.uid = "{{{uid}}}"|item_icon._pageName="{{{name|Confessions, Vol. 1, Father Lorgan}}}"}}
=== Example 1 ===
|limit=1
 
|order by=item_icon._pageName
<pre>
|default={{ItemIcon Internal|{{{name|Confessions, Vol. 1, Father Lorgan}}} Unfaded Icon.png|40|common| true|{{{name|Confessions, Vol. 1, Father Lorgan}}}|missing=true}}
{{#cargo_query: tables = weapons
|more results text=
| fields = name, CONCAT("Test1.Test2.Test3.")
|format=template
| where = name = "Adamantine Longsword"
|template=ItemIcon Internal
}}
</pre>
 
{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1.Test2.Test3.")
| where = name = "Adamantine Longsword"
}}
 
=== Example 2 ===
 
The behavior changes depending on whether there's a space after the period.
 
This one causes an error to be logged by PHP, saying the column <code>" Test2. Test3."</code> couldn't be found, and the data isn't shown.
 
<pre>
{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1. Test2. Test3.")
| where = name = "Adamantine Longsword"
}}
</pre>
 
{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1. Test2. Test3.")
| where = name = "Adamantine Longsword"
}}
 
=== Example 3 ===
 
To work around the bug, make sure to give the column a proper name:
 
<pre>
{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1.Test2.Test3.") = test
| where = name = "Adamantine Longsword"
}}
</pre>
 
{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1.Test2.Test3.") = test
| where = name = "Adamantine Longsword"
}}
}}


---
=== Example 4 ===
 
The space after the period also doesn't matter anymore if you use that work-around:
 
<pre>
{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1. Test2. Test3.") = test
| where = name = "Adamantine Longsword"
}}
</pre>


{{#cargo_query: tables = item_icon
{{#cargo_query: tables = weapons
|fields=TRIM(icon),CONCAT('', '40'),LOWER(rarity),CONCAT('', '{{{show_rarity|}}}'),CONCAT('', "Confessions, Vol. 1, Father Lorgan")
| fields = name, CONCAT("Test1. Test2. Test3.") = test
|where={{#if:{{{uid|}}}|item_icon.uid = "{{{uid}}}"|item_icon._pageName="Confessions, Vol. 1, Father Lorgan"}}
| where = name = "Adamantine Longsword"
|limit=1
|order by=item_icon._pageName
|default={{ItemIcon Internal|Confessions, Vol. 1, Father Lorgan Unfaded Icon.png|40|common| true|Confessions, Vol. 1, Father Lorgan|missing=true}}
|more results text=
|format=template
|template=ItemIcon Internal
}}
}}

Latest revision as of 02:19, 6 June 2024

This page showcases a bug in the Cargo extension. Auto-generated column names break upon the presence of a period.

Example 1[edit | edit source]

{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1.Test2.Test3.")
| where = name = "Adamantine Longsword"
}}
name Test2.Test3.")
Adamantine Longsword Test1.Test2.Test3.

Example 2[edit | edit source]

The behavior changes depending on whether there's a space after the period.

This one causes an error to be logged by PHP, saying the column " Test2. Test3." couldn't be found, and the data isn't shown.

{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1. Test2. Test3.")
| where = name = "Adamantine Longsword"
}}
name Test2. Test3.")
Adamantine Longsword

Example 3[edit | edit source]

To work around the bug, make sure to give the column a proper name:

{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1.Test2.Test3.") = test
| where = name = "Adamantine Longsword"
}}
name test
Adamantine Longsword Test1.Test2.Test3.

Example 4[edit | edit source]

The space after the period also doesn't matter anymore if you use that work-around:

{{#cargo_query: tables = weapons
| fields = name, CONCAT("Test1. Test2. Test3.") = test
| where = name = "Adamantine Longsword"
}}
name test
Adamantine Longsword Test1. Test2. Test3.