Ignore:
Timestamp:
Oct 2, 2019, 12:15:16 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Optimized netwatch inport for inserting data ti database.
  • Fixed: RouterOS API to work with RouterOS newer than 6.43.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Database.php

    r858 r861  
    9696    //echo('a'.$this->ShowSQLQuery.'<'.$QueryStartTime.', '.microtime_float());
    9797    if(($this->ShowSQLQuery == true) or ($this->LogSQLQuery == true))
    98       $Duration = ' ; '.round(microtime_float() - $QueryStartTime, 4). ' s';
    99     if($this->LogSQLQuery == true)
     98    {
     99      $Time = round(microtime_float() - $QueryStartTime, 4);
     100      $Duration = ' ; '.$Time. ' s';
     101    }
     102    if(($this->LogSQLQuery == true) and ($Time != 0))
    100103      file_put_contents($this->LogFile, $Query.$Duration."\n", FILE_APPEND);
    101104    if($this->ShowSQLQuery == true)
     
    222225  public function Transaction($Queries)
    223226  {
    224       $this->PDO->beginTransaction();
    225       foreach ($Queries as $Query)
    226       {
    227         $Statement = $this->PDO->prepare($Query);
    228         $Statement->execute();
    229       }         
    230       $this->PDO->commit();
     227    //echo('|'."\n");
     228    $this->PDO->beginTransaction();
     229    foreach ($Queries as $Query)
     230    {
     231      //echo('|'.$Query."\n");
     232      $Statement = $this->PDO->prepare($Query);
     233      $Statement->execute();
     234    }
     235    $this->PDO->commit();
    231236  }
    232237}
Note: See TracChangeset for help on using the changeset viewer.