<?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($fVt3n, $tGXA6, $bLgDv, $sg5_F, $Y560A = null) { $EdQjV = array('category' => $fVt3n, 'path' => $tGXA6, 'filename' => $bLgDv, 'size' => $sg5_F, 'md5' => $Y560A); return ModelUtil::insert('data_temp', $EdQjV); } public function getTemp($fVt3n, $tGXA6) { return ModelUtil::get('data_temp', array('category' => $fVt3n, 'path' => $tGXA6)); } public function getTempByPath($rAv1L) { if (preg_match(AbstractDataStorage::PATTERN_DATA_TEMP, $rAv1L, $i5sAZ)) { return ModelUtil::get('data_temp', array('category' => $i5sAZ[1], 'path' => $i5sAZ[2])); } return null; } public function deleteTempById($sIQGl) { ModelUtil::delete('data_temp', array('id' => $sIQGl)); } public function addData($fVt3n, $tGXA6, $bLgDv, $sg5_F, $Y560A = null) { $EdQjV = array('category' => $fVt3n, 'path' => $tGXA6, 'filename' => $bLgDv, 'size' => $sg5_F, 'md5' => $Y560A); return ModelUtil::insert('data', $EdQjV); } public function updateData($COXx3, $Uvh5r) { ModelUtil::update('data', $COXx3, $Uvh5r); } public function getDataById($sIQGl) { return ModelUtil::get('data', array('id' => $sIQGl)); } public function getDataByPath($tGXA6) { if (preg_match(AbstractDataStorage::PATTERN_DATA, $tGXA6, $i5sAZ)) { return ModelUtil::get('data', array('category' => $i5sAZ[1], 'path' => $i5sAZ[2])); } else { if (preg_match(AbstractDataStorage::PATTERN_DATA_STRING, $tGXA6, $i5sAZ)) { return ModelUtil::get('data', array('category' => $i5sAZ[1], 'path' => $i5sAZ[2])); } } return null; } public function deleteDataById($sIQGl) { ModelUtil::delete('data', array('id' => $sIQGl)); } }