Exemplo n.º 1
0
    void LoadOptionChoices(AtavismEditorOption optionData)
    {
        // Read all entries from the table
        string query = "SELECT * FROM " + "editor_option_choice" + " where optionTypeID = " + optionData.id;

        // If there is a row, clear it.
        if (rows != null)
            rows.Clear ();

        // Load data
        rows = DatabasePack.LoadData (DatabasePack.contentDatabasePrefix, query);
        //Debug.Log("#Rows:"+rows.Count);
        // Read all the data
        if ((rows != null) && (rows.Count > 0)) {
            foreach (Dictionary<string,string> data in rows) {
                AtavismEditorOptionChoice entry = new AtavismEditorOptionChoice ();

                entry.id = int.Parse (data ["id"]);
                entry.choice = data ["choice"];
                optionData.optionChoices.Add (entry);
            }
        }
    }
Exemplo n.º 2
0
    void UpdateChoice(AtavismEditorOptionChoice entry)
    {
        string query = "UPDATE editor_option_choice";
        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));
        }

        DatabasePack.Update (DatabasePack.contentDatabasePrefix, query, update);
    }
Exemplo n.º 3
0
    void InsertChoice(AtavismEditorOptionChoice entry)
    {
        string query = "INSERT INTO editor_option_choice";
        query += " (optionTypeID, choice) ";
        query += "VALUES ";
        query += " (" + entry.optionTypeID + ",'" + entry.choice + "') ";

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