<?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($QLOpy, $S3tfG, $HGQLk, $VRgM7, $qePqY = null) { $OTBPk = array('category' => $QLOpy, 'path' => $S3tfG, 'filename' => $HGQLk, 'size' => $VRgM7, 'md5' => $qePqY); return ModelUtil::insert('data_temp', $OTBPk); } public function getTemp($QLOpy, $S3tfG) { return ModelUtil::get('data_temp', array('category' => $QLOpy, 'path' => $S3tfG)); } public function getTempByPath($qRuwB) { if (preg_match(AbstractDataStorage::PATTERN_DATA_TEMP, $qRuwB, $FH50y)) { return ModelUtil::get('data_temp', array('category' => $FH50y[1], 'path' => $FH50y[2])); } return null; } public function deleteTempById($xYu70) { ModelUtil::delete('data_temp', array('id' => $xYu70)); } public function addData($QLOpy, $S3tfG, $HGQLk, $VRgM7, $qePqY = null) { $OTBPk = array('category' => $QLOpy, 'path' => $S3tfG, 'filename' => $HGQLk, 'size' => $VRgM7, 'md5' => $qePqY); return ModelUtil::insert('data', $OTBPk); } public function updateData($HdEBp, $O9qD_) { ModelUtil::update('data', $HdEBp, $O9qD_); } public function getDataById($xYu70) { return ModelUtil::get('data', array('id' => $xYu70)); } public function getDataByPath($S3tfG) { if (preg_match(AbstractDataStorage::PATTERN_DATA, $S3tfG, $FH50y)) { return ModelUtil::get('data', array('category' => $FH50y[1], 'path' => $FH50y[2])); } else { if (preg_match(AbstractDataStorage::PATTERN_DATA_STRING, $S3tfG, $FH50y)) { return ModelUtil::get('data', array('category' => $FH50y[1], 'path' => $FH50y[2])); } } return null; } public function deleteDataById($xYu70) { ModelUtil::delete('data', array('id' => $xYu70)); } }