<?php ini_set('memory_limit', '256m'); include __DIR__ . '/../init.inc.php'; Pix_Table::$_save_memory = true; Pix_Table::addStaticResultSetHelper('Pix_Array_Volume'); class Dumper { protected $unit_types = array(); public function getType($id) { if (!array_key_exists($id, $this->unit_types)) { $start = floor($id / 10000) * 10000; $end = $start + 10000; $this->unit_types = Unit::search("`id` >= {$start} AND `id` < {$end}")->toArray('type'); } return $this->unit_types[$id]; } public function dump() { $columns = array(); foreach (ColumnGroup::search(1) as $columngroup) { $columns[$columngroup->id] = $columngroup->name; } $delta = 10000000; for ($i = 0; $i * $delta < 99999999; $i++) { $start = $i * $delta; $end = $start + $delta - 1; $tmpname1 = tempnam('', ''); $tmpname2 = tempnam('', ''); $file_name1 = 'files/' . str_pad($i * $delta, 8, '0', STR_PAD_LEFT) . '.json.gz';
/** * testStaticResultSetHelper test add ResultSet Helper to all Pix_Table */ public function testStaticResultSetHelper() { Pix_Table::addStaticResultSetHelper('Pix_Table_TableHelperTest_Helper', array('static_resultset_test')); $resultset = Pix_Table_TableHelperTest_Table::search(1); $uniqid = uniqid(); $resultset->setData(uniqid()); $this->assertEquals($resultset->static_resultset_test($uniqid), 'StaticResultSetHelper-' . $resultset->getData() . '-' . $uniqid); }