[XML] Error Help

stapano00

Chieftain
Joined
Jul 11, 2014
Messages
97
Location
NY - America
I made my own Beliefs and It makes error ;;;;


I deleted the tables by SQL

Spoiler :
DELETE FROM Beliefs;
DELETE FROM Belief_Buildings;
DELETE FROM Belief_BuildingClassHappiness;
DELETE FROM Belief_BuildingClassTourism;
DELETE FROM Belief_BuildingClassFaithPurchase;

DELETE FROM Belief_CityYieldChanges;
DELETE FROM Belief_HolyCityYieldChanges;
DELETE FROM Belief_EraFaithUnitPurchase;
DELETE FROM Belief_FeatureYieldChanges;
DELETE FROM Belief_ImprovementYieldChanges;

DELETE FROM Belief_MaxYieldModifierPerFollwer;
DELETE FROM Belief_ResourceQuantityModifiers;

DELETE FROM Belief_ResourceHappiness;
DELETE FROM Belief_ResourceYieldChanges;
DELETE FROM Belief_TerrainYieldChanges;
DELETE FROM Belief_YieldChangeAnySpecialist;
DELETE FROM Belief_YieldChangePerForeignCity;
DELETE FROM Belief_YieldChangePerXForeignFollowers;
DELETE FROM Belief_YieldChangeTradeRoute;
DELETE FROM Belief_YieldChangeNaturalWonder;
DELETE FROM Belief_YieldChangeWorldWonder;
DELETE FROM Belief_YieldModifierNaturalWonder;
DELETE FROM Religion_FreeBuildingClass;


and my Beliefs.xml which is attached file

and I reIDmapped with SQL


Spoiler :
CREATE TABLE IDRemapper ( id INTEGER PRIMARY KEY AUTOINCREMENT, Type TEXT );
INSERT INTO IDRemapper (Type) SELECT Type FROM Beliefs ORDER BY ID;
UPDATE Beliefs SET ID = ( SELECT IDRemapper.id-1 FROM IDRemapper WHERE Beliefs.Type = IDRemapper.Type);
DROP TABLE IDRemapper; -- Insert SQL Rules Here




What is wrong with mine?
 

Attachments

  • CIV5Beliefs.zip
    13.3 KB · Views: 399
Shouldn't there be a VALUES keyword in the insert statement?
Also shouldn't you delete from tables which reference and then the table which is referenced?
And why are you subtracting 1 from the old ID to get the new ID

And I think your update statement isn't well-formed. Rethink your logic on it. I think you may need to create a join in the select you are pulling the data from.
 
from Pazyrk's Tables SQL for total conversion modders
Code:
--fixinator
CREATE TABLE IDRemapper (id INTEGER PRIMARY KEY AUTOINCREMENT, Type TEXT);
INSERT INTO IDRemapper (Type) SELECT Type FROM Buildings ORDER BY ID;
UPDATE Buildings SET ID = (SELECT IDRemapper.id-1 FROM IDRemapper WHERE Buildings.Type = IDRemapper.Type);
DROP TABLE IDRemapper;
I can't see where you are doing anything wromg with that bit of SQL code. But without the actual mod to look at I cannot tell if you are making some other basic mistake, such as running the XML / SQL files in the wrong order. I am not sure when using the IDRemapper whether or not you are supposed to include a <ID>0</ID> column in the 1st <Row> of the table you are remapping. I suspect not since Pazyrk did not do so in the SQL example where the "fixinator" code is shown.
 
Top Bottom