Пример #1
0
    // Update existing entries in the table based on the iddemo_table
    void UpdateItem(CharItemsData entry)
    {
        // Setup the update query
        string query = "UPDATE character_create_items";
        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 InsertItem(CharItemsData entry)
    {
        string query = "INSERT INTO character_create_items";
        query += " (character_create_id, item_id, count, equipped) ";
        query += "VALUES ";
        query += " (" + entry.charId + "," + entry.itemId + "," + entry.count + "," + entry.equipped + ") ";

        // 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;
    }