Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
cutsea110 committed Mar 31, 2024
1 parent 29b8604 commit 6199173
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/materialize/mergejoinscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,44 +88,44 @@ impl Scan for MergeJoinScan {
}
fn get_i16(&mut self, fldname: &str) -> Result<i16> {
if self.s1.lock().unwrap().has_field(fldname) {
return self.s1.lock().unwrap().get_i16(fldname);
self.s1.lock().unwrap().get_i16(fldname)
} else {
return self.s2.lock().unwrap().get_i16(fldname);
self.s2.lock().unwrap().get_i16(fldname)
}
}
fn get_i32(&mut self, fldname: &str) -> Result<i32> {
if self.s1.lock().unwrap().has_field(fldname) {
return self.s1.lock().unwrap().get_i32(fldname);
self.s1.lock().unwrap().get_i32(fldname)
} else {
return self.s2.lock().unwrap().get_i32(fldname);
self.s2.lock().unwrap().get_i32(fldname)
}
}
fn get_string(&mut self, fldname: &str) -> Result<String> {
if self.s1.lock().unwrap().has_field(fldname) {
return self.s1.lock().unwrap().get_string(fldname);
self.s1.lock().unwrap().get_string(fldname)
} else {
return self.s2.lock().unwrap().get_string(fldname);
self.s2.lock().unwrap().get_string(fldname)
}
}
fn get_bool(&mut self, fldname: &str) -> Result<bool> {
if self.s1.lock().unwrap().has_field(fldname) {
return self.s1.lock().unwrap().get_bool(fldname);
self.s1.lock().unwrap().get_bool(fldname)
} else {
return self.s2.lock().unwrap().get_bool(fldname);
self.s2.lock().unwrap().get_bool(fldname)
}
}
fn get_date(&mut self, fldname: &str) -> Result<NaiveDate> {
if self.s1.lock().unwrap().has_field(fldname) {
return self.s1.lock().unwrap().get_date(fldname);
self.s1.lock().unwrap().get_date(fldname)
} else {
return self.s2.lock().unwrap().get_date(fldname);
self.s2.lock().unwrap().get_date(fldname)
}
}
fn get_val(&mut self, fldname: &str) -> Result<Constant> {
if self.s1.lock().unwrap().has_field(fldname) {
return self.s1.lock().unwrap().get_val(fldname);
self.s1.lock().unwrap().get_val(fldname)
} else {
return self.s2.lock().unwrap().get_val(fldname);
self.s2.lock().unwrap().get_val(fldname)
}
}
fn has_field(&self, fldname: &str) -> bool {
Expand Down
3 changes: 2 additions & 1 deletion src/materialize/sortscan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ impl Scan for SortScan {

if !self.hasmore1 && !self.hasmore2 {
return false;
} else if self.hasmore1 && self.hasmore2 {
}
if self.hasmore1 && self.hasmore2 {
let s1 = self.s1.lock().unwrap().to_scan().unwrap();
let s2 = self.s2.as_ref().unwrap().lock().unwrap().to_scan().unwrap();
if self.comp.compare(s1, s2).is_lt() {
Expand Down
2 changes: 1 addition & 1 deletion src/rdbc/resultsetadapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl fmt::Display for ResultSetError {
write!(f, "failed to close")
}
ResultSetError::UnknownField(fldname) => {
write!(f, "unknown field {}", fldname)
write!(f, "unknown field '{}'", fldname)
}
}
}
Expand Down

0 comments on commit 6199173

Please sign in to comment.