順番が変になったカラムを特定のキー順に振りなおしてやりなおせるSQL@

ALTER TABLE `subject` CHANGE num num int(11) NOT NULL;
alter table subject drop primary key;
SET @i := 0; UPDATE subject SET num = (@i := @i +1) ORDER BY created;
ALTER TABLE subject CHANGE num num int auto_increment, ADD PRIMARY KEY(num);

ALTER TABLE subject AUTO_INCREMENT = @i;

実行は一瞬

perlからphpのsession read

いまさらperlつかってるひとなんて化石なんだろうなあとおもいつつーperlだいすき


https://www.h-fj.com/blog/archives/2013/02/27-152952.php

use Data::Dumper
use CGI::Cookie;
use PHP::Serialization qw( unserialize );

my %ck = fetch CGI::Cookie;;
my $data = $memd->get($ck{PHPSESSID}->value);

$data =~ s/^[^\|]+\|//;
my $ref = PHP::Serialization::unserialize($data);

print Dumper($ref);