예제 #1
0
    // Update existing entries in the table based on the iddemo_table
    void UpdateStat(CharStatsData entry)
    {
        // Setup the update query
        string query = "UPDATE character_create_stats";
        query += " SET ";
        query += entry.UpdateList ();
        query += " WHERE id=?id";

        // Setup the register data
        List<Register> update = new List<Register> ();
        foreach (string field in entry.fields.Keys) {
            update.Add (entry.fieldToRegister (field));
        }
        update.Add (new Register ("id", "?id", MySqlDbType.Int32, entry.id.ToString (), Register.TypesOfField.Int));

        // Update the database
        DatabasePack.Update (DatabasePack.contentDatabasePrefix, query, update);
    }
예제 #2
0
    void InsertStat(CharStatsData entry)
    {
        string query = "INSERT INTO character_create_stats";
        query += " (character_create_id, stat, value, levelIncrease, levelPercentIncrease) ";
        query += "VALUES ";
        query += " (" + entry.charId + ",'" + entry.stat + "'," + entry.statValue + "," + entry.levelIncrease + "," + entry.levelPercentIncrease + ") ";

        // Setup the register data
        List<Register> update = new List<Register> ();
        foreach (string field in entry.fields.Keys) {
            update.Add (entry.fieldToRegister (field));
        }

        int itemID = -1;
        itemID = DatabasePack.Insert (DatabasePack.contentDatabasePrefix, query, update);
        entry.id = itemID;
    }