Example #1
0
 /**
  * @param $file
  * @return null
  */
 public function performSql($file)
 {
     if ($sql = file($file)) {
         $query = '';
         foreach ($sql as $line) {
             $tsl = trim($line);
             if ($sql != '' && substr($tsl, 0, 2) != "--" && substr($tsl, 0, 1) != '#') {
                 $query .= $line;
                 if (preg_match('/;\\s*$/', $line)) {
                     $query = str_replace("`ac_", "`" . DB_PREFIX, $query);
                     $result = $this->_query($query);
                     if (!$result) {
                         $err = $this->driver->getDBError();
                         $this->error = $err['error_text'];
                         return null;
                     }
                     $query = '';
                 }
             }
         }
     }
 }
Example #2
0
 /**
  * @return int
  */
 public function getLastId()
 {
     return $this->driver->getLastId();
 }