Chrisy15
Flower, Beautiful
- Joined
- Jul 9, 2015
- Messages
- 2,134
Idk what I'm expecting to come of this but the terms are too ambiguous for the search bar to be useful so I might as well ask anyway.
I was trying to populate a table with binary numbers using SQL's recursion because I'm a showoff who wants to use this basic understanding of the mechanic at whatever opportunity.
This should create a temporary table containing the 8-bit values that can then be used for concatenated dummy buildings later on. However, when the game tries to execute the code it throws an error:
The error looks simple enough, but what doesn't make sense is that when the code (and the entire file's code at that) is run through SQLSpy it works perfectly fine.
The same issue happens with much simpler WITH statements too, like
They run perfectly fine in SQLSpy, but when executed through the game it doesn't recognise the WITH as valid.
A final odd twist to this issue is that the WITH clause works perfectly fine in VI. I wrote this simple enough piece for Pok the other day
and it worked perfectly fine for him, while I got this upgrade-tree-navigating query working at some point even if I don't have the finalised version on this laptop
Is it a known issue that V can't use the WITH clause? Is there a reason why this could be the case? Has anyone else ever actually tried to use this before or is it just me?
I was trying to populate a table with binary numbers using SQL's recursion because I'm a showoff who wants to use this basic understanding of the mechanic at whatever opportunity.
Code:
CREATE TABLE IF NOT EXISTS DMS_BitsTable(num INTEGER UNIQUE DEFAULT 0);
WITH RECURSIVE C15_BinaryView(val) AS (SELECT 1 UNION ALL SELECT val + val FROM C15_BinaryView LIMIT 8)
INSERT OR REPLACE INTO DMS_BitsTable
(num)
SELECT val
FROM C15_BinaryView ORDER BY val;
This should create a temporary table containing the 8-bit values that can then be used for concatenated dummy buildings later on. However, when the game tries to execute the code it throws an error:
Code:
[433286.062] near "WITH": syntax error
The error looks simple enough, but what doesn't make sense is that when the code (and the entire file's code at that) is run through SQLSpy it works perfectly fine.
Spoiler :

The same issue happens with much simpler WITH statements too, like
Code:
WITH tTest(col) AS (SELECT 1) INSERT INTO Buildings (Type) SELECT col FROM tTest;
They run perfectly fine in SQLSpy, but when executed through the game it doesn't recognise the WITH as valid.
A final odd twist to this issue is that the WITH clause works perfectly fine in VI. I wrote this simple enough piece for Pok the other day
Code:
CREATE TABLE IF NOT EXISTS PopulationReference ( Size INT ); WITH RECURSIVE t(val) AS (SELECT 1 UNION ALL SELECT val + 1 FROM t LIMIT 30) INSERT INTO PopulationReference (Size) SELECT val FROM t;
Code:
WITH RECURSIVE GetSamuraiUpgradePath(UnitType) AS (VALUES('UNIT_JAPANESE_SAMURAI') UNION ALL SELECT a.UpgradeUnit FROM UnitUpgrades a, GetSamuraiUpgradePath b WHERE a.Unit = b.UnitType) SELECT * FROM GetSamuraiUpgradePath;
Is it a known issue that V can't use the WITH clause? Is there a reason why this could be the case? Has anyone else ever actually tried to use this before or is it just me?