pub enum SqlMode {
MySQL {
flags: MySqlModeFlags,
},
SQLite,
}Expand description
SQL compatibility mode
VibeSQL supports different SQL dialect modes to match the behavior of different database systems. This is necessary because SQL standards allow implementation-defined behavior in certain areas.
§Differences by Mode
See SQL_COMPATIBILITY_MODE.md in the repository root for a comprehensive list of behavioral differences between modes.
§Division Operator (/)
- MySQL:
INTEGER / INTEGER → DECIMAL(floating-point division)- Example:
83 / 6 = 13.8333
- Example:
- SQLite:
INTEGER / INTEGER → INTEGER(truncated division)- Example:
83 / 6 = 13
- Example:
§Default Mode
MySQL mode is the default to maximize compatibility with the dolthub/sqllogictest test suite, which was generated from MySQL 8.
Variants§
MySQL
MySQL 8.0+ compatibility mode (default)
- Division returns DECIMAL (floating-point)
- Other MySQL-specific behaviors controlled by flags
Fields
§
flags: MySqlModeFlagsSQLite
SQLite 3 compatibility mode
- Division returns INTEGER (truncated)
- Other SQLite-specific behaviors
Note: Currently not fully implemented. Many features will error with “TODO: SQLite mode not yet supported” messages.
Implementations§
Source§impl SqlMode
impl SqlMode
Sourcepub fn mysql_flags(&self) -> Option<&MySqlModeFlags>
pub fn mysql_flags(&self) -> Option<&MySqlModeFlags>
Get the MySQL mode flags, if in MySQL mode
Trait Implementations§
Source§impl OperatorBehavior for SqlMode
impl OperatorBehavior for SqlMode
Source§fn integer_division_behavior(&self) -> DivisionBehavior
fn integer_division_behavior(&self) -> DivisionBehavior
Division behavior for integer/integer operands Read more
Source§fn supports_xor(&self) -> bool
fn supports_xor(&self) -> bool
Whether this mode supports the XOR operator Read more
Source§fn supports_integer_div_operator(&self) -> bool
fn supports_integer_div_operator(&self) -> bool
Whether this mode supports the DIV operator (integer division) Read more
Source§fn string_concat_operator(&self) -> ConcatOperator
fn string_concat_operator(&self) -> ConcatOperator
String concatenation operator preference Read more
Source§impl TypeBehavior for SqlMode
impl TypeBehavior for SqlMode
Source§fn has_decimal_type(&self) -> bool
fn has_decimal_type(&self) -> bool
Whether this mode has a distinct DECIMAL/NUMERIC type Read more
Source§fn uses_dynamic_typing(&self) -> bool
fn uses_dynamic_typing(&self) -> bool
Whether this mode uses dynamic typing (type affinity) Read more
Source§fn division_result_type(&self, left: &SqlValue, right: &SqlValue) -> ValueType
fn division_result_type(&self, left: &SqlValue, right: &SqlValue) -> ValueType
Get the result type for division operation Read more
Source§fn permissive_type_coercion(&self) -> bool
fn permissive_type_coercion(&self) -> bool
Whether implicit type coercion is permissive Read more
impl Eq for SqlMode
impl StructuralPartialEq for SqlMode
Auto Trait Implementations§
impl Freeze for SqlMode
impl RefUnwindSafe for SqlMode
impl Send for SqlMode
impl Sync for SqlMode
impl Unpin for SqlMode
impl UnwindSafe for SqlMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more