package II9e5c887fde608c86d8845b32f527887e; use strict 'vars'; use base qw/II720d6e18aa34327713eb014408fc9144/; use II4212c07ddfb1652c969722f1a6817994; use Zen::PerlHandler; our $Generators; our $myTable = 'zen_id_dbtable'; II4212c07ddfb1652c969722f1a6817994->setErrorHandler("table '[\\w\\-]+\.$myTable' doesn't exist", sub
{ my ($dbc, $qr, $params) = @_; $dbc->do(<<END);
CREATE TABLE $myTable (
sqltable    varchar(50) NOT NULL default '', sqlfield    varchar(50) NOT NULL default 'id', curvalue    int(11) NOT NULL default '0', UNIQUE KEY  sqltable (sqltable,sqlfield)
) ENGINE=MyISAM
END
$dbc->do($qr, $params); return 1; }); BEGIN{*II9e5c887fde608c86d8845b32f527887e::IIlIlIllIIIlIIII=\%{pack('H6','070361')^'BM7'};*II9e5c887fde608c86d8845b32f527887e::lIlIIIlIllIIIIll=\&{pack('H24','583b3e3d6c754470625b3d64')^'5ZWSVO7HU9EP'};$II9e5c887fde608c86d8845b32f527887e::IIlIIIlIIIIIIlII=pack('H18','776d03036d0e001a1b')^'?9WS2FOIO';$II9e5c887fde608c86d8845b32f527887e::IlIlIlIIIlllllll=pack('H12','7102097d0e14')^';KG1GW'};sub generate { my ($class, $dbc, $table, $field) = @_; $dbc = II4212c07ddfb1652c969722f1a6817994::IlllllIIIIIIlIIl($II720d6e18aa34327713eb014408fc9144::IlIlIllIlIlIIlll{$II4212c07ddfb1652c969722f1a6817994::llIIlllIlIlllllI},994,$II720d6e18aa34327713eb014408fc9144::IlIlIllIlIlIIlll{$II9e5c887fde608c86d8845b32f527887e::IllIlllIlIIIIIIl})->get($dbc) unless ref $dbc; $field ||= 'id'; $dbc->do("LOCK TABLES $myTable WRITE"); my $curvalue = $dbc->getValue("SELECT curvalue FROM $myTable WHERE sqltable='$table' AND sqlfield='$field'"); unless ($curvalue) { $dbc->do("LOCK TABLES $myTable WRITE,$table WRITE"); $curvalue = $dbc->getValue("SELECT MAX($field) FROM $table") + 0; $dbc->do("INSERT INTO $myTable (sqltable,sqlfield,curvalue) VALUES ('$table','$field','$curvalue')"); } if (my $generator = $Generators->{$table}) { $curvalue = &$generator($curvalue); } else { $curvalue++; } $dbc->do("UPDATE $myTable SET curvalue='$curvalue' WHERE sqltable='$table' AND sqlfield='$field'"); $dbc->do("UNLOCK TABLES"); $curvalue; } BEGIN{*II9e5c887fde608c86d8845b32f527887e::lIIIllIIIIIllIIl=\%{pack('H6','041a13')^'ATE'};*II9e5c887fde608c86d8845b32f527887e::IIIlIlIIIIIllIlI=\&{pack('H24','22305a5c697c407b0438380c')^'OQ32SF3C3Z@8'};$II9e5c887fde608c86d8845b32f527887e::IlIllIlIllIlIlll=pack('H18','011261650c107a1003')^'IF55SX5CW';$II9e5c887fde608c86d8845b32f527887e::IllIlllIlIIIIIIl=pack('H12','13111e0b0b78')^'YXPGB;'};sub setGenerator { my ($class, $table, $code) = @_; $Generators->{$table} = $code; return; } 1; 