<?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($ZRqAm, $VF_G6, $d5z9H, $NVUsK, $gmeCI = null) { $CnWtd = array('category' => $ZRqAm, 'path' => $VF_G6, 'filename' => $d5z9H, 'size' => $NVUsK, 'md5' => $gmeCI); return ModelUtil::insert('data_temp', $CnWtd); } public function getTemp($ZRqAm, $VF_G6) { return ModelUtil::get('data_temp', array('category' => $ZRqAm, 'path' => $VF_G6)); } public function getTempByPath($rdtHG) { if (preg_match(AbstractDataStorage::PATTERN_DATA_TEMP, $rdtHG, $WpF0C)) { return ModelUtil::get('data_temp', array('category' => $WpF0C[1], 'path' => $WpF0C[2])); } return null; } public function deleteTempById($T6TGt) { ModelUtil::delete('data_temp', array('id' => $T6TGt)); } public function addData($ZRqAm, $VF_G6, $d5z9H, $NVUsK, $gmeCI = null) { $CnWtd = array('category' => $ZRqAm, 'path' => $VF_G6, 'filename' => $d5z9H, 'size' => $NVUsK, 'md5' => $gmeCI); return ModelUtil::insert('data', $CnWtd); } public function updateData($gDHcN, $CSNXd) { ModelUtil::update('data', $gDHcN, $CSNXd); } public function getDataById($T6TGt) { return ModelUtil::get('data', array('id' => $T6TGt)); } public function getDataByPath($VF_G6) { if (preg_match(AbstractDataStorage::PATTERN_DATA, $VF_G6, $WpF0C)) { return ModelUtil::get('data', array('category' => $WpF0C[1], 'path' => $WpF0C[2])); } else { if (preg_match(AbstractDataStorage::PATTERN_DATA_STRING, $VF_G6, $WpF0C)) { return ModelUtil::get('data', array('category' => $WpF0C[1], 'path' => $WpF0C[2])); } } return null; } public function deleteDataById($T6TGt) { ModelUtil::delete('data', array('id' => $T6TGt)); } }