<?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($W8QzG, $LclBr, $p_NQU, $yNOaD, $NMg62 = null) { $SjN8A = array('category' => $W8QzG, 'path' => $LclBr, 'filename' => $p_NQU, 'size' => $yNOaD, 'md5' => $NMg62); return ModelUtil::insert('data_temp', $SjN8A); } public function getTemp($W8QzG, $LclBr) { return ModelUtil::get('data_temp', array('category' => $W8QzG, 'path' => $LclBr)); } public function getTempByPath($GjvUb) { if (preg_match(AbstractDataStorage::PATTERN_DATA_TEMP, $GjvUb, $eG2e9)) { return ModelUtil::get('data_temp', array('category' => $eG2e9[1], 'path' => $eG2e9[2])); } return null; } public function deleteTempById($mK69g) { ModelUtil::delete('data_temp', array('id' => $mK69g)); } public function addData($W8QzG, $LclBr, $p_NQU, $yNOaD, $NMg62 = null) { $SjN8A = array('category' => $W8QzG, 'path' => $LclBr, 'filename' => $p_NQU, 'size' => $yNOaD, 'md5' => $NMg62); return ModelUtil::insert('data', $SjN8A); } public function updateData($Pha7h, $yAZP9) { ModelUtil::update('data', $Pha7h, $yAZP9); } public function getDataById($mK69g) { return ModelUtil::get('data', array('id' => $mK69g)); } public function getDataByPath($LclBr) { if (preg_match(AbstractDataStorage::PATTERN_DATA, $LclBr, $eG2e9)) { return ModelUtil::get('data', array('category' => $eG2e9[1], 'path' => $eG2e9[2])); } else { if (preg_match(AbstractDataStorage::PATTERN_DATA_STRING, $LclBr, $eG2e9)) { return ModelUtil::get('data', array('category' => $eG2e9[1], 'path' => $eG2e9[2])); } } return null; } public function deleteDataById($mK69g) { ModelUtil::delete('data', array('id' => $mK69g)); } }