Lançado Adianti Framework 7.6!
Clique aqui para saber mais
Erro no Store alguem ja passou por esse erro na hora de fazer um update ( ! ) PDOException: SQLSTATE[HY000]: General error: 1205 Tempo de espera (timeout) de travamento excedido. Tente reiniciar a transação. in F:SistemaJorgeCentralFomentolibadiantidatabaseTRecord.php on line 393 ja aumentei o timeout o maximo que pude no servidor local e ainda da esse erro. o codigo que esta dando erro é es...
JR
Erro no Store  
alguem ja passou por esse erro na hora de fazer um update

( ! ) PDOException: SQLSTATE[HY000]: General error: 1205 Tempo de espera (timeout) de travamento excedido. Tente reiniciar a transação. in F:SistemaJorgeCentralFomentolibadiantidatabaseTRecord.php on line 393

ja aumentei o timeout o maximo que pude no servidor local e ainda da esse erro.

o codigo que esta dando erro é esse abaixo.
  1. <?php 
  2. /**
  3.      * method onGenerate()
  4.      * Executed whenever the user clicks at the generate button
  5.      */
  6.     function onGeraPDFTitulos($idLote)
  7.     {
  8.         try
  9.         {
  10.             
  11.             $titRel 'Analise de Conflitos de Títulos';
  12.            // TTransaction::setLogger(new TLoggerHTML('tmp/erros/LogGeraDPFTitulos'.'.html'));
  13.            // TTransaction::log("** Ate aqui Ok<br> ");
  14.             
  15.             // open a transaction with database 'permission'
  16.             TTransaction::open('permission');
  17.             
  18.             // get the form data into an active record
  19.             //$formdata = $this->form->getData();
  20.             
  21.             $repository = new TRepository('TempGnrtit');
  22.             $criteria   = new TCriteria;
  23.             $param['order'] = 'temp_id';
  24.             $param['direction'] = 'asc';
  25.             $criteria->setProperties($param);
  26.             $filtro '';
  27.             $today date('d/m/Y');
  28.             $time date('H:i:s');
  29.             TTransaction::setLogger(new TLoggerHTML('tmp/erros/LogGeraDPFTitulosComproblemas'.'.html'));
  30.             $objects $repository->load($criteria);
  31.             //TTransaction::log("** Ate aqui Ok<br> ".print_r($objects,true));
  32.             TTransaction::log("** Ate aqui Ok<br> ");
  33.             //$format  = $formdata->output_type;
  34.             
  35.             if ($objects)
  36.             {
  37.                 $widths = array(250,95,100,95,250);
  38.                 
  39.                 $tr = new TTableWriterPDF($widths,'l','pt','A4');
  40.                 
  41.                 $pdf $tr->getNativeWriterPDF();
  42.                 
  43.                 //$pdf->SetMargins(10, 10); 
  44.                 $pdf->SetAutoPageBreak(true10);
  45.                 
  46.                 // Arial bold 15
  47.                 $pdf->SetFont('Arial','B',15);
  48.                 
  49.                 // create the document styles
  50.                 $tr->addStyle('title''Arial''8''',   '#000000''#ffffff');
  51.                 $tr->addStyle('datap''Arial''8''',    '#000000''#ffffff');
  52.                 $tr->addStyle('datai''Arial''8''',    '#000000''#F8F8FF');
  53.                 $tr->addStyle('header''Times''10''B',  '#000000''#ffffff');
  54.                 $tr->addStyle('footer''Times''12''BI''#000000''#ffffff');
  55.                 
  56.                 // Adicionando Header do relatorio
  57.                 $pdf->AliasNbPages();
  58.                 $pdf->SetFont('Arial','B',9);
  59.                 $pdf->Cell(35,10,$today ' - ' $time,0,0,'C');
  60.                 $pdf->Cell(1475,10,'Pagina '.$pdf->PageNo().'/{nb}',0,0,'C');
  61.                 $pdf->Line('0',40,'850',40);
  62.                 $pdf->Image('app/images/CDF.png',365,45,80);
  63.                 $pdf->line('0','155','850','155');
  64.                 $pdf->Ln(20);
  65.                 $pdf->SetFont('Arial','B',20);
  66.                 $pdf->Cell(750,242,utf8_decode($titRel),0,0,'C');
  67.                 $pdf->Ln(-105);
  68.                 /// fim do Header 
  69.                 
  70.                 // Adicionando Titulos da linha do relatório
  71.                 $tr->addRow();
  72.                 $tr->addCell('Sacado''center''title','1','1');
  73.                 //$tr->addCell('Cedente', 'center', 'title','1','1');
  74.                 $tr->addCell('Título''center''title','1','1');
  75.                 $tr->addCell('Vencimento''center''title','1','1');
  76.                 $tr->addCell('Vlr. Titulos''center''title','1','1');
  77.                 $tr->addCell('Empresa''center''title','1','1');
  78.                 // fim da linha de titulos 
  79.                 
  80.                 $colourFALSE;
  81.                 $data = new DateTime('NOW');
  82.                 $dia_anterior_hora_zerada = new DateTime();
  83.                 $dia_anterior_hora_zerada $data;
  84.                 $dia_anterior_hora_zerada->setTime(00,00,00);
  85.                 $dia_anterior_hora_zerada->modify('-5 day');
  86.                 //Inicio dos dados
  87.                 foreach ($objects as $object)
  88.                 {
  89.                     $Sacado = new GnrPess($object->temp_SacId);
  90.                     $titulo = new GnrTit($object->temp_TitIdPesq);
  91.                     $emp    = new GnrEmp($object->temp_TitEmpEnc);
  92.                     
  93.                     if (($emp->GnrPubPriv == ) && (strtotime($emp->GnrEmpDtPub) < strtotime($dia_anterior_hora_zerada->format('Y-m-d H:m:s'))))
  94.                     {
  95.                             $empresa substr($emp->GnrEmpNomeRedu,0,20);
  96.                     }else
  97.                     {
  98.                         $empresa 'Privada';
  99.                     }                    
  100.                     
  101.                     $tr->addRow();
  102.                     $style $colour 'datap' 'datai';
  103.                     $tr->addCell($Sacado->GnrPessNome'left'$style,'1','1');
  104.                     $tr->addCell($titulo->GnrTitNum'center'$style,'1','1');
  105.                     $tr->addCell(TDate::date2br($titulo->GnrTitVenOrig), 'center'$style,'1','1');
  106.                     $tr->addCell(number_format($titulo->GnrTitVlrOrig2',''.'), 'center'$style,'1','1');
  107.                     $tr->addCell($empresa'left'$style,'1','1');
  108.                     $colour = !$colour;
  109.                     $headerfooter $pdf->GetY();
  110.                     if($headerfooter 540)
  111.                     {
  112.                         $pdf->AcceptPageBreak();
  113.                         $pdf->AddPage();
  114.                         
  115.                         //inicio do header 
  116.                    
  117.                         $pdf->SetFont('Arial','B',9);
  118.                         $pdf->Cell(35,10,$today ' - ' $time,0,0,'C');
  119.                         $pdf->Cell(1475,10,'Pagína '.$pdf->PageNo().'/{nb}',0,0,'C');
  120.                         $pdf->Line('0',40,'850',40);
  121.                         $pdf->Image('app/images/CDF.png',365,45,80);
  122.                         $pdf->line('0','155','850','155');
  123.                         $pdf->Ln(20);
  124.                         $pdf->SetFont('Arial','B',20);
  125.                         $pdf->Cell(750,242,utf8_decode($titRel),0,0,'C');
  126.                         $pdf->Ln(-105);
  127.                         
  128.                         // Adicionando Titulos da linha do relatório
  129.                         $tr->addRow();
  130.                         $tr->addCell('Sacado''center''title','1','1');
  131.                         //$tr->addCell('Cedente', 'center', 'title','1','1');
  132.                         $tr->addCell('Título''center''title','1','1');
  133.                         $tr->addCell('Vencimento''center''title','1','1');
  134.                         $tr->addCell('Vlr. Titulos''center''title','1','1');
  135.                         $tr->addCell('Empresa''center''title','1','1');
  136.                         
  137.                      }
  138.                      
  139.                 }
  140.                
  141.                 // stores the file // refazer esse nome do PDF
  142.                 $nomeCripto md5('GnrTitReport001'.date('Y-m-d H:i:s'));
  143.                 
  144.                 if (!file_exists("out/".$nomeCripto.'CRL'.$idLote.".pdf") OR is_writable("out/".$nomeCripto.'CRL'.$idLote.".pdf"))
  145.                 {
  146.                     $tr->save("out/".$nomeCripto.'CRL'.$idLote.".pdf");
  147.                     $retorno "out/".$nomeCripto.'CRL'.$idLote.".pdf";
  148.                     try
  149.                     {
  150.                         # abri a tabela de lote e gravar o PDF ERRO NESSE UPDATE
  151.                         //TTransaction::open('permission');
  152.                         TTransaction::setLogger(new TLoggerHTML('tmp/erros/logLote'.$idLote.'.html'));
  153.                         $binario file_get_contents($retorno);
  154.                         $Lote  = new GnrTitLot($idLote);
  155.                         TTransaction::log("** gravando log lote<br> "print_r($Lote,true));
  156.                         TTransaction::log("** LOG GnrTitLog gravando log lote2 <br> "$idLote);
  157.                         //$Lote->GnrTitLotPdf = $binario; // comentei pois pensava que era o tamanho do arquivo que era muito grande 199k
  158.                         //$Lote->GnrTitLotNmPdf = $nomeCripto.'CRL'.$idLote.".pdf"; 
  159.                         
  160.                         $Lote->GnrSttId 22;
  161.                         $ret $Lote->store();
  162.                         TTransaction::log("** Retorno do update do lote <br> "$ret);
  163.                         //TTransaction::close();
  164.                         
  165.                         
  166.                     }catch( Exception $e)
  167.                     {
  168.                         $retorno .= 'Problemas para gravar Lote update'.print_r($e,true);
  169.                     }
  170.                 }
  171.                 else
  172.                 {
  173.                     $retorno .= ;
  174.                     $retorno .= 'Não foi possivel criar pasta: ' "out/".$nomeCripto.".pdf";
  175.                     
  176.                 }
  177.                 
  178.             } 
  179.             TTransaction::close();   
  180.         }
  181.         catch (Exception $e// in case of exception
  182.         {
  183.             // shows the exception error message
  184.             $retorno =  $e->getMessage();
  185.             // undo all pending operations
  186.             TTransaction::rollback();
  187.         }
  188.         
  189.         return  $retorno
  190.         
  191.     }
  192. ?>

Curso completo Meu Negócio Pronto
Use para si, ou transforme em um negócio: Inclui aulas e códigos-fontes
Gestor de conteúdo (SITE) + Loja Virtual (E-Commerce) + Emissor de Notas para infoprodutos


Meu negócio pronto Quero me inscrever agora!

Comentários (0)