PHP 트레잇 App\Traits\SupportsDeleteWhereIDsNotIn

MySQL and PostgreSQL seem to have a limit of 2^16-1 (65535) elements in an IN statement. This trait provides a method as a workaround to this limitation.
파일 보기 프로젝트 열기: phanan/koel

공개 메소드들

메소드 설명
deleteByChunk ( array $ids, string $key = 'id', integer $chunkSize = 65535 ) Delete records chunk by chunk.
deleteWhereIDsNotIn ( array $ids, string $key = 'id' ) : mixed Deletes all records whose IDs are not in an array.

메소드 상세

deleteByChunk() 공개 정적인 메소드

Delete records chunk by chunk.
public static deleteByChunk ( array $ids, string $key = 'id', integer $chunkSize = 65535 )
$ids array The array of record IDs to delete
$key string Name of the primary key
$chunkSize integer Size of each chunk. Defaults to 2^16-1 (65535)

deleteWhereIDsNotIn() 공개 정적인 메소드

Deletes all records whose IDs are not in an array.
public static deleteWhereIDsNotIn ( array $ids, string $key = 'id' ) : mixed
$ids array The array of IDs.
$key string Name of the primary key.
리턴 mixed