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


PHP TTransaction::get方法代码示例

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


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

示例1: setRowData

 /**
  * Assign values to the database columns
  * @param $column   Name of the database column
  * @param $value    Value for the database column
  */
 public function setRowData($column, $value)
 {
     // get the current connection
     $conn = TTransaction::get();
     // store just scalar values (string, integer, ...)
     if (is_scalar($value)) {
         // if is a string
         if (is_string($value) and !empty($value)) {
             // fill an array indexed by the column names
             $this->columnValues[$column] = $conn->quote($value);
         } else {
             if (is_bool($value)) {
                 // fill an array indexed by the column names
                 $this->columnValues[$column] = $value ? 'TRUE' : 'FALSE';
             } else {
                 if ($value !== '') {
                     // fill an array indexed by the column names
                     $this->columnValues[$column] = $value;
                 } else {
                     // if the value is NULL
                     $this->columnValues[$column] = "NULL";
                 }
             }
         }
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:31,代码来源:TSqlUpdate.class.php

示例2: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         // connection info
         $db = array();
         $db['host'] = '';
         $db['port'] = '';
         $db['name'] = 'app/database/samples.db';
         $db['user'] = '';
         $db['pass'] = '';
         $db['type'] = 'sqlite';
         TTransaction::open(NULL, $db);
         // open transaction
         $conn = TTransaction::get();
         // get PDO connection
         // make query
         $result = $conn->query('SELECT id, name from customer order by id');
         // iterate results
         foreach ($result as $row) {
             print $row['id'] . '-';
             print $row['name'] . "<br>\n";
         }
         TTransaction::close();
         // close transaction
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:29,代码来源:ManualConnection.class.php

示例3: getSocial

 public function getSocial()
 {
     //RECUPERA CONEXAO BANCO DE DADOS
     TTransaction::open('my_bd_site');
     //TABELA exposition_gallery
     $criteria = new TCriteria();
     $criteria->setProperty('order', 'nome ASC');
     // instancia a instrução de SELECT
     $sql = new TSqlSelect();
     $sql->addColumn('*');
     $sql->setEntity('social');
     //  atribui o critério passado como parâmetro
     $sql->setCriteria($criteria);
     // obtém transação ativa
     if ($conn = TTransaction::get()) {
         // registra mensagem de log
         TTransaction::log($sql->getInstruction());
         // executa a consulta no banco de dados
         $result = $conn->Query($sql->getInstruction());
         $this->results = array();
         if ($result) {
             // percorre os resultados da consulta, retornando um objeto
             while ($row = $result->fetchObject()) {
                 // armazena no array $this->results;
                 $this->results[] = $row;
             }
         }
     }
     TTransaction::close();
     return $this->results;
 }
开发者ID:rodu-pereira,项目名称:RogerioPereira,代码行数:31,代码来源:controladorSocial.class.php

示例4: getFirst

 public static function getFirst()
 {
     $conn = TTransaction::get();
     // get PDO connection
     // run query
     $result = $conn->query('SELECT min(id) as min from category');
     // show results
     foreach ($result as $row) {
         return $row['min'];
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:11,代码来源:Category.class.php

示例5: saveSale

 public function saveSale($client_insert, $amount_insert)
 {
     try {
         $conn = TTransaction::get();
         // get PDO connection
         // run query
         $date = date('Y-m-d');
         $result = $conn->query('INSERT INTO system_sales (date, client, amount) VALUES (' . $date . ', ' . $client_insert . ', ' . $amount_insert . ')');
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:kiibe,项目名称:linkERP,代码行数:12,代码来源:SystemSales.class.php

示例6: getManuByRequisicao

 public static function getManuByRequisicao(Manu $manu)
 {
     TTransaction::open('my_config');
     if ($conn = TTransaction::get()) {
         $sql = "SELECT M.*,U.nome_usuario FROM manutencoes M\r\n                            INNER JOIN usuarios U ON\r\n                            (U.id_usuario = M.responsavel_id)\r\n                            WHERE req_manutencao_id = ?";
         $sth = $conn->prepare($sql);
         $sth->execute(array($manu->getReqManutencaoId()));
         $result = $sth->fetchALL(PDO::FETCH_OBJ);
         return $result;
         TTransaction::close();
     }
 }
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:12,代码来源:ManuMapper.class.php

示例7: getDataItem

 public function getDataItem($id = NULL)
 {
     $conn = TTransaction::get();
     // get PDO connection
     // run query
     $result = $conn->query('SELECT product, quantity, price from system_stock where id = ' . $id . ' order by id');
     foreach ($result as $key) {
         $this->product = $key['product'];
         $this->quantity = $key['quantity'];
         $this->price = $key['price'];
     }
 }
开发者ID:kiibe,项目名称:linkERP,代码行数:12,代码来源:SystemStock.class.php

示例8: concluiEmp

 public static function concluiEmp($id)
 {
     TTransaction::open('my_config');
     if ($conn = TTransaction::get()) {
         $sql = "UPDATE itens_emprestimos SET entregue = 1\r\n                       WHERE id_item = ?";
         $sth = $conn->prepare($sql);
         $sth->execute(array($id));
         TTransaction::close();
     } else {
         echo 'Sem conexão com banco!';
     }
 }
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:12,代码来源:EmpMapper.class.php

示例9: CancelarStatus

 function CancelarStatus($id)
 {
     TTransaction::open('my_config');
     if ($conn = TTransaction::get()) {
         $sql = 'UPDATE req_manutencao SET estado_id = 1
                    WHERE id_requisicao = ?';
         $sth = $conn->prepare($sql);
         $sth->execute(array($id));
         TTransaction::close();
     } else {
         echo 'Sem conexão com banco!';
     }
 }
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:13,代码来源:Requerir.class.php

示例10: getInstruction

 /**
  * Returns the SELECT statement as an string according to the database driver
  */
 public function getInstruction()
 {
     $conn = TTransaction::get();
     $driver = $conn->getAttribute(PDO::ATTR_DRIVER_NAME);
     if (in_array($driver, array('mssql', 'dblib', 'sqlsrv'))) {
         return $this->getSqlServerInstruction();
     }
     if (in_array($driver, array('oci', 'oci8'))) {
         return $this->getOracleInstruction();
     } else {
         return $this->getStandardInstruction();
     }
 }
开发者ID:enieber,项目名称:adianti,代码行数:16,代码来源:TSqlSelect.class.php

示例11: ConcluiCrlChave

 static function ConcluiCrlChave(CrlChave $ch)
 {
     TTransaction::open('my_config');
     if ($conn = TTransaction::get()) {
         $sql = "UPDATE laboratorios SET chave_laboratorio=0\r\n                       WHERE id_laboratorio = ?";
         $sth = $conn->prepare($sql);
         $sth->execute(array($ch->getLaboratorioId()));
         $sql = "UPDATE ctrl_chaves SET dt_final_controle=?\r\n                       WHERE laboratorio_id = ?";
         $sth = $conn->prepare($sql);
         $sth->execute(array($ch->getDtFinalControle(), $ch->getLaboratorioId()));
         TTransaction::close();
     } else {
         echo 'Sem conexão com banco!';
     }
 }
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:15,代码来源:CrlChaveMapper.class.php

示例12: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         $sql = 'SELECT name, address FROM customer WHERE name like :name';
         $conn = TTransaction::get();
         $result = $conn->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
         $result->execute(array(':name' => 'And%'));
         var_dump($result->fetchAll());
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:15,代码来源:TestPage.class.php

示例13: count

 function count(TCriteria $criteria)
 {
     $sql = new TSqlSelect();
     $sql->addColumn(' count(*) ');
     $sql->setEntity(constant($this->class . '::TABLENAME'));
     $sql->setCriteria($criteria);
     if ($conn = TTransaction::get()) {
         TTransaction::log($sql->getInstruction());
         $result = $conn->query($sql->getInstruction());
         if ($result) {
             $row = $result->fetch();
         }
         return $row[0];
     } else {
         throw new Exception('Não há transação ativa!');
     }
 }
开发者ID:rodu-pereira,项目名称:RogerioPereira,代码行数:17,代码来源:TRepository.class.php

示例14: InsertPermissoes

 public static function InsertPermissoes($id, $arrayPost, $qtd_modulos_permissoes)
 {
     TTransaction::open('my_config');
     if ($conn = TTransaction::get()) {
         $sql = "DELETE FROM modulos_permissoes_usuarios\r\n                       WHERE usuario_id = ?";
         $sth = $conn->prepare($sql);
         $sth->execute(array($id));
         for ($i = 0; $i < $qtd_modulos_permissoes; $i++) {
             if ($arrayPost[$i] != 0) {
                 $sql = "INSERT INTO modulos_permissoes_usuarios (modulo_permissao_id,\r\n                               usuario_id) VALUE (?,?)";
                 $sth = $conn->prepare($sql);
                 $sth->execute(array($arrayPost[$i], $id));
             }
         }
         TTransaction::close();
     } else {
         echo 'Sem conexão com banco!';
     }
 }
开发者ID:laiello,项目名称:almoxarifadocedup,代码行数:19,代码来源:PermissaoMapper.class.php

示例15: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         // open transaction
         $conn = TTransaction::get();
         // get PDO connection
         // run query
         $result = $conn->query('SELECT id, name from customer order by id');
         // show results
         foreach ($result as $row) {
             print $row['id'] . '-';
             print $row['name'] . "<br>\n";
         }
         TTransaction::close();
         // close transaction
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:21,代码来源:SetupTransaction.php


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