public static TableActions GetFromDatabaseActions(Data.actions id)
    {
        IDbConnection databaseConnection;

        databaseConnection = new SqliteConnection("URI=file:" + Application.dataPath + "/Database/Actions.db");
        databaseConnection.Open();

        IDbCommand databaseCommand = databaseConnection.CreateCommand();

        databaseCommand.CommandText = "SELECT intro, positive, neutral, negative FROM " + "tableId_" + ((int)id).ToString() + " ORDER BY id ASC";
        IDataReader databaseResults = databaseCommand.ExecuteReader();

        List <RowActions> rowList = new List <RowActions> ();

        while (databaseResults.Read())
        {
            string[] textArray0 = databaseResults.GetString(0).Split(splitCharacters, 999);
            string[] textArray1 = databaseResults.GetString(1).Split(splitCharacters, 999);
            string[] textArray2 = databaseResults.GetString(2).Split(splitCharacters, 999);
            string[] textArray3 = databaseResults.GetString(3).Split(splitCharacters, 999);
            rowList.Add(new RowActions(textArray0, textArray1, textArray2, textArray3));
        }
        RowActions[] rowArray = new RowActions[rowList.Count];
        for (int i = 0; i < rowArray.Length; i++)
        {
            rowArray [i] = rowList [i];
        }

        databaseResults.Close();
        databaseResults = null;
        databaseCommand.Dispose();
        databaseCommand = null;
        databaseConnection.Close();
        databaseConnection = null;

        return(new TableActions(rowArray));
    }
Example #2
0
 public ModelBase(string tableName)
 {
     _tableName = tableName;
     _rowAction = RowActions.New;
     SetColumnCollection();
 }