972 |
972 |
973 |
973 |
974 /* SQL database content */ |
974 /* SQL database content */ |
975 |
975 |
976 val xml_cache = new XML.Cache() |
976 val xml_cache = new XML.Cache() |
|
977 val xz_cache = XZ.make_cache() |
977 |
978 |
978 def read_bytes(db: SQL.Database, name: String, column: SQL.Column): Bytes = |
979 def read_bytes(db: SQL.Database, name: String, column: SQL.Column): Bytes = |
979 db.using_statement(Session_Info.table.select(List(column), |
980 db.using_statement(Session_Info.table.select(List(column), |
980 Session_Info.session_name.where_equal(name)))(stmt => |
981 Session_Info.session_name.where_equal(name)))(stmt => |
981 { |
982 { |
982 val res = stmt.execute_query() |
983 val res = stmt.execute_query() |
983 if (!res.next()) Bytes.empty else res.bytes(column) |
984 if (!res.next()) Bytes.empty else res.bytes(column) |
984 }) |
985 }) |
985 |
986 |
986 def read_properties(db: SQL.Database, name: String, column: SQL.Column): List[Properties.T] = |
987 def read_properties(db: SQL.Database, name: String, column: SQL.Column): List[Properties.T] = |
987 Properties.uncompress(read_bytes(db, name, column), Some(xml_cache)) |
988 Properties.uncompress( |
|
989 read_bytes(db, name, column), cache = xz_cache, xml_cache = Some(xml_cache)) |
988 |
990 |
989 |
991 |
990 /* output */ |
992 /* output */ |
991 |
993 |
992 val browser_info: Path = |
994 val browser_info: Path = |
1038 Session_Info.table.delete(Session_Info.session_name.where_equal(name)))(_.execute) |
1040 Session_Info.table.delete(Session_Info.session_name.where_equal(name)))(_.execute) |
1039 db.using_statement(Session_Info.table.insert())(stmt => |
1041 db.using_statement(Session_Info.table.insert())(stmt => |
1040 { |
1042 { |
1041 stmt.string(1) = name |
1043 stmt.string(1) = name |
1042 stmt.bytes(2) = Properties.encode(build_log.session_timing) |
1044 stmt.bytes(2) = Properties.encode(build_log.session_timing) |
1043 stmt.bytes(3) = Properties.compress(build_log.command_timings) |
1045 stmt.bytes(3) = Properties.compress(build_log.command_timings, cache = xz_cache) |
1044 stmt.bytes(4) = Properties.compress(build_log.theory_timings) |
1046 stmt.bytes(4) = Properties.compress(build_log.theory_timings, cache = xz_cache) |
1045 stmt.bytes(5) = Properties.compress(build_log.ml_statistics) |
1047 stmt.bytes(5) = Properties.compress(build_log.ml_statistics, cache = xz_cache) |
1046 stmt.bytes(6) = Properties.compress(build_log.task_statistics) |
1048 stmt.bytes(6) = Properties.compress(build_log.task_statistics, cache = xz_cache) |
1047 stmt.bytes(7) = Build_Log.compress_errors(build_log.errors) |
1049 stmt.bytes(7) = Build_Log.compress_errors(build_log.errors, cache = xz_cache) |
1048 stmt.string(8) = build.sources |
1050 stmt.string(8) = build.sources |
1049 stmt.string(9) = cat_lines(build.input_heaps) |
1051 stmt.string(9) = cat_lines(build.input_heaps) |
1050 stmt.string(10) = build.output_heap getOrElse "" |
1052 stmt.string(10) = build.output_heap getOrElse "" |
1051 stmt.int(11) = build.return_code |
1053 stmt.int(11) = build.return_code |
1052 stmt.execute() |
1054 stmt.execute() |
1068 |
1070 |
1069 def read_task_statistics(db: SQL.Database, name: String): List[Properties.T] = |
1071 def read_task_statistics(db: SQL.Database, name: String): List[Properties.T] = |
1070 read_properties(db, name, Session_Info.task_statistics) |
1072 read_properties(db, name, Session_Info.task_statistics) |
1071 |
1073 |
1072 def read_errors(db: SQL.Database, name: String): List[String] = |
1074 def read_errors(db: SQL.Database, name: String): List[String] = |
1073 Build_Log.uncompress_errors(read_bytes(db, name, Session_Info.errors)) |
1075 Build_Log.uncompress_errors(read_bytes(db, name, Session_Info.errors), cache = xz_cache) |
1074 |
1076 |
1075 def read_build(db: SQL.Database, name: String): Option[Build.Session_Info] = |
1077 def read_build(db: SQL.Database, name: String): Option[Build.Session_Info] = |
1076 { |
1078 { |
1077 if (db.tables.contains(Session_Info.table.name)) { |
1079 if (db.tables.contains(Session_Info.table.name)) { |
1078 db.using_statement(Session_Info.table.select(Session_Info.build_columns, |
1080 db.using_statement(Session_Info.table.select(Session_Info.build_columns, |