当前位置: 首页>>代码示例>>PHP>>正文


PHP Query::delete方法代码示例

本文整理汇总了PHP中Query::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Query::delete方法的具体用法?PHP Query::delete怎么用?PHP Query::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Query的用法示例。


在下文中一共展示了Query::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleting

function deleting($table, $where)
{
    $q = new Query();
    $q->table = $table;
    $q->where = $where;
    $q->delete();
}
开发者ID:vyserees,项目名称:mobile,代码行数:7,代码来源:functions.php

示例2: delete

 static function delete($id)
 {
     $tname = static::tableName();
     $query = new Query($tname);
     $pk = static::$primaryKey;
     $query->delete($tname)->where("`{$tname}`.`{$pk}` = ?", [$id]);
     static::query($query, $query->params);
 }
开发者ID:SleepingInsomniac,项目名称:DataBaser,代码行数:8,代码来源:Model.class.php

示例3: delete

 /**
  * Delete a model from the database.
  *
  * @param  int  $id
  * @return int
  */
 public function delete($id = null)
 {
     // If the delete method is being called on an existing model, we only want to delete
     // that model. If it is being called from an Eloquent query model, it is probably
     // the developer's intention to delete more than one model, so we will pass the
     // delete statement to the query instance.
     if (!$this->exists) {
         return $this->query->delete();
     }
     return DB::connection(static::$connection)->table(static::table(get_class($this)))->delete($this->id);
 }
开发者ID:hpaul,项目名称:Google-short,代码行数:17,代码来源:model.php

示例4: removeRelation

 protected function removeRelation($object)
 {
     if (!isset($this->owner)) {
         return false;
     }
     // can't add without
     $owner = $this->owner;
     $joint = static::tableJoin($owner->tableName, $object->tableName);
     // get the joint table
     $query = new Query($joint);
     $query->delete($joint)->where("{$object->tableName} = ? AND {$owner->tableName} = ?", [$object->primaryKey, $owner->primaryKey]);
     static::query($query, $query->params);
 }
开发者ID:SleepingInsomniac,项目名称:DataBaser,代码行数:13,代码来源:ModelCollection.class.php

示例5: process

 public function process($get, $post)
 {
     if (!isset($post['course_id']) || !is_numeric($post['course_id']) || !isset($_COOKIE['sessionId']) || !is_numeric($_COOKIE['sessionId'])) {
         $this->failureReason = 'Sorry, there was an error.';
         return false;
     }
     $query = new Query('action');
     // Select all the courses that are in this user's session and have this course id
     $result = $query->delete(array(array('course_id', '=', $post['course_id']), array('session_id', '=', $_COOKIE['sessionId'])));
     if (!$result) {
         // Abort because this course is already in the user's model
         $this->failureReason = 'Sorry, there was an error.';
         return false;
     }
     return true;
 }
开发者ID:bennyty,项目名称:suggestr,代码行数:16,代码来源:RemoveCourse.php

示例6: delSoporte

 public function delSoporte($soporte)
 {
     return $this->_query->delete($soporte);
 }
开发者ID:CarlosAyala,项目名称:midas-codeigniter-modulo-emergencias,代码行数:4,代码来源:soportes_model.php

示例7: Query

<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_GET) {
    $id = $_GET['id'];
    require "sources/Query.inc";
    $query = new Query();
    if ($query->delete("dependencia", "idDependencia={$id}")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Dependencia eliminada correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
            <?php 
    include 'sources/template/head.php';
    ?>
            <meta http-equiv="Refresh" content="2;url=consultarDependencia.php" />
        </head>
开发者ID:jalbertorm,项目名称:SEP,代码行数:31,代码来源:eliminarDependencia.php

示例8: delete

 /**
  * Create delete query
  *
  * @param string			$table
  * @param string 		$handler
  * @return mixed
  */
 public static function delete($table, $handler = null)
 {
     return Query::delete($table, $handler);
 }
开发者ID:clancats,项目名称:core,代码行数:11,代码来源:DB.php

示例9: Query

<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_GET) {
    $id = $_GET['id'];
    require "sources/Query.inc";
    $query = new Query();
    if ($query->delete("redaccion", "idRedaccion={$id}")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Saludo eliminado correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
            <?php 
    include 'sources/template/head.php';
    ?>
            <meta http-equiv="Refresh" content="2;url=consultarRedaccion.php" />
        </head>
开发者ID:jalbertorm,项目名称:SEP,代码行数:31,代码来源:eliminarRedaccion.php

示例10: Status

addButton('btn btn-success', 'Submit', 'col-sm-offset-2 col-sm-4', 'Sign Up');
?>
                    </fieldset>
        </form>  
                    <?php 
require_once 'Status.php';
require_once 'database.php';
$q = new Status($db);
$q->viewStatus('dvd', 'available', 'Return');
?>
                    <?php 
require_once "Query.php";
$crud_book = new Query(7, 'dvd', 'item_no,title,genre,description,price,rental_period,status');
$crud_book->mysqlConnect('localhost', 'root', '', 'video_rental');
$crud_book->create();
echo "<hr/>";
$crud_book->read();
echo "<hr/>";
$crud_book->update();
echo "<hr/>";
$crud_book->delete();
echo "<hr/>";
?>

                </div>
            </div>
        </div>
       
    </body>
</html>
开发者ID:jayp3e011,项目名称:Planas-Bautista_Finals,代码行数:30,代码来源:test2.php

示例11: dumpTable

 /**
  * Метод выполняет дамп таблицы
  */
 public static function dumpTable($idColumn, $table, array $where = array(), $order = null)
 {
     //Стартуем секундомер
     $secundomer = Secundomer::startedInst("Снятие дампа {$table}");
     //Отключим ограничение по времени
     PsUtil::startUnlimitedMode();
     //Получим экземпляр логгера
     $LOGGER = PsLogger::inst(__CLASS__);
     //Текущий пользователь
     $userId = AuthManager::getUserIdOrNull();
     //Для логов, запросов и все остального
     $table = strtoupper(PsCheck::tableName($table));
     //Макс кол-во записей
     $limit = PsDefines::getTableDumpPortion();
     //Проверим наличие id
     $idColumn = PsCheck::tableColName($idColumn);
     $LOGGER->info('Dumping table {}. Id column: {}, limit: {}. User id: {}.', $table, $idColumn, $limit, $userId);
     //Получаем лок (без ожидания)
     $lockName = "DUMP table {$table}";
     $locked = PsLock::lock($lockName, false);
     $LOGGER->info('Lock name: {}, locked ? {}.', $lockName, var_export($locked, true));
     if (!$locked) {
         return false;
         //Не удалось получить лок
     }
     $zipDi = false;
     try {
         //ЗПРОСЫ:
         //1. Запрос на извлечение колва записей, подлежащих дампированию
         $queryCnt = Query::select("count({$idColumn}) as cnt", $table, $where);
         //2. Запрос на извлечение данных, подлежащих дампированию
         $queryDump = Query::select('*', $table, $where, null, $order, $limit);
         //3. Запрос на извлечение кодов дампируемых записей
         $selectIds = Query::select($idColumn, $table, $where, null, $order, $limit);
         //4. Запрос на удаление дампированных данных
         $queryDel = Query::delete($table, Query::plainParam("{$idColumn} in (select {$idColumn} from (" . $selectIds->build($delParams) . ') t )', $delParams));
         //Выполним запрос для получения кол-ва записей, подлежащих дампу
         $cnt = PsCheck::int(array_get_value('cnt', PSDB::getRec($queryCnt, null, true)));
         $LOGGER->info('Dump recs count allowed: {}.', $cnt);
         if ($cnt < $limit) {
             $LOGGER->info('SKIP dumping table, count allowed ({}) < limit ({})...', $cnt, $limit);
             $LOGGER->info("Query for extract dump records count: {$queryCnt}");
             PsLock::unlock($lockName);
             return false;
         }
         //Время дампа
         $date = PsUtil::fileUniqueTime(false);
         $time = time();
         //Название файлов
         $zipName = $date . ' ' . $table;
         //Элемент, указывающий на zip архив
         $zipDi = DirManager::stuff(null, array(self::DUMPS_TABLE, $table))->getDirItem(null, $zipName, PsConst::EXT_ZIP);
         $LOGGER->info('Dump to: [{}].', $zipDi->getAbsPath());
         if ($zipDi->isFile()) {
             $LOGGER->info('Dump file exists, skip dumping table...');
             PsLock::unlock($lockName);
             return false;
         }
         //Комментарий к таблице
         $commentToken[] = "Date: {$date}";
         $commentToken[] = "Time: {$time}";
         $commentToken[] = "Table: {$table}";
         $commentToken[] = "Manager: {$userId}";
         $commentToken[] = "Recs dumped: {$limit}";
         $commentToken[] = "Total allowed: {$cnt}";
         $commentToken[] = "Query dump cnt:   {$queryCnt}";
         $commentToken[] = "Query dump data:  {$queryDump}";
         $commentToken[] = "Query dump ids:   {$selectIds}";
         $commentToken[] = "Query del dumped: {$queryDel}";
         $comment = implode("\n", $commentToken);
         //Начинаем zip и сохраняем в него данные
         $zip = $zipDi->startZip();
         $zip->addFromString($zipName, serialize(PSDB::getArray($queryDump)));
         $zip->setArchiveComment($comment);
         $zip->close();
         $LOGGER->info('Data successfully dumped, zip comment:');
         $LOGGER->info("[\n{$comment}\n]");
         //Удалим те записи, дамп которых был снят
         $LOGGER->info('Clearing dumped table records...');
         $affected = PSDB::update($queryDel);
         $LOGGER->info('Rows deleted: {}.', $affected);
         $LOGGER->info('Dumping is SUCCESSFULLY finished. Total time: {} sec.', $secundomer->stop()->getAverage());
     } catch (Exception $ex) {
         PsLock::unlock($lockName);
         ExceptionHandler::dumpError($ex);
         $LOGGER->info('Error occured: {}', $ex->getMessage());
         throw $ex;
     }
     return $zipDi;
 }
开发者ID:ilivanoff,项目名称:www,代码行数:93,代码来源:AdminTableDump.php

示例12: removeResetTokensOfUser

 public function removeResetTokensOfUser($userId)
 {
     return Query::delete($this->getDomain()->getTableName(), "userId = :userId", array("userId" => $userId), 100);
 }
开发者ID:euBatham,项目名称:javacature,代码行数:4,代码来源:ResetTokenDAO.class.php

示例13: deleteCommentsFor

 public function deleteCommentsFor($id, $type)
 {
     $id = (int) $id;
     $type = (string) $type;
     Query::delete('comments')->where('record', $id)->andWhere('type', $type)->act();
 }
开发者ID:radex,项目名称:Watermelon,代码行数:6,代码来源:comments.model.php

示例14: delete

 public static function delete($name)
 {
     list($id, $keys) = self::parseName($name);
     // deleting (locally)
     if (empty($keys)) {
         unset(self::$fields[$id]);
     } else {
         self::deleteSubKey(self::$fields[$id], $keys);
     }
     // pushing changes to database
     if (!array_key_exists($id, self::$fields)) {
         // deleting field completely
         Query::delete('config')->where('name', $id)->act();
         self::$noSuchField[$id] = true;
     } else {
         // or only updating
         Query::update('config')->where('name', $id)->set('value', serialize(self::$fields[$id]))->act();
     }
 }
开发者ID:radex,项目名称:Watermelon,代码行数:19,代码来源:Config.php

示例15: Query

<?php

include "sources/funciones.php";
if ($_SESSION["Activa"] and $_SESSION["Tipo_usuario"] == "administrador" and $_GET) {
    $id = $_GET['id'];
    require "sources/Query.inc";
    $query = new Query();
    if ($query->delete("login", "idLogin={$id}")) {
        $respuesta = '
                    <img src="images/ok.png" width="100">
                    <h4>
                        Usuario eliminado correctamente.
                    </h4>
                    ';
    } else {
        $respuesta = '
                    <img src="images/error.png" width="100">
                    <h4>
                        Ha ocurrido un error.
                    </h4>
                    ';
    }
    ?>
    <!DOCTYPE html>
    <html>
        <head>
            <?php 
    include 'sources/template/head.php';
    ?>
            <meta http-equiv="Refresh" content="2;url=consultarUsuario.php" />
        </head>
开发者ID:jalbertorm,项目名称:SEP,代码行数:31,代码来源:eliminarUsuario.php


注:本文中的Query::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。