Ignore:
Timestamp:
Jun 17, 2013, 10:42:13 AM (11 years ago)
Author:
chronos
Message:
  • Přidáno: Možnost zaznamenávat všechny SQL povely do souboru.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/Database.php

    r540 r542  
    2828class Database
    2929{
    30   var $Prefix = '';
    31   var $Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');
    32   var $Type = 'mysql';  // mysql, pgsql
     30  var $Prefix;
     31  var $Functions;
     32  var $Type
    3333  var $PDO;
    34   var $Error = '';
     34  var $Error;
    3535  var $insert_id;
    36   var $LastQuery = '';
    37   var $ShowSQLError = false;
    38   var $ShowSQLQuery = false;
     36  var $LastQuery;
     37  var $ShowSQLError;
     38  var $ShowSQLQuery;
     39  var $LogFile;
    3940 
    4041  function __construct()
    4142  {   
     43        $this->Functions = array('NOW()', 'CURDATE()', 'CURTIME()', 'UUID()');
     44        $this->Type = 'mysql'; // mysql, pgsql
     45        $this->ShowSQLError = false;
     46        $this->ShowSQLQuery = false;
     47        $this->LogSQLQuery = false;
     48        $this->LogFile = 'Query.log';
    4249  }
    4350 
     
    6067    if($this->ShowSQLQuery == true)
    6168      echo('<div style="border-bottom-width: 1px; border-bottom-style: solid; padding-bottom: 3px; padding-top: 3px; font-size: 12px; font-family: Arial;">'.$Query.'</div>'."\n");
     69    if($this->LogSQLQuery == true)
     70      file_put_contents($this->LogFile, $Query."\n", FILE_APPEND);
    6271    $Result = new DatabaseResult();
    6372    $Result->PDOStatement = $this->PDO->query($Query);
Note: See TracChangeset for help on using the changeset viewer.