<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Data\Repository; use ModStart\Core\Dao\ModelUtil; use ModStart\Data\AbstractDataRepository; use ModStart\Data\AbstractDataStorage; class DatabaseDataRepository extends AbstractDataRepository { public function maxFilenameByte() { return 200; } public function addTemp($NU9Ix, $nAf_0, $WWf4O, $IiMdC, $mPPHd = null) { $zonFp = array('category' => $NU9Ix, 'path' => $nAf_0, 'filename' => $WWf4O, 'size' => $IiMdC, 'md5' => $mPPHd); return ModelUtil::insert('data_temp', $zonFp); } public function getTemp($NU9Ix, $nAf_0) { return ModelUtil::get('data_temp', array('category' => $NU9Ix, 'path' => $nAf_0)); } public function getTempByPath($DL2bL) { if (preg_match(AbstractDataStorage::PATTERN_DATA_TEMP, $DL2bL, $S8gta)) { return ModelUtil::get('data_temp', array('category' => $S8gta[1], 'path' => $S8gta[2])); } return null; } public function deleteTempById($D_1N9) { ModelUtil::delete('data_temp', array('id' => $D_1N9)); } public function addData($NU9Ix, $nAf_0, $WWf4O, $IiMdC, $mPPHd = null) { $zonFp = array('category' => $NU9Ix, 'path' => $nAf_0, 'filename' => $WWf4O, 'size' => $IiMdC, 'md5' => $mPPHd); return ModelUtil::insert('data', $zonFp); } public function updateData($q0RFp, $ui4CR) { ModelUtil::update('data', $q0RFp, $ui4CR); } public function getDataById($D_1N9) { return ModelUtil::get('data', array('id' => $D_1N9)); } public function getDataByPath($nAf_0) { if (preg_match(AbstractDataStorage::PATTERN_DATA, $nAf_0, $S8gta)) { return ModelUtil::get('data', array('category' => $S8gta[1], 'path' => $S8gta[2])); } else { if (preg_match(AbstractDataStorage::PATTERN_DATA_STRING, $nAf_0, $S8gta)) { return ModelUtil::get('data', array('category' => $S8gta[1], 'path' => $S8gta[2])); } } return null; } public function deleteDataById($D_1N9) { ModelUtil::delete('data', array('id' => $D_1N9)); } }