Exemple #1
0
        public void DeleteRecordsFromTable(String tableName, Dictionary <int, Record> records)
        {
            CheckIfDatabaseSelected();
            TableManager tableManager = new TableManager(DbManager.db.Name, tableName);

            tableManager.DeleteRecords(records);
            tableManager.DeleteRecordsFromIndices(records);
        }
Exemple #2
0
        /**
         * Delete records from table which satisifies the @param name="condition"
         *
         * If condition null that means deleting all the records
         */
        public void DeleteRecordsFromTable(String tableName, Condition condition)
        {
            CheckIfDatabaseSelected();
            TableManager tableManager = new TableManager(DbManager.db.Name, tableName);

            //check if condition is valid or not
            if (!tableManager.table.CheckIfConditionValid(condition))
            {
                throw new Exception("Condition is not valid");
            }

            Dictionary <int, Record> records = SelectRecordsFromTable(tableName, condition);

            tableManager.DeleteRecords(records);
            tableManager.DeleteRecordsFromIndices(records);
        }