This repository was archived by the owner on Oct 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -68,23 +68,37 @@ const WASM_TABLE_CREATE: &str =
68
68
69
69
fn perform_load_dump ( conn : & rusqlite:: Connection , path : PathBuf ) -> anyhow:: Result < ( ) > {
70
70
let mut f = BufReader :: new ( File :: open ( path) ?) ;
71
+ let mut curr = String :: new ( ) ;
71
72
let mut line = String :: new ( ) ;
72
73
let mut skipped_wasm_table = false ;
73
- while let Ok ( n) = f. read_line ( & mut line ) {
74
+ while let Ok ( n) = f. read_line ( & mut curr ) {
74
75
if n == 0 {
75
76
break ;
76
77
}
78
+ let frag = curr. trim ( ) ;
79
+
80
+ if frag. is_empty ( ) || frag. starts_with ( "--" ) {
81
+ curr. clear ( ) ;
82
+ continue ;
83
+ }
84
+
85
+ line. push_str ( frag) ;
86
+ curr. clear ( ) ;
77
87
78
88
// This is a hack to ignore the libsql_wasm_func_table table because it is already created
79
89
// by the system.
80
- if !skipped_wasm_table && line. trim ( ) == WASM_TABLE_CREATE {
90
+ if !skipped_wasm_table && line == WASM_TABLE_CREATE {
81
91
skipped_wasm_table = true ;
82
92
line. clear ( ) ;
83
93
continue ;
84
94
}
85
95
86
- conn. execute ( & line, ( ) ) ?;
87
- line. clear ( ) ;
96
+ if line. ends_with ( ';' ) {
97
+ conn. execute ( & line, ( ) ) ?;
98
+ line. clear ( ) ;
99
+ } else {
100
+ line. push ( ' ' ) ;
101
+ }
88
102
}
89
103
90
104
Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments