Delete item from database

@param $ids
@return bool
173245
public function itemsDelete($ids) {
		$db = BFactory::getDBO();
		if (empty($db)) {
			return false;
		}
		$qr = 'DELETE FROM `' . $this->tableName . '` WHERE (`' . $this->primaryKeyName . '` in (' . implode(',', $ids) . '))';
		$q = $db->Query($qr);
		if (empty($q)) {
			return false;
		}
		//TODO delete cache
		return true;
	}
525803
public function deleteByArray(array $ids, string $key = null): int
    {
        return $this->deleteByKey($ids, $key);
    }
291111
public function delete(string $id) : bool
    {
        $query = $this->storageTable->find('all', [
            'conditions' => [self::FILE_STORAGE_FOREIGN_KEY => $id]
        ]);
        $entity = $query->first();

        if (is_null($entity)) {
            return false;
        }

        if ($this->storageTable->delete($entity)) {
            $this->removeThumbnails($entity);

            return true;
        }

        return false;
    }
781617
public static function destroy($id)
    {
        $table = self::getTableNameFromClass();

        self::getOne($id);

        $query = "DELETE FROM $table WHERE id = ".$id;

        try {
            Connection::db()->query($query);
            return true;
        } catch (Exception $e) {
            return false;
        }
    }
834496
public function removeItem($id)
	{
		if (!array_key_exists($id, $this->ids)) {
			return false;
		}

		$item = $this->ids[$id];
		unset($this->ids[$id]);

		foreach ($this->items as $k1 => $v1) {
			foreach ($v1 as $k2 => $v2) {
				if ($item === $v2) {
					unset($this->items[$k1][$k2]);
				}
			}
		}
	}
115885
public function delete(string $id)
    {
        $this->request->allowMethod(['post', 'delete']);
        $dblist = $this->Dblists->get($id);
        if ($this->Dblists->delete($dblist)) {
            $this->Flash->success('The database list has been deleted.');
        } else {
            $this->Flash->error('The database list could not be deleted. Please, try again.');
        }

        return $this->redirect(['action' => 'index']);
    }
1239410
def delete_by_ids(self, ids):
        
        try:
            self.filter(id__in=ids).delete()
            return True
        except self.model.DoesNotExist:
            return False
342496
public function destroy($id)
    {
        $query = $this->db->getQuery(true);
        $query->delete($this->db->quoteName($this->options['table']))
            ->where($this->db->quoteName($this->options['id_col']) . ' = ' . $this->db->quote($id));

        // Remove a session from the database.
        $this->db->setQuery($query);

        return (bool) $this->db->execute();
    }
1108340
public function delete($id)
    {
        $delete = "DELETE FROM " . $this->getTable() . " " .
            "WHERE " . $this->getPrimaryKey() . " = '" . intval($id) . "' LIMIT 1 ;";

        return $this->db->query($delete);
    }
116111
protected function _deleteItems( array $ids, $sql, $siteidcheck = true, $name = 'id' )
	{
		if( empty( $ids ) ) { return; }

		$context = $this->_getContext();
		$dbname = $this->_getResourceName();

		$search = $this->createSearch();
		$search->setConditions( $search->compare( '==', $name, $ids ) );

		$types = array( $name => MW_DB_Statement_Abstract::PARAM_STR );
		$translations = array( $name => '"' . $name . '"' );

		$cond = $search->getConditionString( $types, $translations );
		$sql = str_replace( ':cond', $cond, $sql );

		$dbm = $context->getDatabaseManager();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$stmt = $conn->create( $sql );

			if( $siteidcheck ) {
				$stmt->bind( 1, $context->getLocale()->getSiteId(), MW_DB_Statement_Abstract::PARAM_INT );
			}

			$stmt->execute()->finish();

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
275184
public function delete($ids) {
		if (URequest::isAjax ()) {
			$instance = $this->getModelInstance ( $ids );
			$instanceString = $this->getInstanceToString ( $instance );
			if (sizeof ( $_POST ) > 0) {
				try {
					if (DAO::remove ( $instance )) {
						$message = new CRUDMessage ( "Deletion of `<b>" . $instanceString . "</b>`", "Deletion", "info", "info circle", 4000 );
						$message = $this->_getEvents ()->onSuccessDeleteMessage ( $message, $instance );
						$this->jquery->exec ( "$('._element[data-ajax={$ids}]').remove();", true );
					} else {
						$message = new CRUDMessage ( "Can not delete `" . $instanceString . "`", "Deletion", "warning", "warning circle" );
						$message = $this->_getEvents ()->onErrorDeleteMessage ( $message, $instance );
					}
				} catch ( \Exception $e ) {
					$message = new CRUDMessage ( "Exception : can not delete `" . $instanceString . "`", "Exception", "warning", "warning" );
					$message = $this->_getEvents ()->onErrorDeleteMessage ( $message, $instance );
				}
				$message = $this->_showSimpleMessage ( $message );
			} else {
				$message = new CRUDMessage ( "Do you confirm the deletion of `<b>" . $instanceString . "</b>`?", "Remove confirmation", "error", "question circle" );
				$message = $this->_getEvents ()->onConfDeleteMessage ( $message, $instance );
				$message = $this->_showConfMessage ( $message, $this->_getBaseRoute () . "/delete/{$ids}", "#table-messages", $ids );
			}
			echo $message;
			echo $this->jquery->compile ( $this->view );
		} else {
			$this->jquery->execAtLast ( "$('._delete[data-ajax={$ids}]').trigger('click');" );
			$this->index ();
		}
	}
300490
public function deleteUsers(array $ids): void
	{
		if ($this->isAjax()) {
			$users = $this->orm->users->findById($ids);
			foreach ($users as $user) {
				$this->orm->users->remove($user);
			}
			$this->orm->flush();
			$this['userList']->reload();
		} else {
			$this->terminate();
		}
	}
345689
function delete($ids, $force = true)
    {
        if (!is_array($ids)) {
            $ids = explode(self::SEPARATOR, $ids);
        }

        $ids = $this->db->array2list($ids, 'integer');

        // flag record as deleted (always)
        $this->db->query(
            "UPDATE " . $this->db->table_name($this->db_name, true).
            " SET `del` = 1, `changed` = ".$this->db->now().
            " WHERE `user_id` = ?".
                " AND `contact_id` IN ($ids)",
            $this->user_id
        );

        $this->cache = null;

        return $this->db->affected_rows();
    }
635619
public function destroy($id)
    {
        try {
            $key = $this->datastore->key(
                $this->kind,
                $id,
                ['namespaceId' => $this->namespaceId]
            );
            $this->transaction->delete($key);
            $this->transaction->commit();
        } catch (Exception $e) {
            trigger_error(
                sprintf('Datastore delete failed: %s', $e->getMessage()),
                E_USER_WARNING
            );
            return false;
        }
        return true;
    }
68278
public function destroy($id)
    {
        $query = "DELETE FROM " . $this->tableName . " WHERE session_id = :id";
        $stmt = $this->db->prepare($query);
        setcookie(session_name(), '', time() - 3600);
        if ($stmt->execute(['id' => $id])) {
            return true;
        }
        return false;
    }
661200
public function deleteViaIds($ids)
    {
        return !$ids ||
        \Yii::$app->db->createCommand()->delete(
            $this->viaTable,
            array_merge($this->condition, [reset($this->relationAttribute) => $ids])
        )->execute();
    }
654604
public function delete($id)
    {
        $db = new DatabaseManager();
        $connection = $db->getDbh();

        $sql = 'DELETE from :table WHERE id=:id';
        $sql = str_replace(':table', $this->tableName, $sql);

        $statement = $connection->prepare($sql);
//        $statement->bindParam(':table',  $this->tableName);
        $statement->bindParam(':id', $id, \PDO::PARAM_INT);

        $queryWasSuccessful = $statement->execute();
        return $queryWasSuccessful;
    }