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


PHP Transaction::log方法代码示例

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


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

示例1: save

 public function save()
 {
     if (empty($this->data['id'])) {
         $id = $this->getLastId() + 1;
         $sql = "INSERT INTO produto (id, descricao, estoque, preco_custo, " . "preco_venda, codigo_barras, data_cadastro, origem)" . " VALUES ('{$id}', " . "'{$this->descricao}', " . "'{$this->estoque}', " . "'{$this->preco_custo}', " . "'{$this->preco_venda}', " . "'{$this->codigo_barras}', " . "'{$this->data_cadastro}', " . "'{$this->origem}')";
     } else {
         $sql = "UPDATE produto SET descricao = '{$this->descricao}', " . "estoque = '{$this->estoque}', " . "preco_custo = '{$this->preco_custo}', " . "preco_venda = '{$this->preco_venda}', " . "codigo_barras = '{$this->codigo_barras}', " . "data_cadastro = '{$this->data_cadastro}', " . "origem = '{$this->origem}' " . "WHERE id = '{$this->id}'";
     }
     //print "$sql <br>\n";
     Transaction::log($sql);
     $conn = Transaction::get();
     return $conn->exec($sql);
 }
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:13,代码来源:ProdutoComTransacaoELog.php

示例2: count

 function count(Criteria $criteria)
 {
     $expression = $criteria->dump();
     $sql = "SELECT count(*) FROM " . constant($this->activeRecord . '::TABLENAME');
     if ($expression) {
         $sql .= ' WHERE ' . $expression;
     }
     if ($conn = Transaction::get()) {
         Transaction::log($sql);
         $result = $conn->query($sql);
         if ($result) {
             $row = $result->fetch();
         }
         return $row[0];
     } else {
         throw new Exception('Não há transação ativa!!');
     }
 }
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:18,代码来源:Repository.php

示例3: query

 public static function query($query)
 {
     $ip = $_SERVER['REMOTE_ADDR'];
     Transaction::log("A Seguinte Query Fo Feita: {$query}  ;", "sql");
     return Transaction::query($query);
 }
开发者ID:habb0,项目名称:mobbo,代码行数:6,代码来源:mobbo.class.php

示例4: LoggerTXT

<?php

require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log_update.txt'));
    Transaction::log('Alterando um produto');
    $p1 = Produto::find(2);
    print $p1->estoque . "<br>\n";
    $p1->estoque += 10;
    print $p1->estoque . "<br>\n";
    $p1->store();
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:22,代码来源:record_update.php

示例5: LoggerTXT

<?php

require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log_protect.txt'));
    Transaction::log('Protegendo o acesso a um produto');
    $p1 = Produto::find(2);
    $p1->estoque = 'dois';
    $p1->store();
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:20,代码来源:record_protect.php

示例6: LoggerTXT

<?php

require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log_find.txt'));
    Transaction::log('Buscando um produto');
    $p1 = Produto::find(2);
    print $p1->descricao;
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:19,代码来源:record_get.php

示例7: LoggerTXT

<?php

require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log_novo.txt'));
    Transaction::log('Inserindo produto novo');
    $p1 = new Produto();
    $p1->descricao = 'Cerveja artesanal IPA';
    $p1->estoque = 50;
    $p1->preco_custo = 8;
    $p1->preco_venda = 12;
    $p1->codigo_barras = '75363453234234';
    $p1->data_cadastro = date('Y-m-d');
    $p1->origem = 'N';
    $p1->store();
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:26,代码来源:record_novo.php

示例8: LoggerTXT

<?php

require_once 'classes/ar/ProdutoComTransacaoELog.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Transaction.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log.txt'));
    Transaction::log("Inserindo produto novo");
    $p1 = new Produto();
    $p1->descricao = 'Chocolate amargo';
    $p1->estoque = 80;
    $p1->preco_custo = 4;
    $p1->preco_venda = 7;
    $p1->codigo_barras = '68323453234234';
    $p1->data_cadastro = date('Y-m-d');
    $p1->origem = 'N';
    $p1->save();
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:25,代码来源:exemplo_log.php

示例9: LoggerTXT

<?php

require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log_delete.txt'));
    Transaction::log('Removendo um produto');
    $p1 = Produto::find(7);
    if ($p1 instanceof Produto) {
        $p1->delete();
    } else {
        throw new Exception('Produto não localizado');
    }
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:23,代码来源:record_delete.php

示例10: LoggerTXT

<?php

require_once 'classes/api/Transaction.php';
require_once 'classes/api/Connection.php';
require_once 'classes/api/Logger.php';
require_once 'classes/api/LoggerTXT.php';
require_once 'classes/api/Record.php';
require_once 'classes/model/Produto.php';
try {
    Transaction::open('estoque');
    Transaction::setLogger(new LoggerTXT('tmp/log_clone.txt'));
    Transaction::log('Clonando um produto');
    $p1 = Produto::find(2);
    $p2 = clone $p1;
    $p2->descricao .= ' (clonado)';
    $p2->store();
    Transaction::close();
} catch (Exception $e) {
    Transaction::rollback();
    print $e->getMessage();
}
开发者ID:jmoliver,项目名称:php-programando-com-orientacao-a-objeto,代码行数:21,代码来源:record_clone.php


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