PDO::ERRMODE_EXCEPTION] ); echo "=== Populate M_PatientNIK_bidx ===\n"; $total = 0; $batch = 500; $stmt = $pdo->prepare( "UPDATE m_patient SET M_PatientNIK_bidx = ? WHERE M_PatientID = ?" ); while (true) { $rows = $pdo->query( "SELECT M_PatientID, M_PatientNIK_enc FROM m_patient WHERE M_PatientNIK_enc IS NOT NULL AND M_PatientNIK_bidx IS NULL LIMIT {$batch}" )->fetchAll(PDO::FETCH_ASSOC); if (empty($rows)) break; foreach ($rows as $row) { $nik = $enc->decrypt($row['M_PatientNIK_enc']); $stmt->execute([ $enc->search_bidx((string)($nik ?? '')), $row['M_PatientID'], ]); $total++; } echo " {$total} rows...\n"; } echo "Selesai: {$total} rows\n";