merged
authorwenzelm
Sat, 22 Oct 2022 20:15:36 +0200
changeset 76364 2c0f252fb11c
parent 76360 2b204e11141c (current diff)
parent 76363 f7174238b5e3 (diff)
child 76365 24e951a8a318
merged
--- a/src/Pure/General/bytes.scala	Sat Oct 22 18:47:48 2022 +0200
+++ b/src/Pure/General/bytes.scala	Sat Oct 22 20:15:36 2022 +0200
@@ -238,7 +238,7 @@
         new Bytes(result.toByteArray, 0, result.size)
       case options_zstd: Compress.Options_Zstd =>
         Zstd.init()
-        Bytes(zstd.Zstd.compress(array, options_zstd.level))
+        Bytes(zstd.Zstd.compress(if (offset == 0) bytes else array, options_zstd.level))
     }
   }
 
--- a/src/Pure/General/compress.scala	Sat Oct 22 18:47:48 2022 +0200
+++ b/src/Pure/General/compress.scala	Sat Oct 22 20:15:36 2022 +0200
@@ -15,7 +15,7 @@
   /* options */
 
   object Options {
-    def apply(): Options = Options_XZ()
+    def apply(): Options = Options_Zstd()
   }
   sealed abstract class Options
   case class Options_XZ(level: Int = 3) extends Options {
--- a/src/Pure/General/sql.scala	Sat Oct 22 18:47:48 2022 +0200
+++ b/src/Pure/General/sql.scala	Sat Oct 22 20:15:36 2022 +0200
@@ -287,6 +287,8 @@
   trait Database extends AutoCloseable {
     db =>
 
+    def is_server: Boolean
+
 
     /* types */
 
@@ -387,6 +389,7 @@
 
   class Database private[SQLite](name: String, val connection: Connection) extends SQL.Database {
     override def toString: String = name
+    override def is_server: Boolean = false
 
     def sql_type(T: SQL.Type.Value): SQL.Source = SQL.sql_type_sqlite(T)
 
@@ -461,6 +464,7 @@
     port_forwarding: Option[SSH.Port_Forwarding]
   ) extends SQL.Database {
     override def toString: String = name
+    override def is_server: Boolean = true
 
     def sql_type(T: SQL.Type.Value): SQL.Source = SQL.sql_type_postgresql(T)
 
--- a/src/Pure/Thy/export.scala	Sat Oct 22 18:47:48 2022 +0200
+++ b/src/Pure/Thy/export.scala	Sat Oct 22 20:15:36 2022 +0200
@@ -224,8 +224,9 @@
             (results, true)
           })
 
-    def make_entry(session_name: String, args: Protocol.Export.Args, body: Bytes): Unit = {
+    def make_entry(session_name: String, args0: Protocol.Export.Args, body: Bytes): Unit = {
       if (!progress.stopped && !body.is_empty) {
+        val args = if (db.is_server) args0.copy(compress = false) else args0
         consumer.send(Export.make_entry(session_name, args, body, cache) -> args.strict)
       }
     }