Another sql newbie question

Slowpoke

The Mad Modder
Joined
Sep 30, 2010
Messages
1,321
Is it possible to use sql to create objects like in xml? E.g. How would the following (giving napoleon india's trait as well as his own) be translated to sql?

<GameData>
<Leader_Traits>
<Row>
<LeaderType>LEADER_NAPOLEON</LeaderType>
<TraitType>TRAIT_POPULATION_GROWTH</TraitType>
</Row>
</Leader_Traits>
</GameData>
 
either one of these

update Leader_Traits set TraitType="TRAIT_POPULATION_GROWTH" where LeaderType="LEADER_NAPOLEON";
insert into Leader_Traits (LeaderType, Traitype) VALUES ("LEADER_NAPOLEON", "TRAIT_POPULATION_GROWTH");

first one changes his trait, second one adds a row, not sure which you want
 
For reference.

Adding in XML:
Code:
<GameData>
    <NameOfTable>
        <Row> 
               <ValueToSet>1</ValueToSet>
               <ValueToSet2>true</ValueToSet>
        </Row>        
    </NameOfTable>
</GameData>
Adding in SQL:
Code:
INSERT INTO NameOfTable (ValueToSet, ValueToSet2) VALUES ("1", "true");
Updating in XML:
Code:
<GameData>
    <NameOfTable>
        <Update>
              <Set ValueToUpdate="1"/>
              <Where KeyToSearchFor="ValueOfKey"/>
         </Update>       
    </NameOfTable>
</GameData>
Updating in SQL:
Code:
UPDATE NameOfTable SET ValueToUpdate="1" WHERE KeyToSearchFor = "ValueOfKey";
 
Ah, thanks a bunch :)
 
Back
Top Bottom