當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Conexao::obterConexao方法代碼示例

本文整理匯總了PHP中Conexao::obterConexao方法的典型用法代碼示例。如果您正苦於以下問題:PHP Conexao::obterConexao方法的具體用法?PHP Conexao::obterConexao怎麽用?PHP Conexao::obterConexao使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Conexao的用法示例。


在下文中一共展示了Conexao::obterConexao方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: exportarCSV

 public static function exportarCSV($sql, $file)
 {
     $sql = $sql . " INTO OUTFILE '" . $file . "' CHARACTER SET utf16 FIELDS TERMINATED BY ';' LINES TERMINATED BY '\n';";
     $conn = Conexao::obterConexao();
     return mysql_query($sql) or die(mysql_error());
 }
開發者ID:cokita,項目名稱:srp,代碼行數:6,代碼來源:ProducaoDAO.php

示例2: queryExclusivaProducao

 public static function queryExclusivaProducao($sql, $objeto)
 {
     $resultado = false;
     $conn = Conexao::obterConexao();
     $sql_count = str_replace(':paginacao', '', $sql);
     $sql_count = self::prepare($sql_count, $objeto);
     if (($from = stristr($sql_count, 'from')) !== false) {
         $result_count = mysql_query('select count(1) ' . $from) or die(mysql_error());
         $row = mysql_fetch_row($result_count);
         if ($row) {
             $colunas = stristr($sql, 'from', true);
             $colunas .= ", " . $row[0] . " as pg_numero_registros ";
         }
     }
     if (property_exists($objeto, 'pg_pagina') && $objeto->get("pg_pagina")) {
         $itens_pagina = 25;
         if ($objeto->get("pg_registros")) {
             $itens_pagina = $objeto->get("pg_registros");
         }
         if ($objeto->get("pg_pagina") == 1) {
             $inicio = 0;
         } else {
             $inicio = $itens_pagina * $objeto->get("pg_pagina") - $itens_pagina;
         }
         if (strpos($sql, ':paginacao') !== false) {
             $sql = str_replace(':paginacao', 'limit ' . $inicio . ', ' . $itens_pagina, $sql);
         }
         $colunas .= ", " . $itens_pagina . " as pg_itens_pagina ";
         $colunas .= ", " . $objeto->get("pg_pagina") . " as pg_pagina ";
     }
     $query = stristr($sql, 'from');
     $sql = $colunas . $query;
     $sql = self::prepare($sql, $objeto);
     $stmt = mysql_query($sql) or die(mysql_error());
     if ($stmt) {
         while ($x = mysql_fetch_object($stmt, get_class($objeto))) {
             $resultado[] = $x;
         }
     }
     return $resultado;
 }
開發者ID:cokita,項目名稱:srp,代碼行數:41,代碼來源:DAOSqlServer.php


注:本文中的Conexao::obterConexao方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。