Esempio n. 1
0
    }
    /**
     * exportRows
     *
     * @param string $table
     * @param array  $sql
     *
     * @return  void
     */
    public static function exportRows($table, &$sql)
    {
        $stat = static::$db->query('SELECT * FROM ' . $table);
        $query = 'INSERT ' . $table . ' VALUES (%s)';
        while ($row = $stat->fetch_object()) {
            $values = array();
            foreach (get_object_vars($row) as $k => $v) {
                $values[] = "'" . static::$db->real_escape_string($v) . "'";
            }
            $sql[] = sprintf($query, implode(', ', $values));
        }
    }
}
// Set error handler
BackupApplication::registerErrorHandler();
$app = new BackupApplication($options);
try {
    $app->execute();
} catch (Exception $e) {
    http_response_code($e->getCode());
    echo $e->getMessage();
}