Skip to content

Commit

Permalink
driver-adapters: Rename ColumnType::Char to Character
Browse files Browse the repository at this point in the history
To avoid confusion with SQL's CHAR type that is a fixed-length string,
not single character.
  • Loading branch information
Sergey Tatarintsev committed Nov 1, 2023
1 parent 49b44c5 commit 93f4c55
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions query-engine/driver-adapters/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,7 @@ pub enum ColumnType {
/// - BOOLEAN (BOOLEAN) -> e.g. `1`
Boolean = 5,

/// The following PlanetScale type IDs are mapped into Char:
/// - CHAR (CHAR) -> e.g. `"c"` (String-encoded)
Char = 6,
Character = 6,

/// The following PlanetScale type IDs are mapped into Text:
/// - TEXT (TEXT) -> e.g. `"foo"` (String-encoded)
Expand Down Expand Up @@ -346,7 +344,7 @@ fn js_value_to_quaint(
"expected a boolean in column '{column_name}', found {mismatch}"
)),
},
ColumnType::Char => match json_value {
ColumnType::Character => match json_value {
serde_json::Value::String(s) => match s.chars().next() {
Some(c) => Ok(QuaintValue::character(c)),
None => Ok(QuaintValue::null_character()),
Expand Down Expand Up @@ -452,7 +450,7 @@ fn js_value_to_quaint(
ColumnType::DoubleArray => js_array_to_quaint(ColumnType::Double, json_value, column_name),
ColumnType::NumericArray => js_array_to_quaint(ColumnType::Numeric, json_value, column_name),
ColumnType::BooleanArray => js_array_to_quaint(ColumnType::Boolean, json_value, column_name),
ColumnType::CharArray => js_array_to_quaint(ColumnType::Char, json_value, column_name),
ColumnType::CharArray => js_array_to_quaint(ColumnType::Character, json_value, column_name),
ColumnType::TextArray => js_array_to_quaint(ColumnType::Text, json_value, column_name),
ColumnType::DateArray => js_array_to_quaint(ColumnType::Date, json_value, column_name),
ColumnType::TimeArray => js_array_to_quaint(ColumnType::Time, json_value, column_name),
Expand Down Expand Up @@ -790,7 +788,7 @@ mod proxy_test {

#[test]
fn js_value_char_to_quaint() {
let column_type = ColumnType::Char;
let column_type = ColumnType::Character;

// null
test_null(QuaintValue::null_character(), column_type);
Expand Down

0 comments on commit 93f4c55

Please sign in to comment.