<?php
define('CDX_SPORT_CONTEXT',true);require __DIR__.'/preflight.php';$admin=$q('SELECT UUID FROM '.$p.'user WHERE ID=(SELECT MIN(ID) FROM '.$p.'user WHERE TYPE=0 AND IS_DELETE=0)')[0]['uuid'];$out=['lane'=>$lane,'business_dml'=>0,'ddl'=>0,'original_operator_uuid_length'=>strlen($admin),'operator_uuid_sha256'=>hash('sha256',$admin),'staff_user_reference'=>$report['synthetic_reference'],'type0_user_uuid_lengths'=>[],'tables'=>[]];$out['type0_user_uuid_lengths']=$q('SELECT LENGTH(UUID) AS UUID_LENGTH,COUNT(*) AS N FROM '.$p.'user WHERE TYPE=0 AND IS_DELETE=0 GROUP BY LENGTH(UUID) ORDER BY LENGTH(UUID)');if($lane==='B')$out['independent_pdo_sql_mode']=$db->query('SELECT @@SESSION.sql_mode')->fetchColumn();
foreach(['sport_education','sport_experience']as $table){$rows=$q('SELECT CREATE_BY FROM '.$p.$table.' ORDER BY ID');$out['tables'][$table]=['rows'=>count($rows),'create_by_lengths'=>array_map(static function($r){return strlen($r['create_by']);},$rows),'all_existing_source_operator_prefix32'=>!in_array(false,array_map(static function($r)use($admin){return $r['create_by']===substr($admin,0,32);},$rows),true)];}
echo json_encode($out),"\n";
